Question

In: Computer Science

Write a program to calculate fees that must be paid by a student at a State...

Write a program to calculate fees that must be paid by a student at a State university using the following

values:

Each semester unit

$90.00

Regular room charge per semester

$200.00

Air conditioned room

$250.00

Food charge for the semester

$400.00

Matriculation fee (all students)

$30.00

Diploma fee (if graduating student)

$35.00

Input student ID number (one integer containing four digits), the type of room (regular or air conditioned), units, and whether or not the student is graduating. Output an itemized list of student

fees and a total of the student fee owed. Check for students taking more than 21 units and students

taking fewer than 12 units. Output a message to students enrolled in more than 21 units (this is not

allowed, do not process this data) or fewer than 12 units (warn them that they are not full time students

but do process this data).

Input

Three initials of the individual, student identification number, type of room (R, A), number of units, and

whether or not student is graduating (Y/N).

Sample

Output

Student ID

12345

Units

15

Charge for units

1350.00

Room charge

200.00

Food charge

400.00

Matriculation Fee

30.00

Total semester charges

1980.00

Adequately check all entered data for validity. Use adequate test data to process all valid data and use

representative data to show how your program handles invalid data. .

Label all output clearly.

Be sure your output contains user prompts and what was entered by the user in addition to the results

of your program processing.

BE SURE TO INCLUDE ADEQUATE ERROR CHECKING IN YOUR PROGRAM A

ND ERROR DATA WHEN YOU

RUN THE

PROGRAM TO DEMONSTRATE ERROR CHECKING.

Solutions

Expert Solution

Answer: Hello! Dear student, you didn't mention any particular language to design this program that's why i used here c++. This program is error-free and working well, giving the desired output as you have shown in the sample. If you have any queries, feel free to ask me. Thanks.

#include<iostream> //include header files
#include<stdlib.h>
#include <iomanip>
#include <string>
using namespace std;

int main()
{
   int id,count=0,unit; //int type variables
   float unit_charge=90.00,regularRoom_charge=200.00,AcRoom_charge=250.00,Food_charge=400.00,Matriculation_fee=30.00,Diploma_fee=35.00,total=0, //float type variables declaration with initialization
room_charge=0,graduate_fee;
string room; //string type variable
char graduate; //char type variable
   cout<<"Enter student ID: "<<endl; //prompts for student id
   cin>>id;
   while(id!=0) //validation check for student id
   {
       id = id/10;
       ++count;
   }
   if(count<4) //if invalid
   {
       cout<<endl<<"Invalid ID! ID should be has four digits";
       exit(0);
   }
  
   cout<<endl<<"Enter the type of room AC/Regular: "<<endl; //prompts for romm type
cin>>room;
  
   if(room=="AC") //to check choice
   {   room_charge = AcRoom_charge;
       total = room_charge;
   }
   else
   {   room_charge = regularRoom_charge;
       total =room_charge;
   }
   cout<<endl<<"Enter the units of semester"<<endl; //prompts for units
   cin>>unit;
   if(unit>21) //validation check for unit
   {
       cout<<endl<<"Students enrolled more than 21 units. This is not allowed";
   exit(0);
   }
   else
       if(unit<12)
       {
           cout<<endl<<"Warning!!You are not full time students"; //warninh message
       }
           unit_charge = unit*unit_charge; //calculate unit charge
           total = total+unit_charge;
      
   cout<<endl<<"Are you graduate?(Y/N)"<<endl; //prompt for graduate
   cin>>graduate;
  
//print charges with items list , at last total charges
   cout<<endl<<"Charges for units:";  
   cout<<endl<<"$"<<fixed<<setprecision(2)<<unit_charge;
   cout<<endl<<"Room charge:";
   cout<<endl<<room_charge;
   cout<<endl<<"Food charge:";
   cout<<endl<<"$"<<Food_charge;
   cout<<endl<<"Metriculation Fee:";
   cout<<endl<<"$"<<Matriculation_fee;
   if(graduate=='Y')
   {   graduate_fee = Diploma_fee;
       total = total+graduate_fee;
       cout<<endl<<"Diploma Fee: ";
       cout<<endl<<"$"<<graduate_fee;
   }
   total = total+Matriculation_fee+Food_charge;
   cout<<endl<<"Total Semester charges :";
   cout<<endl<<"$"<<total;
   return 0;
}

  
  

Enter student ID: 1234 Enter the type of room AC/Regular: AC Enter the units of semester 15 Are you graduate? (Y/N) Y Charges for units: $1350.00 Room charge: 250.00 Food charge: $400.00 Metriculation Fee: $30.00 Diploma Fee: $35.00 Total Semester charges : $2065.00 US


Related Solutions

For this assignment, write a program that will calculate the quiz average for a student in...
For this assignment, write a program that will calculate the quiz average for a student in the CSCI 240 course. The student's quiz information will be needed for later processing, so it will be stored in an array. For the assignment, declare one array that will hold a maximum of 12 integer elements (ie. the quiz scores). It is recommended that this program be written in two versions. The first version of the program will read a set of quiz...
For this assignment, write a program that will calculate the quiz average for a student in...
For this assignment, write a program that will calculate the quiz average for a student in the CSCI 240 course. The student's quiz information will be needed for later processing, so it will be stored in an array. For the assignment, declare one array that will hold a maximum of 12 integer elements (ie. the quiz scores). It is recommended that this program be written in two versions. The first version of the program will read a set of quiz...
Overview For this assignment, write a program that will calculate the quiz average for a student...
Overview For this assignment, write a program that will calculate the quiz average for a student in the CSCI 240 course. The student's quiz information will be needed for later processing, so it will be stored in an array. For the assignment, declare one array that will hold a maximum of 12 integer elements (ie. the quiz scores). It is recommended that this program be written in two versions. The first version of the program will read a set of...
Overview For this assignment, write a program that will calculate the quiz average for a student...
Overview For this assignment, write a program that will calculate the quiz average for a student in the CSCI course. The student's quiz information will be needed for later processing, so it will be stored in an array. For the assignment, declare one array that will hold a maximum of 12 integer elements (ie. the quiz scores). It is recommended that this program be written in two versions. The first version of the program will read a set of quiz...
Write a program that will calculate numerical and letter grades for a student and output a...
Write a program that will calculate numerical and letter grades for a student and output a report: The information will be in the provided data file studentGrades.txt. The data file consists of several rows of data containing a student name and information for 3 types of assignments: First Name, Last Name, number of homework grades, values for homework grades, percentage of total grade, number of program grades, values for program grades, percental of total grade, number of ex-am grades, values...
Write a program that will calculate numerical and letter grades for a student and output a...
Write a program that will calculate numerical and letter grades for a student and output a report: The information will be in the provided data file studentGrades.txt. The data file consists of several rows of data containing a student name and information for 3 types of assignments: First Name, Last Name, number of homework grades, values for homework grades, percentage of total grade, number of program grades, values for program grades, percental of total grade, number of ex-am grades, values...
Overview For this assignment, write a program that will calculate the quiz average for a student...
Overview For this assignment, write a program that will calculate the quiz average for a student in the CSCI 240 course. The student's quiz information will be needed for later processing, so it will be stored in an array. For the assignment, declare one array that will hold a maximum of 12 integer elements (ie. the quiz scores). It is recommended that this program be written in two versions. The first version of the program will read a set of...
Overview For this assignment, write a program that will calculate the quiz average for a student...
Overview For this assignment, write a program that will calculate the quiz average for a student in the CSCI 240 course. The student's quiz information will be needed for later processing, so it will be stored in an array. For the assignment, declare one array that will hold a maximum of 12 integer elements (ie. the quiz scores). It is recommended that this program be written in two versions. The first version of the program will read a set of...
OverviewFor this assignment, write a program that will calculate the quiz average for a student in...
OverviewFor this assignment, write a program that will calculate the quiz average for a student in the CSCI 240 course. The student's quiz information will be needed for later processing, so it will be stored in an array.For the assignment, declare one array that will hold a maximum of 12 integer elements (ie. the quiz scores).It is recommended that this program be written in two versions. The first version of the program will read a set of quiz scores from...
1. ​ a)​Write a Matlab program to define student grade program and student number with if-else...
1. ​ a)​Write a Matlab program to define student grade program and student number with if-else statement logic​​​​​​​​​ b)​Write a Matlab program for sensor selection of temperature, pressure, flow sensor with if-else statement logic​​​​​​​​​ ​ 2.​Assume there are four letters from an information source with probabilities as A1 0.5 A2 0.3 A3 0.1 A4 0.1 Generate the tag and find the corresponding gaps and binary values for each stage and the sequence of the symbols which are coded are a1a3a2a4a1.​​​...
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT