473,320 Members | 1,838 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

Program to calculate the cost of travelling to different zones

24
Can someone please, please help me in finding the slotuion of the following problem:

The cost of one-day travel cards for adult customers on the metro system is based on which zones they cover and is summarised in the following table:

Zone Cost
1 1.70
1 & 2 3.70
1, 2 & 3 4.70
1, 2, 3 & 4 6.00
1, 2, 3, 4 & 5 6.70
1, 2, 3, 4, 5 & 6 9.10

Passengers who are under 16 years of age travel for half price.

Write a C++ program which allows the user to enter the number of the farthest zone they wish to travel to and their age and calculates and displays the price of the appropriate travel card.

Use a loop parogram so the the above calculation can be done over and over again allowing the user to enter a different zone number and age each time. When the user enters the number 0 as the zone number the loo[ and the program should terminate. If the user enters an illegal number or age , no calculation should be done.

Sample output:

Enter the zone number : 4
Enter your age in years : 22
The cost is 6.00

Enter the zone number : 2
Enter your age in years : 14
The cost is 1.85

Enter the zone number : 2
Enter your age in years : 14
Illegal data has been entered.

Enter the zone number : 0
Program Terminated.

Thanxxxxxxx very much in advance.
Jun 12 '07 #1
1 1930
ilikepython
844 Expert 512MB
Can someone please, please help me in finding the slotuion of the following problem:

The cost of one-day travel cards for adult customers on the metro system is based on which zones they cover and is summarised in the following table:

Zone Cost
1 1.70
1 & 2 3.70
1, 2 & 3 4.70
1, 2, 3 & 4 6.00
1, 2, 3, 4 & 5 6.70
1, 2, 3, 4, 5 & 6 9.10

Passengers who are under 16 years of age travel for half price.

Write a C++ program which allows the user to enter the number of the farthest zone they wish to travel to and their age and calculates and displays the price of the appropriate travel card.

Use a loop parogram so the the above calculation can be done over and over again allowing the user to enter a different zone number and age each time. When the user enters the number 0 as the zone number the loo[ and the program should terminate. If the user enters an illegal number or age , no calculation should be done.

Sample output:

Enter the zone number : 4
Enter your age in years : 22
The cost is 6.00

Enter the zone number : 2
Enter your age in years : 14
The cost is 1.85

Enter the zone number : 2
Enter your age in years : 14
Illegal data has been entered.

Enter the zone number : 0
Program Terminated.

Thanxxxxxxx very much in advance.
We can't write it for you, you have to ask a specific question. Also, please read this when you have time.
Jun 12 '07 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

1
by: Building Blocks | last post by:
Hi, All I need is a simle calculate form script which contains this: A script that can handle text input, radio buttons, checkboxes, and dropdowns. Each one of these variables will contain a...
8
by: Nasutperaah | last post by:
Hi all, I have written a C ++ program and now need to add a way to make it exit on command, or start over from the beginning. I have very little programming knowledge; Here is my code: Thanks in...
3
by: gator6688 | last post by:
I have to write a program that asks for a cost-per-item, number of items purchased, and a discount rate. Then it should calculate the total cost, tax due, and amount due. I have to use the...
7
by: rohitsripathi | last post by:
i need help writing this program... i am in college and i do not have time do this right now as i need to study for another test....but this is due tonight...i will pay $5 if you accept to do it and...
1
by: Kayvine | last post by:
Hi guys, this is a question I have for an assignment, it is pretty long, but I am not asking for the code(well if someone wants to write I'll be really happy, lol), but I just want to know how to...
1
by: whnkee | last post by:
I need to audit the freight bills charged by freight company which has over 20,000 consignment per week. The basic charge is base on distance and weight, something like this: SYD-MEL <1kg $6...
7
by: jamesnkk | last post by:
Hi, Although this question may not directly link to Access, but I think it a common question to those developer.so hope you could suggest a solution. How do I get the average cost for Item sold,...
3
by: monkey1001 | last post by:
the program is supposed to calculate home or commercial gas usage and then print the type of customer,present reading,previous reading,cubic used and cost for the month..the user inputs values btw...
87
by: pereges | last post by:
I have a C program which I created on Windows machine. I have compiled and executed the program on windows machine and it gives me the consistent output every time i run it. for eg. input a = 2,...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
0
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.