For this program you will be looking at future tuition at your university. In 2020, the tuition for a full time student is $6,540 per semester, the tuition for a part time student is $3,320. The tuition will be going up for the next 7 years at a rate of 3.5% per year. Write a program using if-else and a loop. Ask the user if they are a full time or part time student, then display the projected semester tuition for the next 7 years. You should display the actual year (2021, 2022, through 2027) and the tuition amount per semester for that year.
REMEMBER to write your name through comments in the program, and use comments to explain what your program is doing.
(please don't forget the comments)
#include <iostream>
using namespace std;
int main()
{
char student_type;
int full_tution_fee=6540,part_tution_fee=3320;
cout<<"Enter F for full time student or P for part time
student:-";
cin>>student_type;
if(student_type=='F' ||student_type=='f' )
{
for(int i=2021;i<=2027;i++)
{
cout<<"Fees for first semester for year "<<i<<"
is =$"<<full_tution_fee<<endl;
cout<<"Fees for second semester for year "<<i<<"
is =$"<<full_tution_fee<<endl;
full_tution_fee +=0.035*full_tution_fee;
}
}
else if(student_type=='P' ||student_type=='p' )
{
for(int i=2021;i<=2027;i++)
{
cout<<"Fees for first semester for year "<<i<<"
is =$"<<part_tution_fee<<endl;
cout<<"Fees for second semester for year "<<i<<"
is =$"<<part_tution_fee<<endl;
part_tution_fee +=0.035*part_tution_fee;
}
}
else
cout<<"invalid input";
return 0;
}
//this code handles the price in two variables- full_tution_fee
and part_tution_fee.
//User just need to enter f or p depending on the full time or part
time student.
//The user value is cross checked in "if statement" and procedded
accordingly.
//After checking the condition the loop is executed 7 times
representating each year and the fees
//is updated in every time loop is executed.
Get Answers For Free
Most questions answered within 1 hours.