Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Project 1: SMC Student Fees Create a C++ program which calculates student fees f

ID: 673028 • Letter: P

Question

Project 1: SMC Student Fees
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

#include <iostream>
#include <iomanip>
using namespace std;

void intReader(int *numUnits) //Function which takes an integer pointer as input and reads a value into it.
{
cin>>*numUnits;
}

char charReader()   //Function which reads a character variable and returns.
{
char x;
cin>>x;
return x;
}
float feeCalc(int numUnits, int season, int residentStatus, char parkingDecal, char ASSticker, char IDCard) //Fee calculation
{
float fee = 0.0;
if(residentStatus == 0)   //If resident.
fee += (46 * numUnits);
else                       //If non-resident.
fee += (335 * numUnits);
if(season == 0 || season == 2)   //If the season is either Fall or Spring.
fee += 51.5;
else               //If the season is either Winter or Summer.
fee += 48.5;
if(ASSticker == 'n')   //If the student don't need an AS Sticker.
fee -= 19.5;
if(IDCard == 'n')       //If the student don't need an ID Card.
fee -= 13;
if(parkingDecal == 'y')   //If the student needs a parking decal.
{
if(season == 0 || season == 2)   //During either Fall or Spring.
fee += 85;
else               //During either Winter or Summer.
fee += 45;
}
return fee;
}
string semester(int season)
{
if(season == 0)
return "Fall";
else if(season == 1)
return "Winter";
else if(season == 2)
return "Spring";
else
return "Summer";   
}
int main()
{
int numUnits, season, residentStatus;
char parkingDecal, ASSticker, IDCard;
float totalFee;
cout<<"SMC Fee Calculator"<<endl;
cout<<"Enter number of units enrolled: ";
intReader(&numUnits);   //Reading number with call by reference function.
cout<<"Is this Fall[0], Winter[1], Spring[2] or Summer[3] session: ";
intReader(&season);
cout<<"Are you a state resident[0] or not[1]: ";
intReader(&residentStatus);
cout<<"Want a parking decal? [y/n]: ";
parkingDecal = charReader(); //Reading character with call by value function.
cout<<"Want an AS sticker? [y/n]: ";
ASSticker = charReader();
cout<<"Want an ID card? [y/n]: ";
IDCard = charReader();
totalFee = feeCalc(numUnits,season,residentStatus,parkingDecal,ASSticker,IDCard); //Function to calculate the fees.
cout<<"For "<<semester(season)<<" semester, your total fees are $"<<fixed<<setprecision(2)<<totalFee<<endl;
}