I'm working on a homework assignment for my C programming class, so I'm not looking for straight answers, rather instructions or guidance. My code is pretty elementary, we've only used C for 3 weeks now, so I apologize ahead of time. So far we've only covered conditionals, loops, counters, switch/break/continue for multiple selection, logical operators, and reading characters, so if you mention something other than this, I'll probably be clueless.
7 #include <stdio.h> 8 #include <math.h> 9 10 int main(void) 11 { 12 13 /*Define variables*/ 14 int response, btaxrate, taxrate; 15 float income,taxamount, netincome; 16 17 18 /* Start the dowhile loop for running the program more than once if the user wants to */ 19 do{ 20 21 22 /*Grab the income amount from the user */ 23 printf("Enter the annual income: "); 24 scanf("%f", &income); 25 /* Check to make sure it is above 0 with a while loop */ 26 while(income <= 0) 27 { 28 printf("Invalid income, enter the income again: "); 29 scanf("%f", &income); 30 } 31 32 /* Grab the base taxrate from the user */ 33 printf("Enter the base tax rate: "); 34 scanf("%d", &btaxrate); 35 /* Check to make sure it is <10 or >30 with a while loop */ 36 while(btaxrate < 10 || btaxrate > 30) 37 { 38 printf("Invalid base tax rate, enter the tax rate again: "); 39 scanf("%d", &btaxrate); 40 } 41 42 /* Determine what the taxrate is based on the income amount */ 43 if(income >= 0 && income < 50000) { 45 taxrate=btaxrate; 46 } 47 if(income >= 50000 && income < 100000) 48 { 49 taxrate=btaxrate+10; 50 } 51 if(income >= 100000 && income < 250000) 52 { 53 taxrate=btaxrate+20; 54 } 55 if(income >= 250000 && income < 500000) 56 { 57 taxrate=btaxrate+25; 58 } 59 if (income >= 500000) 60 { 61 taxrate=btaxrate+30; 62 } 63 64 65 /* Equations for taxamount and netincome */ 66 taxamount=(float)(income*taxrate)/(float)100; 67 netincome=(float)income-(float)taxamount; 68 69 70 /* Tell them their tax rate, how much they pay in taxes, and their net income after taxes*/ 71 printf("Your tax rate is: %d%%", taxrate); 72 printf("\nYou pay $%.2f in taxes.", taxamount); 73 printf("\nAfter taxes your net income is: $%.2f", netincome); 74 75 76 /* Ask the user if they want to run the program again, get a value for yes if so */ 77 printf("\nDo you want to continue? (0:Exit 1:Continue:)"); 78 scanf("%d", &response); 79 80 81 } /* End do */ 82 83 /* While part of dowhile to see if the program runs again */ 84 while(response == 1); I'm supposed to display the highest value, lowest value, and average of taxamount that was determined depending on how many times the user re-ran the program, then print it. So, for example, if they ran it 5 times (by pressing 1 to continue) and the values of taxamount were 15000, 8000, 20000, 35000, and 100000, how would I print "100000 is the highest, 8000 is the lowest, and the average is 35600"?
haha,LOLpart?