pico
text editor create a file called trip.pas
containing the following PASCAL program.
Do not worry about minor typing errors. Leave a
minor error in your file so that you can see an error message
when compiling the program in
Lab 4.6: "Pascal program -- compile and run".
Use the file name trip.pas for this program.
The program is also avaliable at:
ftp://phRed.dcccd.edu/pub/ltaber/csc135/trip.pas.
Print a copy of the file on the system printer. Use the command:program trip(input,output); var distance,speed,time,galcost, mpg,galused,totalcost:real; begin writeln('* Compute trip time and cost. *'); writeln; write('Trip distance? '); read(distance); write('Average speed? '); read(speed); write('Miles per gallon? '); read(mpg); write('Cost per gallon? '); read(galcost); writeln; writeln('Distance = ',distance:8:2,' miles'); writeln('Average speed = ',speed:8:2,' miles'); time:=distance/speed; writeln('Time of trip = ',time:8:2,' hours'); writeln; writeln('Mileage rate = ',mpg:8:2,' miles/gal'); writeln('Dollars per gallon = ',galcost:8:2,' dollars'); galused:=distance/mpg; totalcost:=galused*galcost; writeln('Estimated trip cost = ',totalcost:8:2, ' dollars'); end.
Label it withlpr trip.pas
Place the lab in the instructor hand-in box in BUS R6E, the "terminal room".Your-Name Lab 4.5: Pascal Source TABER CSC135