Touch to return to call 04:29 Motion on … CSC 215 Test 1 Dr. Ye Write a C++ prog
ID: 3722580 • Letter: T
Question
Touch to return to call 04:29 Motion on … CSC 215 Test 1 Dr. Ye Write a C++ program to do the following: Ask the user for the following information: Semester and year Course name Whether the course, was a required course or not, Number of credits of the course, Tuition per credit, Cost of the textbook Amount of the financial aid received, Grade received Then compute and display the result as shown in the following sample output (bold face are inpu Enter the semester and year: Fal1 2017 Enter the oourse name:World History Is it a required course? (Enter 1 for yes, 0 for no) o How many credits? 3 How much tuition per credit? S 463.75 How much did you pay for the textbook?$ 125.66 How much financial aid did you receive?s 250 what grade did you get? B Your Fal1 2017 school expense and performance: Course: World History Required? Expense:$ 1266.91 Grade:Explanation / Answer
school.cpp:
#include <iostream>
#include <iomanip>
using namespace std;
int main()
{
string semAndYear;
string courseName;
int isRequired;
int credits;
double tutionFee;
double costOfBooks;
double financialAid;
double expense;
char grade;
cout<<"Enter the Semester and Year : ";
getline(cin,semAndYear);
cout<<"Enter the Curse name : ";
getline(cin,courseName);
cout<<"Is it a required course? (Enter 1 for yes, 0 for no) ";
cin>>isRequired;
cout<<"How many credits? ";
cin>>credits;
cout<<"How much tution fee for credit? $ ";
cin>>tutionFee;
cout<<"How much did you pay for the textbook? $ ";
cin>>costOfBooks;
cout<<"How much financial aid did you receive? $ ";
cin>>financialAid;
cout<<"What grade did you get? ";
cin>>grade;
expense = ((credits * tutionFee) + costOfBooks) - financialAid;
cout<<endl<<"Your "<<semAndYear<<" school expense and performance:"<<endl;
for(int i = 0; i< semAndYear.length()+37; i++){
cout<<"-";
}
cout<<endl<<setw(15)<<"Course:"<<setw(20)<<courseName;
cout<<endl<<setw(15)<<"Required?"<<setw(20)<<isRequired;
cout<<endl<<setw(15)<<"Expense:"<<setw(20)<<expense;
cout<<endl<<setw(15)<<"Grade:"<<setw(20)<<grade;
}
Out put:
Enter the Semester and Year : Fall 2017
Enter the Curse name : World History
Is it a required course? (Enter 1 for yes, 0 for no) 0
How many credits? 3
How much tution fee for credit? $ 463.75
How much did you pay for the textbook? $ 125.66
How much financial aid did you receive? $ 250
What grade did you get? B
Your Fall 2017 school expense and performance:
----------------------------------------------
Course: World History
Required? 0
Expense: 1266.91
Grade: B
...Program finished with exit code 0
Press ENTER to exit console.
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.