ComputerScienceExpert

(11)

$18/per page/

About ComputerScienceExpert

Levels Tought:
Elementary,Middle School,High School,College,University,PHD

Expertise:
Applied Sciences,Calculus See all
Applied Sciences,Calculus,Chemistry,Computer Science,Environmental science,Information Systems,Science Hide all
Teaching Since: Apr 2017
Last Sign in: 103 Weeks Ago, 3 Days Ago
Questions Answered: 4870
Tutorials Posted: 4863

Education

  • MBA IT, Mater in Science and Technology
    Devry
    Jul-1996 - Jul-2000

Experience

  • Professor
    Devry University
    Mar-2010 - Oct-2016

Category > Programming Posted 11 May 2017 My Price 9.00

create a program that will calculate a student’s tuition

I have attached a text file where I am trying to complete the project below. Can someone tell me what is wrong with the last of my code. 

 

 

In this project you will create a program that will calculate a student’s tuition for a given semester. Since you will be dealing with money you will need to use a double datatype when creating your variables that hold the number of credit hours and the tuition cost. The program will prompt the user for the number of classes you are registering for this semester. It should then prompt you to enter in the number of credit hours for each of those classes. Here are some of the main variables you will need to create for the program:

  • numCourses                            Holds the number of classes the student is taking
  • sumCreditHoursTaken            Holds the total number credit hours the student is taking
  • costCreditHour                        Default $147.00, this is the cost of hours 1 through 12
  • maxHoursFullTuition               Default 12, indicates hours 1 through 12 are at full tuition
  • maintFeeAddOn                      Default $29.33, indicates the cost of hours 13 and above    

 

Once you have gotten the number of courses and prompted the user for the number of credit hours for each class then you need to call a function and pass it the following items. This function will calculate and return your total tuition cost.

  • sumCreditHoursTaken          
  • costCreditHour                      
  • maxHoursFullTuition             
  • maintFeeAddOn                                

The formula for calculating the tuition is:

if sumCreditHoursTaken is less than or equal to maxHoursFullTuition then the tuition is

                        sumCreditHoursTaken * costCreditHour

Otherwise if the sumCreditHoursTaken is greater than PmaxHoursFullTuition then the tuition is

(maxHoursFullTuition * costCreditHour) + ((sumCreditHoursTaken - maxHoursFullTuition) * maintFeeAddOn)

You should output the total number of hours the student is taking and the total tuition cost.

Formatting the output: You will need to format the final tuition with a $ and 2 decimal points precision.

This project covers methods you have learned in chapters 2 through 6.

 

Program Output:

 

               This program calculate a student’s total number of

               credit hours and tuition for a given semester.

 

Please enter the number of courses you will be taking this semester: 5

Please enter the number of credit hours for course 1: 3

Please enter the number of credit hours for course 2: 3

Please enter the number of credit hours for course 3: 3.5

Please enter the number of credit hours for course 4: 4

Please enter the number of credit hours for course 5: 2.5

 

Your total number of credit hours is: 16.00

Your total tuition will be $1881.32

 

Press any key to continue . . .

 

#include "stdafx.h"#include <iostream>#include <iomanip>using namespace std;int main(){int numCourses,// Number of CoursessumCreditHoursTaken;// Hold the total number of credit hoursthe student is takingdouble total = 0,//Accumulator for total Credit hourcostCreditHour//Default $147.00 this is the cost ofhours 1 through 12maxHoursFullTuition//Default 12, indicates hours 1through 12 are at full tuitionmaintFeeAddOn//Default $29.33 indicates the cost ofhours 13 and abovetuitionCost//Regular costpremiumTuitionCost//Premium Cost//Functiondouble gettuitionCost (double);double getpremiumTuitionCost (double);// Get the number of courses taken.cout << "This program calculates the cost of tuition.\n";cout << "How many courses are you taking? ";cin >> numCourses;// Determine the total credit hours and accumulate a totalfor (int CreditHoursTaken = 1; CreditHoursTaken <= numCourses;CreditHoursTaken++){int sumCreditHoursTaken;cout << "Enter credit hours for course " << CreditHoursTaken << ":";cin >> sumCreditHoursTaken;total += sumCreditHoursTaken;}// Display the total Credit Hours Takencout << "The total credit hours taken are" << total << endl;return 0;costCreditHour = 147.00maxHoursFullTuition = 12maintFeeAddOn = 29.33}if (sumCreditHoursTaken <= maxHoursFullTuition)gettuitionCost = sumCreditHoursTaken * costCreditHour;else (sumCreditHoursTaken > maxHoursFullTuition)getpremiumTuitionCost = (maxHoursFullTuition * costCreditHour) +((sumCreditHoursTaken - maxHoursFullTuition) * maintFeeAddOn);// Display the Cost.cout << "Your total tuition will be $" << endl;return 0;}

Attachments:

Answers

(11)
Status NEW Posted 11 May 2017 04:05 AM My Price 9.00

-----------

Not Rated(0)