1. Write a program using switch statement that computes and assess the tuition f
ID: 3753205 • Letter: 1
Question
1. Write a program using switch statement that computes and assess the tuition fee of the students in one trimester based on the given mode of payment plans below: Plans (key) – Discount/Interest + Cash (1) 10% Discount Two-Installment (2) 5% Interest Three-Installment (3) 10% Interest The user must use the key in selecting or choosing mode of payment. The first input data is the tuition fee, and the second input data is the mode of payment. For example: Main Menu (1) Cash (2) Two-Installment (3) Three-Installment Enter tuition fee: 20000 Press 1 for Cash, Press 2 for Two Installment, Press 3 for Three Installment Enter mod of payments: 2 This is a TUITION FEE ASSESSMENT PROGRAM Your total tuition fee is: 21000
Explanation / Answer
Here goes the required code for your problem. Any doubts please ask in the comments.
==========================================================================
#include <iostream>
using namespace std;
int main(){
int ch=0;
float amount=0, fee=0;
cout<<" Enter tuition fee "; //Enter the tuition feee here
cin>>amount;
cout<<" Press 1:Cash 2:Two-Installment 3:Three-Installment 4:Exit "; //Print choice menu
cin>>ch;
switch(ch){ //Switch between the choices
case 1:
fee = amount - amount*(0.1); //fee calculation logic
cout<<" Your total tuition fee is: "<<fee;
break;
case 2:
fee = amount + amount*(0.05);
cout<<" Your total tuition fee is: "<<fee;
break;
case 3:
fee = amount + amount*(0.1);
cout<<" Your total tuition fee is: "<<fee;
break;
case 4:
break;
default:
cout<<" Invalid choice ";
}
return 0;
}
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.