1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70
|
# include <stdio.h>
# include <stdlib.h>
int main()
{
//You dont use those variables n,password[20],username[8] so delete them
int none=0,ntwo=0,nthree=0;//You should initialize none, ntwo and nthree because you used them to calculate total
double Total;//total must be double
float Algebra,Trigonometry,Calculus,Engiana,Physics;
Algebra = 100;
Trigonometry = 300;
Calculus = 500;
Engiana = 750;
Physics = 1500;
printf("Welcome to the Enrollment System \n");
printf("Here is the list of Available Subjects \n");
printf("\n");
printf("Course Code Price\n");
printf("\n");
printf("1. Algebra %.2f \n",Algebra);
printf("2. Trigonometry %.2f \n",Trigonometry);
printf("3. Calculus %.2f \n",Calculus);
printf("4. Engiana %.2f \n",Engiana);
printf("5. Physics %.2f \n",Physics);
printf("You can only select three courses to enroll for the Term \n");
printf("\n Select First Course to Enroll \n");
scanf("%d", &none);
switch(none)
{
case 1: printf(" You Enrolled Algebra %.2f \n",Algebra); break; //if conditions met , immediately goes to system pause
case 2: printf(" You Enrolled Trigonometry %.2f \n", Trigonometry); break; //if conditions not met goes to another case
case 3: printf(" You Enrolled Calculus %.2f \n", Calculus); break;
case 4: printf(" You Enrolled Engiana %.2f \n", Engiana); break;
case 5: printf(" You Enrolled Physics %.2f \n", Physics); break;
default: printf(" The Course you entered is not valid \n"); break;
}
printf("\n Select Second Course to Enroll \n");
scanf("%d", &ntwo);
switch(ntwo)
{
case 1: printf(" You Enrolled Algebra %.2f \n",Algebra); break; //if conditions met , immediately goes to system pause
case 2: printf(" You Enrolled Trigonometry %.2f\n", Trigonometry); break; //if conditions not met goes to another case
case 3: printf(" You Enrolled Calculus %.2f\n", Calculus); break;
case 4: printf(" You Enrolled Engiana %.2f\n", Engiana); break;
case 5: printf(" You Enrolled Physics %.2f \n", Physics); break;
default: printf(" The Course you entered is not valid \n"); break;
}
printf("\n Select Third Course to Enroll \n");
scanf("%d", &nthree);
switch(nthree)
{
case 1: printf(" You Enrolled Algebra %.2f \n",Algebra); break; //if conditions met , immediately goes to system pause
case 2: printf(" You Enrolled Trigonometry %.2f \n", Trigonometry); break; //if conditions not met goes to another case
case 3: printf(" You Enrolled Calculus %.2f \n", Calculus); break;
case 4: printf(" You Enrolled Engiana %.2f \n", Engiana); break;
case 5: printf(" You Enrolled Physics %.2f \n", Physics); break;
default: printf(" The Course you entered is not valid \n"); break;
}
Total = (none+ntwo+nthree);
printf("Total Tuition Price = %.2f \n",Total);
system("PAUSE");
return 0;
}
|