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

write the program in C++ PROBLEM 2 (USE A DO-WHILE LOOP): Create a program that

ID: 3839171 • Letter: W

Question

write the program in C++

PROBLEM 2 (USE A DO-WHILE LOOP): Create a program that displays the registration information for programming seminars. The price per person depends on the number of people a company registers. For example if a company registers four people, the amount owed is 4 * $100 or $400. The following table shows the charge per registrant based on the number registered: Number of registrants Charge per person ($) 1 – 3 $150 4 -9 $100 10 or more $90 The program should allow the user to enter registration for any number of companies. USE A DO – WHILE LOOP to process the first company, then prompt the user whether to continue or not. When done, also display the total number of companies registered, total number of people registered, the total charges, and the average charge per registrant. Sample Output (Test case 1) Enter company name: Xerox How many registrants? 4 INVOICE Company: Xerox Cost per registrant: 100.00 Total for 4 people is $400.00 Another registration? (Y/N) y Enter company name: Cisco How many registrants? 2 INVOICE Company: Cisco Cost per registrant: 150.00 Total for 2 people is $300.00 Another registration? (Y/N) n REGISTRATION SUMMARY Number of companies registered: 2 Total number of people registered: 6 Total charges: $700.00 Average charge per person: $116.67

Explanation / Answer

//c++ code for given registration problem

#include <iostream>
using namespace std;

int main() {
   // your code goes here
std::cout << "REGRISTRATION INFORMATION" << std::endl;
   std::cout <<"No.of person Charger per person" << std::endl;
   std::cout <<"1-3 $150" << std::endl;
   std::cout <<"4-9 $100" << std::endl;
   std::cout <<"10 or more $90" << std::endl;
  
   string company,choice;
   int numPerson,totalPerson=0;
   int cost,totalCost=0;
   int totalCompanies=0;
   do{
   cout << "Enter company name";
   cin >> company;
   totalCompanies+=1;
   cout << "How many Registrants?";
   cin >> numPerson;
   totalPerson+=numPerson;
   if(numPerson<=3 and numPerson>=1){
   cost= numPerson*150;
   totalCost+=cost;
   cout<<"INVOICE: COMPANY:"<<company << " Cost per registrant: $150 Total for " << numPerson <<"people is"<<cost ;
   }
   else if (numPerson<=9 and numPerson>=4){
   cost= numPerson*100;
   totalCost+=cost;
   cout<<"INVOICE: COMPANY:"<<company << " Cost per registrant: $100 Total for " << numPerson <<"people is"<<cost ;
   }
   else if(numPerson>=10){
   cost= numPerson*90;
   totalCost+=cost;
   cout<<"INVOICE: COMPANY:"<<company << " Cost per registrant: $90 Total for " << numPerson <<"people is"<<cost ;
   }
   cout <<"Another Registration?(y/n)";
   cin >> choice;
   }
   while(choice == "y");
   cout <<"Registration Summary No.of companies registered"<< totalCompanies;
   cout <<" Total people registered:" <<totalPerson;
   cout <<"Total Charges:" <<totalCost;
   cout << "Average Cost per person:" << totalCost/totalPerson;
   return 0;
}