1. C++ Project Help Needed

I have to do a program for a class and I am clueless.

I have to write a C/C++ program for an amusement park that encourages family visits. The pricing schedule is as follows:

Category Price

Children under 8 \$ 2.00 each

Youth 8 - 18 \$ 8.50 each (for every 4 tickets in this age group,
one person is free; this means for every four tickets purchased, the 4th ticket is free.)

Adults 19+ \$12.50 each (after 10 adult tickets, the price is \$9.00 the first 10 tickets are always \$12.50)

All groups with 20 or more people must pay a \$25.00 security fee.

Write a program that accepts the number of people in each of the three age categories, performs the necessary computations, and displays a bill for the group's admission similar to the display below. Display the number of tickets and the cost of admission for each category, total number of tickets, and the total cost. Only display the security fee if not zero. Be sure to test for a variety of values.

Set up constants as necessary.

Attached is the code I have written so far. I have the basics down but can't get the necessary mathmeatical operations down.

If someone could take a look and give me suggestions I would greatly appreciate it.

2. > All groups with 20 or more people must pay a \$25.00 security fee.
Well all you add now is a bunch of rules to the code, something like this
Code:
```if ( (child + youth + adult) >= 20 ) {
security_fee = 25;
} else {
security_fee = 0;
}```
Now work out what child_fee (easy),youth_fee and adult_fee should be, then output the grand total

Code:
`cout << "please pay " << child_fee + youth_fee + adult_fee + security_fee;`

3. C++ Project Help Needed

I have to do a program for a class and I am clueless.

I have to write a C/C++ program for an amusement park that encourages family visits. The pricing schedule is as follows:

Category Price

Children under 8 \$ 2.00 each

Youth 8 - 18 \$ 8.50 each (for every 4 tickets in this age group,
one person is free; this means for every four tickets purchased, the 4th ticket is free.)

Adults 19+ \$12.50 each (after 10 adult tickets, the price is \$9.00 the first 10 tickets are always \$12.50)

All groups with 20 or more people must pay a \$25.00 security fee.

Write a program that accepts the number of people in each of the three age categories, performs the necessary computations, and displays a bill for the group's admission similar to the display below. Display the number of tickets and the cost of admission for each category, total number of tickets, and the total cost. Only display the security fee if not zero. Be sure to test for a variety of values.

Set up constants as necessary.

Attached is the code I have written so far. I have the basics down but can't get the necessary mathmeatical operations down.

If someone could take a look and give me suggestions I would greatly appreciate it.

4. C++ Project Help Needed

Below is attachement with work I have so far

5. I'm not exactly sure what you want us to do here. I lookedat your code, and there is really not much there. What have you learned so far? did you learn about functions? classes? if you have learned about functions I would make each set of calculations/displays have its own function. Don't use any globals, and use <iostream> instead of <iostream.h>.

axon

EDIT::I just noticed that you main() is accepting arguments? your assignment description does not talk about accepting any command lines arguments, so why do you have it? is there anything else you must do? any flags?

7. I made some additions and comments. i sugegst you look at what i did so you know how to do it
Code:
```// Don Salzler
// Proj2.cpp
// Program for calculating cost of visitors to amusement park
// CodeWarrior

#include <iostream>
using namespace std;
// This function simply calculates the total cost for children
float CalcChild(int NumChild) {
return  NumChild * 2;
}
// This function calculates the total number of free Youths and figures cost based on that
float CalcYouth(int NumYouth) {
int DivFour = NumYouth / 4;
return  (NumYouth - DivFour) * 8.50;
}
//This function calculates cost  if family has in excess of 10 adults, if if they dont't
float Total;
if (NumAdult > 10) {
Total = ((NumAdult - 10) * 9) + 125;
}
else {
Total = NumAdult * 12.50;
}
}

int main(int argc, char* argv[])
{
int child, youth, adult;
char any;

const double CHILDPR = 2.00;
const float YOUTHPR = 8.50;
const float ADULTPR = 12.50;
float CostChild, CostYouth, CostAdult;
cout <<"                       Don's Amusement Ticket Entry\n";
cout <<"                       ------------------------------\n\n";
cout <<"                     Enter number of children under 8: ";
cin >> child;
cout <<"                     Enter number of youth 8-18:       ";
cin >> youth;
cout <<"                     Enter number of adults:           ";

cout <<""<<endl <<endl <<endl;
// Calculating each cost
CostChild = CalcChild(child);
CostYouth = CalcYouth(youth);

cout <<"                           Don's Amusement Park\n\n";
cout <<"          Category            Tickets         Price          Total\n";
cout <<"          --------            -------         -----          -----\n";
cout <<"          Children Under 8       "<<child <<"            \$2.00" <<"          \$" <<CostChild<<endl;
cout <<"          Youth 8-18             "<<youth <<"            \$8.50*"  "         \$" <<CostYouth <<endl;
cout <<"          Adults 19+             "<<adult <<"            \$12.50**""       \$" <<CostAdult <<endl;
cout <<"                              -------\n";
cout <<"                                 " <<child+youth+adult <<endl;
cout <<"                                                             -----\n";
if (child + youth + adult >= 20){    // in event theres20 or more poeple
cout <<"                              Total Bill:   " <<"                 \$" <<CostChild + CostYouth + CostAdult + 25<<"***" <<endl <<endl;
}
else {  // otherwise
cout <<"                              Total Bill:   " <<"                 \$" <<CostChild + CostYouth + CostAdult <<endl <<endl;

}
cout <<"          *One person is free for every 4 tickets in this age group\n";
cout <<"        **The price is \$9 per adult in excess of 10 adults\n";
if (child + youth + adult >= 20){ // Gota let em know about the fee
cout<<"        ***A \$25 security fee has been attached as you have 20 or more people\n";
}

cin >> any;
return 0;

}```

8. Thanks Iamien!

Thanks Iamien! That is a huge help. I do understand it now after looking at the solution. I have been working on this for quite awile and just ran into a brick wall.

It is an online course I am taking so it is very difficult to work through problems if there isn;t anyone to actually show me what I am doing incorrectly.

Thanks again!!

9. Instead of actually having to type those whitespaces

like:
cout << " hi ";
then use tabs

cout << "\thi\t":

10. No problem. if you have any questions just ask. Make sure you know how to set up functions

Popular pages Recent additions