Pascal programming

An auto repair shop charges as follows. Inspecting the vehicle costs $75. If no work needs to be done, there is no further charge. Otherwise, the charge is $75 per hour of labour plus the cost of parts, with a minimum charge of $120. If any work is done there is no charge for inspecting the vehicle.

Write a program to read values for hours worked and cost of parts (either of which could be 0) and print charge for the job.

Respuesta :

Answer:

Program Lesson1_Program3;

Var        

   InspectionCost, hoursworked, costperhour, costofparts, Totalcost, Totalworkingcostintotalhours : Integer;

Begin {no semicolon}

   InspectionCost:=75; costofparts:=0; costperhour:=0;

Write('Input Number of hours worked:');  

Readln(hoursworked);

Totalworkingcostintotalhours:= costperhour * hoursworked;

Writeln('Input cost of parts:');

Readln(costofparts);

Totalcost:=InspectionCost + Totalworkingcostintotalhours + costofparts;

if Totalcost < 120 then

    Totalcost:=75

   else

    Totalcost:=InspectionCost + Totalworkingcostintotalhours + costofparts;

Writeln('Totalcost=',Totalcost);

Readln;

End.

Explanation:

Please check the answer section.

ACCESS MORE