Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

This code should include a loop that displays income generated from ticket sales

ID: 3555313 • Letter: T

Question

This code should include a loop that displays income generated from ticket sales for each night. Shows are performed on Thursday, Friday and Saturday nights.

int main()
{
int A, B, C;
int TotalIncome;

cout << "Enter number of seats sold in Section A: ";
cin >> A;

cout << "Enter number of seats sold in Section B: ";
cin >> B;

cout << "Enter a number of seats sold in Section C: ";
cin >> C;

while (A < 0 or A > 300)
{
cout << "ERROR: Seats sold in Section A cannot be ";
cout << "greater than 300 or negative. ";

cout << "Enter valid value for seats sold in section A: ";
cout << "A value in the range of 0 to 300 inclusive. ";
cin >> A;
}
while (B < 0 or B > 500)
{
cout << "ERROR: Seats sold in Section B cannot be ";
cout << "greater than 500 or negative. ";

cout << "Enter valid value for seats sold in section C: ";
cout << "A value in the range of 0 to 500 inclusive. ";
cin >> B;
}
while (C < 0 or C > 200)
{
cout << "ERROR: Seats sold in Section C cannot be ";
cout << "greater than 200 or negative. ";

cout << "Enter valid value for seats sold in section C: ";
cout << "A value in the range of 0 to 200 inclusive. ";
cin >> C;
}
TotalIncome = (A * 20) + (B * 15) + (C * 10);

cout << "The total income generated from ticket sales ";
cout << "of all sections is $ " << TotalIncome;

}

I wrote the code... just need help with how to enter he Thurs-Sat info

Explanation / Answer

Program Code:

// newProg.cpp : Defines the entry point for the console application.
//

#include "stdafx.h"
#include<stdio.h>
#include<iostream>
using namespace std;
int main()
{
int A, B, C;
int TotalIncome;
int thur,fri,sat;
for(int i=0;i<3;i++)
{
   if(i==0)
   {
       cout<<"For Thursday!"<<endl;
       cout<<"---------------------------------------"<<endl;
   }
   if(i==1)
   {
       cout<<"For Friday!"<<endl;
       cout<<"---------------------------------------"<<endl;
   }
   if(i==2)
   {
       cout<<"For Saturday!"<<endl;
       cout<<"---------------------------------------"<<endl;
   }

cout << "Enter number of seats sold in Section A: ";
cin >> A;

cout << "Enter number of seats sold in Section B: ";
cin >> B;

cout << "Enter a number of seats sold in Section C: ";
cin >> C;

while (A < 0 || A > 300)
{
cout << "ERROR: Seats sold in Section A cannot be ";
cout << "greater than 300 or negative. ";

cout << "Enter valid value for seats sold in section A: ";
cout << "A value in the range of 0 to 300 inclusive. ";
cin >> A;
}
while (B < 0 || B > 500)
{
cout << "ERROR: Seats sold in Section B cannot be ";
cout << "greater than 500 or negative. ";

cout << "Enter valid value for seats sold in section C: ";
cout << "A value in the range of 0 to 500 inclusive. ";
cin >> B;
}
while (C < 0 || C > 200)
{
cout << "ERROR: Seats sold in Section C cannot be ";
cout << "greater than 200 or negative. ";

cout << "Enter valid value for seats sold in section C: ";
cout << "A value in the range of 0 to 200 inclusive. ";
cin >> C;
}
TotalIncome = (A * 20) + (B * 15) + (C * 10);

cout << "The total income generated from ticket sales ";
cout << "of all sections is $ " << TotalIncome<<endl;
}
system("pause");
return 0;
}

Sample Output:

For Thursday!
---------------------------------------
Enter number of seats sold in Section A:
120
Enter number of seats sold in Section B:
32
Enter a number of seats sold in Section C:
65
The total income generated from ticket sales
of all sections is $ 3530
For Friday!
---------------------------------------
Enter number of seats sold in Section A:
54
Enter number of seats sold in Section B:
34
Enter a number of seats sold in Section C:
87
The total income generated from ticket sales
of all sections is $ 2460
For Saturday!
---------------------------------------
Enter number of seats sold in Section A:
90
Enter number of seats sold in Section B:
Enter a number of seats sold in Section C:
The total income generated from ticket sales
of all sections is $ 3180
Press any key to continue . . .