help needed with Box office program

Hannahcorbin1 (7)
This program does not ask for user input after movie input. Also the calculations are not correct. Can anyone provide some helpful suggestions? Thanks.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
#include <iostream>
#include <iomanip>
using namespace std;

int main()
{
	//Constants for adult and child ticket costs
	const double cost_per_child_tix = 3;
	const double cost_per_adult_tix = 6;

	//Variables
	double adult, //Amount of adult tix sold
	 child, //Amount of child tix sold
	 movie, //Holds movie name
	gross_adult_tix,   // Holds gross amount of adult tickets
	gross_child_tix,   // Holds gross amount of child tickets
	total_box_office_profit, //Holds total box office profit
	net_box_office_profit,  //Holds total earnings for theater
	amount_paid_distributor; //Holds final amount paid to distributor

	//Set the desired output formatting for numbers.
	cout << setprecision(2) << fixed << showpoint;

	//Prompt the user for the movies name
	cout <<"Please enter name of movie: \n";
	cin >> movie;

	//Get adult tickets sold
	cout << "Enter number of adult tickets sold: \n";
	cin >> adult;

	//Get child tickets sold
	cout << "Enter number of child tickets sold: \n";
	cin >> child;

	//Calculate gross amount for adult tickets sold
	gross_adult_tix = adult * cost_per_adult_tix;

	//Calculate gross amount of child tickets sold
	gross_child_tix = child * cost_per_child_tix;

	//Calculate gross box office profit
	total_box_office_profit = gross_child_tix + gross_adult_tix;

	//Calculate net box office profit (Theater earnings)
	net_box_office_profit = total_box_office_profit * .20;

	//calculate amount paid to distributor
	amount_paid_distributor = total_box_office_profit - net_box_office_profit;

	//Display movie name and header for daily earning report
	cout << "Daily earnings report for movie:" << movie << endl;

	//Display amount of adult tickets sold
	cout << "Adult tickets sold:" << adult << endl;

	//Display amount of child tickets sold
	cout << "Child tickets sold:" << child << endl;

	//Display gross amount for box office profit
	cout << "Gross box office profit:" << total_box_office_profit << endl;

	//Display net gross amount of profit
	cout << "Gross net box office profit:" << net_box_office_profit << endl;

	//Display amount paid to distributor
	cout << "Amount paid to distributor:" << amount_paid_distributor << endl;



	return 0;
}


output from above code:
Please enter name of movie:
love
Enter number of adult tickets sold:
Enter number of child tickets sold:
Daily earnings report for movie:0.00
Adult tickets sold:0.00
Child tickets sold:-0.00
Gross box office profit:-0.00
Gross net box office profit:-0.00
Amount paid to distributor:-0.00
Zaita (2400)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
#include <iostream>
#include <iomanip>
using namespace std;

int main()
{
// ....

	//Prompt the user for the movies name
	cout <<"Please enter name of movie:" << endl;
	cin >> movie;
	cin.clear();
	cin.ignore(256, '\n');
// ....
	return 0;
}
Hannahcorbin1 (7)
Thank you for the reply Zaita. Can you please comment on the section you pointed out. Thanks/
Hannahcorbin1 (7)
Thank you. It worked!!
TheIdeasMan (1753)
Did it work despite that movie was of the type double & not string?
Registered users can post here. Sign in or register to post.