Question: // tuitionCalculator.cpp : A university calculates tuition based on student classifications. // Resident undergraduate students (living in state) pay a set amount per credit for

// tuitionCalculator.cpp : A university calculates tuition based on student classifications.

// Resident undergraduate students (living in state) pay a set amount per credit for 12 or fewer

// credits and pay 75% of set amount per credit for all additional credits. Non-resident

// undergraduate students (living out of state) pay $5,000 plus 80% of the set amount for all

// credits taken. Graduate students pay $9,500 per semester regardless of the number of credits

// taken. Alumni returning to the university are allowed to audit a course for $50 per course,

// regardless of the number of credits per course.

// Compute the tuition amount for each student.You do not know the number of students in advance.

// Each type of student has their own student code : Resident undergraduate students have student

// code 0, non - resident undergraduate students have student code 1, graduate students have

// student code 2, and alumni students have student code 3.

#include

#include

#include

using namespace std;

// *** function prototypes ***

// Use a switch structure to compute each students tuition payment,

// based on the student code. Within the switch, prompt the user(i.e.the bursar) to enter the

// appropriate facts your program needs to calculate each students tuition amount based on that

// student code, invoke the respective functions(with prototypes above and defined below) to perform the calculations and

// return the semester tuition amount for each type of student, and print the returned tuition

// amount for each student.

// After all students are processed, the main function should call printTotals function to

// display the total amount of tuition calculated and the total number of each type of student

// processed. Finally, the main function should call the averageTutionPerStudent function to

// display the average tuition per student for all students processed.

int main()

{

// constants

const double amountPerCredit = 325.00; // tuition amount per credit

// variables

int studentCode = 0; // input value for student being processed

int totalStudentsArray[4] = { 0, 0, 0, 0 }; // total of each type of student being processed

// prompt the user for the studentCode

cout << "Enter student code (-1 to end): ";

cin >> studentCode;

// allow the user to process students until a code of -1 has been entered

while (studentCode != -1)

{

// validate the input and compute each student tuition, based on the input student code

switch (studentCode)

{

case 0: // Resident undergraduate student processing

break;

case 1: // Non-Resident undergraduate student processing

break;

case 2: // Graduate Student processing

break;

case 3: // Alumni Student processing

break;

default:

cout << "ERROR: Invalid student code entered - Try again";

}

// prompt the user for another student code

cout << "Enter student code (-1 to end): ";

cin >> studentCode;

}

// Print total number of each type of student processed and total tuition calculated

// Print average tuition per student

return 0;

}

// *** function definitions ***

// Define a void function named calcResidentUndergradTuition that accepts the number of credits,

// amountPerCredit, totalStudentsArray, and tuition as input parameters and returns updated

// number of resident instruction students via the array, and the tuition based on the resident

// undergraduate student description described above.

// Define a void function named calcNonResidentUndergradTuition that accepts the number of credits,

// amountPerCredit, totalStudentsArray, and tuition as input parameters and returns the updated

// number of non - resident instruction students via the array, and the tuition based on non-resident

// undergraduate student description described above.

// Define void function named calcGraduateTuition that accepts totalStudentsArray and tuition

// as input parameters and returns the updated number of graduate students via the array and

// the tuition based on the graduate student description described above.

// Define void function named calcAlumniTuition that accepts numberOfCourses, totalStudentsArray,

// and tuition as input parameters and returns the updated number of alumni students via the

// array and the tuition based on the alumni student description described above.

// Define a void function named printTotals accepts the totalTuitionCalculated and

// totalStudentsArray as parameters and displays the total number of each type of student

// processed and the total amount of tuition calculated for all students.

// Define a value-returning function named averageTuitionPerStudent that accepts the

// totalTuitionCalculated and totalStudentsArray as parameters, calculates the total number

// of all students, and returns the average tuition per student for all students processed.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!