Hello I have a project, and I just need the next push in this code. I'm not sure how to tell the program that it can't exceed 7 credit hours? Thanks
At Valence community college, a student can’t take more than 3 courses under the constraint of having no more than 7 credit hours. The purpose of this assignment is to construct a fee invoice for a student. This requires the input of Student’s id as integer and the course numbers.
It costs 120.25 dollars per credit hour in addition to $35.00 charged for health and id services.
Here is the list of all courses Valence Community College offers:
CRN Course Prefix Credit Hours
4587 MAT 236 4
4599 COP 220 3
8997 GOL 124 1
9696 COP 100 3
4580 MAC 236 2
4591 CLP 229 5
9997 GGG 124 0
9693 CMP 100 4
After inputting all the necessary data (see sample run), a fee invoice as shown below should be printed to the screen.
VALENCE COMMUNITY COLLEGE
ORLANDO FL 10101
---------------------
Fee Invoice Prepared for Student V5656
1 Credit Hour = $120.25
CRN CR_PREFIX CR_HOURS
4587 MAT 236 4 $ 481.00
4599 COP 220 3 $ 360.75
Health & id fees $ 35.00
--------------------------------------
Total Payments $ 876.75
ASSUME THAT THE USER WILL ALWAYS ENTER DISTINCT VALID COURSE NUMBERS
Sample Run (The user’s entry is in bold)
Enter the Students Id
5656
Enter how many courses-up to 3
6
Invalid number! Try again
Enter how many courses-up to 3
3
Enter the 3 course number(s)
4587 4599 9696
Sorry, you can’t cumulate more than 7 credit hours
Do you want to try again (Y/N)
y
Enter how many courses-up to 3
2
Enter the 2 course number(s)
4587 4599
Thank you!
Press Any Key to Continue
VALENCE COMMUNITY COLLEGE
ORLANDO FL 10101
---------------------
Fee Invoice Prepared for Student V5656
1 Credit Hour = $120.25
CRN CR_PREFIX CR_HOURS
4588 MAT 236 4 $ 481.00
4599 COP 220 3 $ 360.75
Health & id fees $ 35.00
--------------------------------------
Total Payments $ 876.75
Goodbye!
Code:
#include <stdio.h>
int main ()
{
int studentID = 0, courseTotal = 0;
printf("Enter the Student ID: ");
scanf("%d", &studentID);
printf("Enter how many courses - up to 3: ");
scanf("%d", &courseTotal);
while ( courseTotal > 3 || courseTotal < 1)
{
printf ("Invalid number! Try again\n\n");
printf("Enter how many courses - up to 3: ");
scanf("%d", &courseTotal);
}
printf ("\n\nEnter the %d course number(s)\n\n", courseTotal);
system ("pause");