The cost of a brand new car is P420,000 for GL model and P398,000 for XL model. If a car
phone will be installed, an additional P40,000 will be added to the cost. Moreover, a 15%
discount on the total cost will be given if the buyer pays in full (not installment).
Write a program that would input the car model bought whether with car phone (use code
"W" for car with car phone and "O" for without car phone) and whether it will be paid in full (use
code "F" for full payment and "I" for installment). Program must then output the net cost of the
car.
#include <iostream>
using namespace std;
int main(){
float pGL = 420000, pXL = 398000, phone = 40000, net_price;
char model, with_phone, pay_type;
cout<<"Input model (G or X): ";
cin>>model;
switch(model){
case 'G': net_price = pGL; break;
case 'X': net_price = pXL; break;
default: cout<<"Invalid model\n"; return 0;
}
cout<<"With or without phone (W or O): ";
cin>>with_phone;
switch(with_phone){
case 'W': net_price += phone; break;
case 'O': break;
default: cout<<"Invalid option\n"; return 0;
}
cout<<"Paid in full or installment (F or I): ";
cin>>pay_type;
switch(pay_type){
case 'F': net_price *= 0.85; break;
case 'I': break;
default: cout<<"Invalid option\n"; return 0;
}
cout<<"\nNet cost of the car: "<<net_price<<endl;
return 0;
}
Comments
Leave a comment