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. Be sure to test for a variety of values.


Here is a sample display after three values are entered:

Amusement Park

			Tickets   Price	       Total
Children	     ##	       2.00	    $$$$.$$
Youth		      ##	8.50	     $$$$.$$
Adults		      ##	12.50        $$$$.$$
									
			    Total Bill          $$$$$.$$

i cant get wat i got to run, can someone see if im doing it right?

#include <iostream>
#include <iomanip>
using namespace std; 

int main()
{
	//declare variables
	int numberOfChildren, 
		numberOfYouth, 
		numberOfAdult;

	const double children = 2.00, 
				 youth = 8.50, 
				 adult = 12.50;

	double youthCost,
		  childrenCost,
		  adultCost,
		  totalCost;


	//input
	cout << "Enter number of children: ";
	cin >> numberOfChildren;
	cout << "Enter number of youth: ";
	cin >> numberOfYouth;
	cout << "Enter number of adult: ";
	cin >> numberOfAdult;
		
	//process
	numberOfChildren * 2.00 = childrenCost;
	numberOfYouth * 8.50 = youthCost;
	numberOfAdult * 12.50 = adultCost;
	childrenCost + youthCost + adultCost = totalCost;


	//output
	cout.sef(ios::fixed);
	cout.setf(ios::showpoint);
	cout.precision(2);

	cout << setw(40) << "Drenning Amusement Park" << endl << endl;
	cout << setw(26)<< "Tickets",
	cout << setw(10)<< "Price",
	cout << setw(10)<< "Total" << endl;
	cout << "Children" << numberOfChildren << "2.00" << childrenCost << endl;
	cout << "Youth" << numberOfYouth << "8.50" << youthCost << endl;
	cout << "Youth" << numberOfAdult << "12.50" << adultCost << endl;
	cout << setw(44) << "Total Bill" << totalCost;
	system("pause");
	return 0;
}
//process
numberOfChildren * 2.00 = childrenCost;
numberOfYouth * 8.50 = youthCost;
numberOfAdult * 12.50 = adultCost;
childrenCost + youthCost + adultCost = totalCost;

You've got these statements backwards. They should be in the format

[B]variable[/B] = value * value;

Your output looks like it will need some tweaking and extra spaces, but other than that, it's good to go. Finally,

system("pause");

Is a bad idea. Find out why:
http://www.gidnetwork.com/b-61.html

thx for help, im just starting out with c++.
thx for the tip on system("pause") i never new that

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.