The following program segments attempt to calculate a fee based on number of passengers according to the schedule given in the table. Determine which segments (if any) correctly compute the value. passengers fee ------------------------------- < 2 $100 2 ± 10 $300 11 ± 20$500 > 20 $1000 ------------------------------- fee = 100.0; if (passengers > 20) fee = 1000.0; if (passengers > 10) fee = 500.0; if (passengers >= 2) fee = 300.0; ------------------------------- fee = 100.0; if (passengers >= 2) fee = fee + 200.0; if (passengers > 10) fee = fee + 400.0; if (passengers > 20) fee = fee + 900.0; ------------------------------- fee = 100.0; if (passengers >= 2) fee = fee + 200.0; else if (passengers > 10) fee = fee + 400.0; else if (passengers > 20) fee = fee + 900; ------------------------------- fee = 100.0; if (passengers >= 2) if (passengers >= 10) if (passengers >= 20) fee = fee + 900.0; else fee = fee + 400.0; else fee = fee + 200.0; ------------------------------- fee = 1000; if (passengers < 20) fee = 500.0; if (passengers < 10) fee = 300.0; if (passengers < 2) fee = 100.0; ------------------------------- fee = 100.0; if (2 <= passengers && passengers <= 10) fee = 300.0; else if (10 < passengers && passengers <= 20) fee = 500.0; else fee = 1000.0; ------------------------------- runner% cat quad0.c /* quad: determine the quadrant of an input pair */ #include int main(void) { double x, y; int q; scanf("%lf %lf", &x, &y); /*-------------------------------*/ /* First Method: Straight if-else-else */ if (x == 0 || y == 0) q = 0; else if (x > 0 && y > 0) q = 1; else if (x > 0 && y < 0) q = 4; else if (x < 0 && y > 0) q = 2; else if (x < 0 && y < 0) q = 3; printf("First Method: "); if (q == 0) printf("On an axis\n"); else printf("Quadrant %i\n", q); /*-------------------------------*/ /* Second Method: Nested if_else */ if (x == 0 || y == 0) q = 0; else if (x > 0) { if (y > 0) q = 1; else if (y < 0) q = 4; } else if (x < 0) { if (y > 0) q = 2; else if (y < 0) q = 3; } printf("Second Method: "); if (q == 0) printf("On an axis\n"); else printf("Quadrant %i\n", q); /*-------------------------------*/ /* Third Method: Shortened version */ if (x == 0 || y == 0) q = 0; else if (x > 0) { if (y > 0) q = 1; else q = 4; } else { if (y > 0) q = 2; else q = 3; } printf("Third Method: "); if (q == 0) printf("On an axis\n"); else printf("Quadrant %i\n", q); return 0; } runner% lint -m -u quad0.c function returns value which is always ignored printf scanf runner% cc -o quad0 quad0.c runner% quad0 1 2 First Method: Quadrant 1 Second Method: Quadrant 1 Third Method: Quadrant 1 runner% quad0 -1 3 First Method: Quadrant 2 Second Method: Quadrant 2 Third Method: Quadrant 2 runner% quad0 3 -2 First Method: Quadrant 4 Second Method: Quadrant 4 Third Method: Quadrant 4 runner% quad0 -1 -4 First Method: Quadrant 3 Second Method: Quadrant 3 Third Method: Quadrant 3 runner% quad0 0 4 First Method: On an axis Second Method: On an axis Third Method: On an axis runner% quad0 -2 0 First Method: On an axis Second Method: On an axis Third Method: On an axis runner% quad0 0 0 First Method: On an axis Second Method: On an axis Third Method: On an axis