Question

Description. A university calculates tuition based on student classifications. Resident undergraduate students (living in state) pay...

Description. 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. 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.

Complete the main function and include a local constant variable named amountPerCredit that is set to 325.00 to be used as the tuition amount per credit for this project. The main function should then prompt the user for the student code –“Enter student code (-1 to end): “, validate the input and perform the associated processing for that student code. Your program should allow the user to process students until a student code of -1 has been entered. Use a switch structure to compute each student’s 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 student’s tuition amount based on that student code, invoke the respective functions (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.

As students are being processed, the total amount of tuition being calculated using the totalTuitionCalculated variable. In addition, the total number of each type of student processed should be calculated. Your project should include an array to store the number of each type of student processed. The array name should be totalStudentsArray, and contain the respective counters for each student type (i.e. totalStudentsArray[0] is the number of resident instruction process, totalStudentsArray [1] is the number of non-resident students processed, etc.). 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.

Define a void function named calcResidentUndergradTuition that accepts the numberOfCredits, 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 at the top of this page.

Define a void function named calcNonResidentUndergradTuition that accepts the numberOfCredits, amountPerCredit, totalStudentsArray, and tuition as input parameters and returns the updated number of nonresident instruction students via the array, and the tuition based on non-resident undergraduate student description described at the top of this page.

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 at the top of this page.

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 at the top of this page.

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.

// 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 student’s 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 student’s 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.

c+++

compsc 101 intro to C+++

oops o meant intro to C++
0 0
Add a comment Improve this question Transcribed image text
Answer #1

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

#include<bits/stdc++.h>

using namespace std;

void calcResidentUndergradTuition(int numberOfCredits,double amountPerCredit,int *totalStudentArray,double *tuition)

{

    int setAmountCredits=min(numberOfCredits,12);

    int additionalCredits=max(0,numberOfCredits-12);

    *tuition=(setAmountCredits*amountPerCredit)+(0.75*additionalCredits*amountPerCredit);

    totalStudentArray[0]++;

}

void calcNonResidentUndergradTuition(int numberOfCredits,double amountPerCredit,int *totalStudentArray,double *tuition)

{

    *tuition=5000.00+(0.80*numberOfCredits*amountPerCredit);

    totalStudentArray[1]++;

}

void calcGraduateTuition(int *totalStudentArray,double *tuition)

{

    *tuition=9500.00;

    totalStudentArray[2]++;

}

void calcAlumniTuition(int numberOfCourses,int *totalStudentArray,double *tuition)

{

    *tuition=(50*numberOfCourses);

    totalStudentArray[3]++;

}

void printTotals(double totalTuitionCalculated,int *totalStudentArray)

{

    cout<<"Total number of Resident Undergraduate students are: "<<totalStudentArray[0]<<"\n";

    cout<<"Total number of Non-Resident Undergraduate students are: "<<totalStudentArray[1]<<"\n";

    cout<<"Total number of Graduate students are: "<<totalStudentArray[2]<<"\n";

    cout<<"Total number of Alumni as students are: "<<totalStudentArray[3]<<"\n";

    cout<<"Total amount of tuition calculated are: "<<totalTuitionCalculated<<"\n";

}

void averageTuitionPerStudent(double totalTuitionCalculated,int *totalStudentArray)

{

    int totalStudents=0;

    for(int i=0;i<4;i++)

    totalStudents+=totalStudentArray[i];

    cout<<"Average tuition per student is: "<<(totalTuitionCalculated/totalStudents)<<"\n";

}

int main()

{

    const double amountPerCredit=325.00;

    double totalTuitionCalculated=0.00;

    double tuition=0.00;

    int numberOfCredits=0,numberOfCourses=0;

    int studentCode=0;

    int totalStudentArray[4]={0,0,0,0};

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

    cin>>studentCode;

    while(studentCode!=-1)

    {

        switch(studentCode)

        {

            case 0:  // Resident undergraduate student processing

            cout<<"Enter total number of credits in which student is enrolled\n";

            cin>>numberOfCredits;

            tuition=0.00;

            calcResidentUndergradTuition(numberOfCredits,amountPerCredit,totalStudentArray,&tuition);

            totalTuitionCalculated+=tuition;

            break;

            case 1: // Non-Resident undergraduate student processing

            cout<<"Enter total number of credits in which student is enrolled\n";

            cin>>numberOfCredits;

            tuition=0.00;

            calcNonResidentUndergradTuition(numberOfCredits,amountPerCredit,totalStudentArray,&tuition);

            totalTuitionCalculated+=tuition;

            break;

            case 2: // Graduate Student processing

            tuition=0.00;

            calcGraduateTuition(totalStudentArray,&tuition);

            totalTuitionCalculated+=tuition;

            break;

            case 3: // Alumni Student processing

            cout<<"Enter number of courses in which a particular alumni is involved\n";

            cin>>numberOfCourses;

            tuition=0.00;

            calcAlumniTuition(numberOfCourses,totalStudentArray,&tuition);

            totalTuitionCalculated+=tuition;

            break;

            default:

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

        }

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

        cin>>studentCode;

    }

    printTotals(totalTuitionCalculated,totalStudentArray);

    averageTuitionPerStudent(totalTuitionCalculated,totalStudentArray);

    return 0;

}

Add a comment
Know the answer?
Add Answer to:
Description. A university calculates tuition based on student classifications. Resident undergraduate students (living in state) pay...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • Create an abstract Student class for Parker University. The class contains fields for student ID number,...

    Create an abstract Student class for Parker University. The class contains fields for student ID number, last name, and annual tuition. Include a constructor that requires parameters for the ID number and name. Include get and set methods for each field; the setTuition() method is abstract. Create three Student subclasses named UndergraduateStudent, GraduateStudent, and StudentAtLarge, each with a unique setTuition() method. Tuition for an UndergraduateStudent is $4,000 per semester, tuition for a GraduateStudent is $6,000 per semester, and tuition for...

  • PART I: Create an abstract Java class named “Student” in a package named “STUDENTS”. This class...

    PART I: Create an abstract Java class named “Student” in a package named “STUDENTS”. This class has 4 attributes: (1) student ID: protected, an integer of 10 digits (2) student name: protected (3) student group code: protected, an integer (1 for undergraduates, 2 for graduate students) (4) student major: protected (e.g.: Business, Computer Sciences, Engineering) Class Student declaration provides a default constructor, get-methods and set-methods for the attributes, a public abstract method (displayStudentData()). PART II: Create a Java class named...

  • CS 1050 Homework Assignment 2 – SUMMER 2017 DUE Friday, July 7th at 5PM WARNING –...

    CS 1050 Homework Assignment 2 – SUMMER 2017 DUE Friday, July 7th at 5PM WARNING – Technology failing is not an excuse to turn in your assignment late. START EARLY so you will have time to fix problems before the deadline. Directions: Complete the following homework assignment using the description given in each section. Purpose: The Tuition.c program will be used to Read in the Student ID (an integer value) and use an array search see if the ID is...

  • Part I (20%) [File: Student.java] Create a class called Student that has the following stored properties:...

    Part I (20%) [File: Student.java] Create a class called Student that has the following stored properties: • StudentID • First Name • Last Name Class Student should have read/write properties, constructor(s) and should implement the Academic interface. For academic methods, return zero for average, zero for credits and false for graduate. Also implement the toString() method that returns the above information as a String. Part II (5%) [File: Academic.java] Create an interface Academic that declares three methods: 1. average -...

  • Write a C++ program that asks user number of students in a class and their names....

    Write a C++ program that asks user number of students in a class and their names. Number of students are limited to 100 maximum. Then, it will ask for 3 test scores of each student. The program will calculate the average of test scores for each student and display with their names. Then, it will sort the averages in descending order and display the sorted list with students’ names and ranking. Follow the Steps Below Save the project as A4_StudentRanking_yourname....

  • C++ please use only easy code and stdio.h because im just a beginner Description Write the...

    C++ please use only easy code and stdio.h because im just a beginner Description Write the program that can manage the information of students as follows: S 1. This program has two phase; the input phase and the output phase. 2. In an input phase, a teacher inputs the information (name, score, and department) for each student. The total number of students who can be inputted should be defined as a NUM OF_STUDENT constant value. In this example, the value...

  • Create a C program to implement a grade book. Must follow these guidelines: 1. Use #define...

    Create a C program to implement a grade book. Must follow these guidelines: 1. Use #define to define MAX_SIZE1 as 20, and MAX_SIZE2 as 10 2. Use typedef to define the following struct type: struct { char name[MAX_SIZE1]; int scores[MAX_SIZE2]; } 3. The program accepts from the comand line an integer n (<= 30) as the number of students in the class. You may assume that the input will always be valid. 4. Dynamically allocate memory for an array of...

  • Write a java code : Student ID at University is composed of year of admission and...

    Write a java code : Student ID at University is composed of year of admission and students number. we aim to implement a structure that improves operations of inserting and searching for a student. To enhance these operations, we will build a tree of linked lists (TreeOfLists) to combine advantages of both structures. Each node in this tree contains a linked list of all students who were admitted in that year. Each node in the linked list represents a student(id,...

  • C++ Programming

    PROGRAM DESCRIPTIONIn this project, you have to write a C++ program to keep track of grades of students using structures and files.You are provided a data file named student.dat. Open the file to view it. Keep a backup of this file all the time since you will be editing this file in the program and may lose the content.The file has multiple rows—each row represents a student. The data items are in order: last name, first name including any middle...

  • Problem Specification: Write a C++ program to calculate student’s GPA for the semester in your class. For each student, the program should accept a student’s name, ID number and the number of courses...

    Problem Specification:Write a C++ program to calculate student’s GPA for the semester in your class. For each student,the program should accept a student’s name, ID number and the number of courses he/she istaking, then for each course the following data is needed the course number a string e.g. BU 101 course credits “an integer” grade received for the course “a character”.The program should display each student’s information and their courses information. It shouldalso display the GPA for the semester. The...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT