Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

5.4 Write the function header for each of the following functions. a) Function h

ID: 3684093 • Letter: 5

Question

5.4 Write the function header for each of the following functions.

a) Function hypotenuse that takes two double- precision floating- point arguments, side1 and side2, and returns a double- precision floating- point result.

b) Function smallest that takes three integers, x, y, z, and returns an integer.

c) Function instructions that does not receive any arguments and does not return a value. [ Note: Such functions are commonly used to display instructions to a user.]

d) Function intToFloat that takes an integer argument, number, and returns a floating-point result.

5.9 ( Parking Charges) A parking garage charges a $ 2.00 minimum fee to park for up to three hours and an additional $ 0.50 per hour for each hour or part thereof over three hours. The maximum charge for any given 24- hour period is $ 10.00. Assume that no car parks for longer than 24 hours at a time. Write a program that will calculate and print the parking charges for each of three customers who parked their cars in this garage yesterday. You should enter the hours parked for each customer. Your program should print the results in a tabular format, and should calculate and print the total of yesterday's receipts. The program should use the function calculateCharges to determine the charge for each customer. (calculateCharges will be made by you.)

Please keep the hours data in an array.

In this program -- you will have loops, arrays and functions.

car hours charge 1 1.5 2.00 2 4 2.50 3 24 10.00 TOTAL 29.5 14.50

Explanation / Answer

function heaer

   double hypotenuse(double side1, double side2);
   int smalleast(int x, int y, int z);
   void instructions(void);
   float intToFloat(int number)
  
5.9 parking charges

   #include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include <time.h>
float all = 0;
int main()

{

float cus1, cus2, cus3,charge;
cus1 = cus2 = cus3 = charge = 0;
printf("Please input the first customer's hours:");
scanf("%f", &cus1);
printf("Please input the second customer's hours:");
scanf("%f", &cus2);
printf("Please input the third customer's hours:");
scanf("%f", &cus3);

void calculateCharges(float cus);
printf("%s%10s%10s ", "Car", "Hours", "Charge");
calculateCharges(cus1);
calculateCharges(cus2);
calculateCharges(cus3);
printf("%s%10.1f%10.1f ", "TOTAL", cus1 + cus2 + cus3, all);

    return 0;
}

void calculateCharges(float cus){
   float result;
   static int car=1;
   if (cus <= 3){
       result = 2;
   }
   else if (cus > 3&&cus<24){
       result = 2 + 0.5 * ceil(cus-3);
   }
   else if (cus >= 24){
       result = 10;
   }
   printf("%-d%10.1f%10.1f ", car, cus, result);
   car++;
   all += result;
  
}

output

Please input the first customer's hours:50                                                                                                                  
Please input the second customer's hours:15                                                                                                                 
Please input the third customer's hours:45                                                                                                                  
Car     Hours    Charge                                                                                                                                     
1      50.0      10.0                                                                                                                                       
2      15.0       8.0                                                                                                                                       
3      45.0      10.0                                                                                                                                       
TOTAL     110.0      28.0                                                                                                                                   

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote