Create a C++ program which calculates student fees for those attending Santa Mon
ID: 3661946 • Letter: C
Question
Create a C++ program which calculates student fees for those attending Santa Monica College. IN ORDER TO RECEIVE FULL CREDIT, YOU MUST CREATE FUNCTIONS TO SOLVE THIS PROBLEM WITH BOTH PASS-BY-VALUE AND PASS-BY-REFERENCE PARAMETER (No, main() doesn't count). Summarized in the chart below is the cost calculations I want your program to perform.
SANTA MONICA COLLEGE STUDENT FEES (as of Fall, 2014)
Enrollment Fee
$ 46.00/ unit for California Residents
$ 335.00/ unit for F1/Non-Residents
Student Services Fee
(AS Sticker fee is Optional, saving $19.50)
(ID Card fee is Optional, saving $13)
$ 48.50 Winter/Summer
$ 51.50 Fall/Spring
Parking Decal (Optional)
$ 45.00 Winter/Summer
$ 85.00 Fall/Spring
A number of different program dialogues describe the program I am looking for.
SMC Fee Calculator
Enter number of units enrolled: 18
Is this Fall[0], Winter[1], Spring[2] or Summer[3] session: 0
Are you a state resident[0] or not[1]: 0
Want a parking decal? [y/n]: n
Want an AS sticker? [y/n]: n
Want an ID card? [y/n]: n
For Fall semester, your total fees are $ 847.00
SMC Fee Calculator
Enter number of units enrolled: 6
Is this Fall[0], Winter[1], Spring[2] or Summer[3] session: 1
Are you a state resident[0] or not[1]: 1
Want a parking decal? [y/n]: y
Want an AS sticker? [y/n]: y
Want an ID card? [y/n]: y
For Winter semester, your total fees are $ 2103.50
SMC Fee Calculator
Enter number of units enrolled: 18
Is this Fall[0], Winter[1], Spring[2] or Summer[3] session: 2
Are you a state resident[0] or not[1]: 1
Want a parking decal? [y/n]: y
Want an AS sticker? [y/n]: y
Want an ID card? [y/n]: y
For Spring semester, your total fees are $ 6166.50
Enrollment Fee
$ 46.00/ unit for California Residents
$ 335.00/ unit for F1/Non-Residents
Student Services Fee
(AS Sticker fee is Optional, saving $19.50)
(ID Card fee is Optional, saving $13)
$ 48.50 Winter/Summer
$ 51.50 Fall/Spring
Parking Decal (Optional)
$ 45.00 Winter/Summer
$ 85.00 Fall/Spring
Explanation / Answer
Answer:-
#include <iostream.h>
using namespace std;
float calculate_fee(int u,int ss,int rs,char ps,char sts,char is)
{
float tot=0.0;
if(rs==0)
{
tot=tot+u*46;
}
else
{
tot=tot+u*335;
}
if(ss==1|ss==3)
{
tot=tot+48.50;
}
else
{
tot=tot+51.50;
}
if(ps=='y'|ps=='Y')
{
if(ss==1|ss==3)
{
tot=tot+45;
}
else
{
tot=tot+85;
}
}
if(sts=='n'|sts=='N')
{
tot=tot-19.50;
}
if(is=='n'|is=='N')
{
tot=tot-13;
}
return tot;
}
int main()
{
int units,sess_stat,resi_stat;
char parking_stat,sticker_stat,id_stat;
float total_fee=0.0;
cout<<" SMC FEE CALCULATOR ";
cout<<" Enter no. of Units enrolled : ";
cin>>units;
cout<<" Is this Fall[0], Winter[1], Spring[2] or Summer[3] session:";
cin>>sess_stat;
cout<<" Are you a state resident[0] or not[1]:";
cin>>resi_stat;
cout<<" Want a parking decal? [y/n]:";
cin>>parking_stat;
cout<<" Want an AS sticker? [y/n]:";
cin>>sticker_stat;
cout<<" Want an ID card? [y/n]: ";
cin>>id_stat;
total_fee=calculate_fee(units,sess_stat,resi_stat,parking_stat,sticker_stat,id_stat);
cout<<" For Fall semester, your total fees are : $"<<total_fee;
return 0;
}