I need help making a code modular. It needsa function prototype, function definition and function call. #include int ticketsValid(double sectionA, double sectionB, double sectionC); int totalIncome (); using namespace std; int main() { double sectionA =0; double sectionB =0; double sectionC =0; int ticketsValid(double sectionA); { while (sectionA > 300 || sectionA <= 0) { cout<<"Maximum of 300 seats in section A"<> sectionA; } int ticketsValid(double sectionB); while (sectionB > 500 || sectionB <= 0) { cout <<"Maximum of 500 seats in section B" << endl; cout <<"Enter the number of tickets sold in SectionB: " ; cin >> sectionB; } int ticketsValid(double sectionC); while (sectionC > 200 || sectionC == 0) { cout <<"Maximum of 200 seats in section C" <> sectionC; } int totalIncome(double sectionA, double sectionB, double sectionC); { int totalIncome = (sectionA * 20) + (sectionB * 15) + (sectionC * 10); cout <<"The income generated is $" << totalIncome; } //return variables return (sectionA, sectionB, sectionC);} } }
I need help making a code modular. It needsa function prototype, function definition and function call.
#include <iostream>
int ticketsValid(double sectionA, double sectionB, double sectionC);
int totalIncome ();
using namespace std;
int main()
{
double sectionA =0;
double sectionB =0;
double sectionC =0;
int ticketsValid(double sectionA);
{
while (sectionA > 300 || sectionA <= 0)
{
cout<<"Maximum of 300 seats in section A"<<endl;
cout <<"Enter the number of tickets sold in Section A: " ;
//Section A input
cin >> sectionA;
}
int ticketsValid(double sectionB);
while (sectionB > 500 || sectionB <= 0)
{
cout <<"Maximum of 500 seats in section B" << endl;
cout <<"Enter the number of tickets sold in SectionB: " ;
cin >> sectionB;
}
int ticketsValid(double sectionC);
while (sectionC > 200 || sectionC == 0)
{
cout <<"Maximum of 200 seats in section C" <<endl;
cout << "Enter the number of tickets sold in section C: ";
cin >> sectionC;
}
int totalIncome(double sectionA, double sectionB, double sectionC);
{
int totalIncome = (sectionA * 20) + (sectionB * 15) + (sectionC * 10);
cout <<"The income generated is $" << totalIncome;
}
//return variables
return (sectionA, sectionB, sectionC);}
} }
Trending now
This is a popular solution!
Step by step
Solved in 3 steps with 1 images