#include #include #define DOLLARS_TO_DOUGHNUTS 12 void menu(void); void drawFace(void); void convertTemp(void); void quadrant(void); void doughnuts(void); int main() { int task; do { menu(); scanf("%d", &task); switch (task) { case 0: printf("\n Thank you for running this program, have a nice day!!\n"); break; case 1: drawFace(); break; case 2: convertTemp(); break; case 3: quadrant(); break; case 4: doughnuts(); break; default: printf("\n That is not a valid task number !*!!#*!"); } }while( task !=0 ); return 0; } void doughnuts(void) { int dollars; int doughnuts; printf("Enter number of whole dollars => "); scanf("%d", &dollars); if( dollars >= 20 ) { printf("\n You qualify for the Super Bakers dozen rate,"); printf(" %d doughnuts per dollar", ( DOLLARS_TO_DOUGHNUTS + 3 )); doughnuts = ( DOLLARS_TO_DOUGHNUTS + 3 ) * dollars; } else if ( dollars >= 10 ) { printf("\n You qualify for the Bakers dozen rate, %d doughnuts per dollar", ( DOLLARS_TO_DOUGHNUTS + 1 )); doughnuts = ( DOLLARS_TO_DOUGHNUTS + 1 ) * dollars; } else /* default case */ { printf("\n Your rate is %d doughnuts per dollar", DOLLARS_TO_DOUGHNUTS); doughnuts = dollars * DOLLARS_TO_DOUGHNUTS; } printf("\n%d dollars can buy you %d doughnuts!\n", dollars, doughnuts); } void quadrant(void) { double x; double y; printf("\n Enter x => "); scanf("%lf",&x); printf("\n Enter y => "); scanf("%lf",&y); if ( x == 0.0 ) { if ( y == 0.0 ) printf("\nPoint (%.2f,%.2f) is on origin", x, y); else if (y > 0.0) printf("\nPoint (%.2f,%.2f) is on positive y-axis", x, y); else printf("\nPoint (%.2f,%.2f) is on negative y-axis", x, y); } else if ( x > 0.0 ) { if ( y == 0.0 ) printf("\nPoint (%.2f,%.2f) is on positive x-axis", x, y); else if (y > 0.0) printf("\nPoint (%.2f,%.2f) is in QI", x, y); else printf("\nPoint (%.2f,%.2f) is in QIV", x, y); } else { if ( y == 0.0 ) printf("\nPoint (%.2f,%.2f) is on negative x-axis", x, y); else if (y > 0.0) printf("\nPoint (%.2f,%.2f) is in QII", x, y); else printf("\nPoint (%.2f,%.2f) is in QIII", x, y); } } void convertTemp(void) { double tempF; double tempC; printf("\n Enter Fahrenheit Temperature => "); scanf("%lf",&tempF); tempC = ((tempF-32)/9)*5; printf("\n %.2f degrees Fhrenheit = %.2f degrees Celsius\n", tempF, tempC); } void menu() { printf("\n##############################################################"); printf("\n##############################################################"); printf("\nEnter the number corresponding to the the task you wish done:"); printf("\n##############################################################\n"); printf("\n\t0) Exit program"); printf("\n\t1) Draw face"); printf("\n\t2) Convert temperatures"); printf("\n\t3) Quadrant question"); printf("\n\t4) Calculate doughnuts\n"); printf("\n##############################################################\n\n\t"); } void drawFace() { printf("\n\t xxxxx" ); printf("\n\t x x" ); printf("\n\tx () () x" ); printf("\n\tx x" ); printf("\n\tx \\___/ x"); printf("\n\t x x" ); printf("\n\t xxxxx" ); printf("\n\n Have a good Day!!!\n\n\n"); }