Question #14314

I have to make a program with switch like this: Adventist University of Central America are charged according to the area of study for the career of Engineering systems are $ 1,800 per semester, for the career of Business Administration are $ 1,780 per semester, for the career of mathematics education is $ 1,600 per semester and nursing career are $ 2000, creates a program that determines the value of the career by area chosen taking into account that if the student is Adventist has a 10% discount and if you have more than one brother studying at the University has another 10% off. Eventually display discounts and total payable.

Expert's answer

#include <iostream>

#include <conio.h>

using namespace std;

int main ()

{

int choice;

double totalCost = 0;

char discount;

cout<<"1) Career of Engineering system" << endl;

cout<<"2) Business Administration" << endl;

cout<<"3) Career of mathematics education" << endl;

cin >> choice;

switch(choice) {

case 1 :

totalCost = 1800;

cout<<"Are you Adventist ? (y/n)" << endl;

cin >> discount;

if (discount = 'y'){

totalCost-=totalCost*0,1;

}

cout<<"Do you have more then 1 brother already studying ?(y/n)" << endl;

cin >> discount;

if (discount = 'y'){

totalCost-=totalCost*0,1;

}

cout<<"Total cost = $"<< totalCost << endl;

break;

case 2 :

totalCost= 1780;

cout<<"Are you Adventist ? (y/n)" << endl;

cin >> discount;

if (discount = 'y'){

totalCost-=totalCost*0,1;

}

cout<<"Do you have more then 1 brother already studying ?(y/n)" << endl;

cin >> discount;

if (discount = 'y'){

totalCost-=totalCost*0,1;

}

cout<<"Total cost = $"<< totalCost << endl;

break;

case 3:

totalCost = 2000;

cout<<"Are you Adventist ? (y/n)" << endl;

cin >> discount;

if (discount = 'y'){

totalCost-=totalCost*0,1;

}

cout<<"Do you have more then 1 brother already studying ?(y/n)" << endl;

cin >> discount;

if (discount = 'y'){

totalCost-=totalCost*0,1;

}

cout<<"Total cost = $"<< totalCost << endl;

break;

}

system("pause");

return 0;

}

#include <conio.h>

using namespace std;

int main ()

{

int choice;

double totalCost = 0;

char discount;

cout<<"1) Career of Engineering system" << endl;

cout<<"2) Business Administration" << endl;

cout<<"3) Career of mathematics education" << endl;

cin >> choice;

switch(choice) {

case 1 :

totalCost = 1800;

cout<<"Are you Adventist ? (y/n)" << endl;

cin >> discount;

if (discount = 'y'){

totalCost-=totalCost*0,1;

}

cout<<"Do you have more then 1 brother already studying ?(y/n)" << endl;

cin >> discount;

if (discount = 'y'){

totalCost-=totalCost*0,1;

}

cout<<"Total cost = $"<< totalCost << endl;

break;

case 2 :

totalCost= 1780;

cout<<"Are you Adventist ? (y/n)" << endl;

cin >> discount;

if (discount = 'y'){

totalCost-=totalCost*0,1;

}

cout<<"Do you have more then 1 brother already studying ?(y/n)" << endl;

cin >> discount;

if (discount = 'y'){

totalCost-=totalCost*0,1;

}

cout<<"Total cost = $"<< totalCost << endl;

break;

case 3:

totalCost = 2000;

cout<<"Are you Adventist ? (y/n)" << endl;

cin >> discount;

if (discount = 'y'){

totalCost-=totalCost*0,1;

}

cout<<"Do you have more then 1 brother already studying ?(y/n)" << endl;

cin >> discount;

if (discount = 'y'){

totalCost-=totalCost*0,1;

}

cout<<"Total cost = $"<< totalCost << endl;

break;

}

system("pause");

return 0;

}

## Comments

## Leave a comment