Question: 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
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 a valid one
Issue appropriate prompts and calculate the tuition for each Student using a SEPARATE FUNCTION for each Student type (1-undergrad, 2-graduate, 3-PhD)
Print out the tuition information in ASCENDING SORTED ORDER by Student.
Submission information:
Submit this assignment by the deadline NO LATER! If you have problems with this contact Jacob (the TA) or myself. DO NOT WAIT TILL THE LAST DAY TO EMAIL. Do not submit on blackboard or by email!
Description:
student type 1 (UNDERGRADUATE) an undergraduate student has the following guidelines: a) they must sign up for at least 3 hours but no more than 18 hours of classes b) their tuition is calculated at $750/hour c) they are eligible for scholarships up to 50% of their tuition amount
student type 2 (GRADUATE) a graduate student has the following guidelines: a) they must sign up for at least 3 hours but no more than 9 hours of classes b) their tuition is calculated at $1,000/hour c) they are eligible for scholarships up to 75% of their tuition
student type 3 (PhD) a PhD student has the following guidelines: a) they must sign up for at least 3 hours but no more than 9 hours of classes b) their tuition is calculated at $1,200/hour c) they are eligible for up to $10,000 stipend (must be a dollar amount) In this portion of the assignment you must make use of C's input capabilities. You must prompt the user to enter a Student ID. Valid IDs and Student type will be stored in your program in a two dimension array and include:
int stuInfo [] []={ {394003920, 2}, double billInfo [][] { {0.0, 0.0, 0.0},
{388920394, 3}, {0.0, 0.0, 0.0},
{499230076, 1}, {0.0, 0.0, 0.0},
{298760112, 2}, {0.0, 0.0, 0.0},
{592493811, 3} {0.0, 0.0, 0.0},
{355982306, 3} }; {0.0, 0.0, 0.0} };
The array billInfo[][] will be initialized with zeros and then will eventually be used to store the tuition information for each Student type. For Student 592493811 it will have the following information:
billInfo[4][0]=665.00
billInfo[4][1]=146.30
billInfo[4][2]=518.70
because Student 592493811 is in row 4 of stuInfo[][] and column 0 is total bill, column 1 is discounts and column 2 is net bill.
checkID() function prototype: int checkID(int idEntered);
This function will received the user entered ID (inputID), will search the global stuInfo [][] array to see if the ID the user entered matches an ID in the array. If it does, then pass the Students row back to the calling line of code. If the id entered does NOT match an ID in the array then pass back a -1 to the calling line of code to indicate it was not found and an error should be issued. A simple switch statement will make this work in the main function:
int rowID = checkID (inputID);
switch ( stuInfo[rowID] [1]) ) {
case 1: processUndergrad(rowID);
break;
case 2: processGraduate(rowID);
break;
case 3: processPhD(rowID);
break;
default: processBadID(inputID); //processBadID is an optional function but must print out error message.
}
processUndergrad(), processGraduate(), processPhD() function prototypes: void process
These functions will receive the ROW for the valid ID entered. It should then prompt the user for the information to calculate that type of Student. For example, if ID 499230076 is entered (type 1 a undergrad) then processUndergrad() will be invoked and it will prompt the user to enter the Undergrad tuition just like homework 1. If ID 592493811 is entered (type 3 a PhD student) then processPhD() will be invoked and it will prompt the user to enter the PhD rate and stipend just like homework 1. processFinalReport() function prototype: void processFinalReport();
This function will be used to produce a report SORTED by the Student ID. If an ID has not been entered DO NOT display the row for it.
Example Output:
$ .a/.out
Enter Student ID: 99939493
ERROR Invalid Student ID
Enter Student ID: 298760112
Enter credit hours: 11
ERROR Graduate Students can take no more than 9 hours
Enter credit hours: 9
Enter Scholarship Amount: $ 0.0
Graduate Student 298760112 Tuition is:
Gross $ 9000.00 Scholarships $ 0.00
Tuition Bill $ 9000.00
Enter Student ID: 388920394
Enter credit hours: 3
Enter Stipend Amount: $ 5000
PhD Student 388920394 Tuition is:
Gross $ 3600.00
Stipend Amt $ 5000.00
Tuition Bill $-1400.00
Enter Student ID: 499230076
Enter credit hours: 17
Enter Scholarship Amount: $ 9000.00
ERROR Scholarship Amount cannot be larger than 50% of Tuition
Enter Scholarship Amount: $ 3559
Undergraduate Student 499230076 Tuition is:
Gross $ 12750.00
Scholarships $ 3559.00
Tuition Bill $ 9191.00
Enter Student ID: -1
When the user enters -1, then function processFinalReport() will be invoked to produce the following report: STUDENT BILLING REPORT (SORTED BY STUDENT ID)
ID TYPE GROSS DISCOUNTS NET
298760112 4 1064.50 234.19 830.31
355982306 4 1482.93 326.24 1156.69
388920394 3 989.67 217.73 771.94
394003920 2 2315.96 509.51 1806.45
499230076 1 3517.00 773.74 2743.26
592493811 3 665.00 146.30 518.70
------------ ------------ -----------
TOTAL 10035.06 2207.71 7827.35
Make sure you format the input and output exactly as above. Use of $ signs, etc. should match this exactly.
Files to Submit:
Tuition.c
SUMMARY
Functions required:
checkID()
processUndergrad()
processGraduate()
processPhD()
processFinalReport()
Additional functions are fine but you must define the ones above exactly as shown.
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
