CS 1050 Homework Assignment 2 – SUMMER 2017

Question # 00556640 Posted By: Prof.Longines Updated on: 07/04/2017 07:51 AM Due on: 07/04/2017
Subject Computer Science Topic Algorithms Tutorials:
Question
Dot Image

CS 1050 Homework Assignment 2 – SUMMER 2017

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 ID’s 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 theglobal stuInfo [][] array to see if the ID the user entered matches an ID in the array. If it does, then pass the Student’s 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<type>(int rowNumber);

<type> is either Undergrad, Graduate, or PhD. All should have the same parameters and return type.

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.

Guidelines for Grading Homework 2

40 Points Possible

General

If your program does not compile or produce any input/output (I/O) because most of the source code is commented out then your homework will receive a grade of zero. Turning in the assignment late is also a grade of zero.

1 pointfor having the filename and class named appropriately according to the assignment handout, for a header at the top with name, date, etc and also internal comments and for general style. Is the program formatted well? Proper indentation, etc.

Tuition2.c

5 pointsfor properly prompting the user to enter the values (switch statement) and looping until a “-1” is entered

5 points check() functionfor properly searching for a valid Student ID and returning the results back to the switch

5 points processUndergrad() functionfor correctly calculating the tuition results for the Undergrad Student.

5 points processGraduate() functionfor correctly calculating the tuition results for the Graduate Student.

5 points processPhD() functionfor correctly calculating the tuition results for the PhD Student.

5 pointsfor properly outputting error messages for bad Student IDs.

5 points for properly calculating the total bill numbers.

5 points processFinalReport() sorting the arrays properly (by ID)

BONUS (5 POINTS)

If you turn the assignment in by Wednesday, July 5th BEFORE 5PM you will get 5 extra points.

Dot Image
Tutorials for this Question
  1. Tutorial # 00554100 Posted By: Prof.Longines Posted on: 07/04/2017 07:52 AM
    Puchased By: 2
    Tutorial Preview
    The solution of CS 1050 Homework Assignment 2 – SUMMER 2017...
    Attachments
    soln.zip (652.26 KB)

Great! We have found the solution of this question!

Whatsapp Lisa