Karlton Learning wants a program that displays the amount of money a company owe
ID: 3564077 • Letter: K
Question
Karlton Learning wants a program that displays the amount of money a company owes for a seminar. Th e fee per person is based on the number of people the company registers, as shown in Figure 6-43. For example, if the company registers seven people, then the total amount owed is $560. If the user enters a number that is less than or equal to zero, the program should display an appropriate error message.
Number of registrants Fee per person
1 through 4 $100
5 through 10 $80
11 or more $60
Can you please answer this in a nested if statements
Explanation / Answer
#include<iostream>
int main()
{
using namespace std;
int number =0;
cout<<"Enter the number of registrants :"<<endl;
cin>>number;
if(number <=0){
cout<<"Number should be greater than zero."<<endl;
}
else if(number<=4){
cout<<"Total Amount Owed is :"<<number*100<<endl;
}
else if(number>4 && number<=10){
cout<<"Total Amount Owed is :"<<number*80<<endl;
}
else{
cout<<"Total Amount Owed is :"<<number*60<<endl;
}
return 0;
}
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.