/*Chapter 7 review question number 4*/ /*Program asks for names, hours worked, hourly rates, computes tax and displays net pay*/ #include main() { int hours; float hrate, trate, grossPay, netPay;/*these provide the variables for future data entries*/ char fname[20], mname[20], lname[20], quit[1];/*these allow for space in future string entries*/ printf("\nThis program computes your pay and taxes\n");/*Tells the user what program does*/ printf("\nPlease enter your first name: ");/*prompts the user to enter a name and then scans it on the next line*/ scanf("%s", fname); printf("\nPlease enter your middle name: "); scanf("%s", mname); printf("\nPlease enter your last name: "); scanf("%s", lname); printf("\nPlease enter the number of hours worked this week: "); scanf("%d", &hours);/*stores the data for use later*/ printf("\nPlease enter your hourly rate: "); scanf("%f", &hrate); printf("\nPlease enter the present tax rate: "); scanf("%f", &trate); grossPay = hours * hrate;/*takes the stored data and calculates it to discover gross pay*/ printf("\nPayroll data for: %s, %s %s", lname, fname, mname); printf("\nThis is your gross pay: %.2f", grossPay); netPay = grossPay - (grossPay / trate);/*takes stored data and newly caclulated data and produces net pay amounts*/ printf("\nThis is your net pay: "); printf("%.2f Dollars per week", netPay); printf("\nType Q to quit: ");/*allows the user to scan the data before exiting the program*/ scanf("%s", quit); return; }