C programlama ödevime yardım ederseniz çok sevinirim. işin içinden çıkamadım. Şimdiden çok teşekkürler.
Q14. Write a complete C program that calculates the distance according to given speed and amount of gasoline in tankful of a car. Use Do-While construction. a) Car has 50 liters (litre) of a tankful. b) Your program will take “speed” and “amount of gasoline” from user. c) Then, your program will calculate the distance according to following table (Table-1) and display it on command prompt. d) This cycle will continue until the tankful is empty (amount of gasoline is “0 ”). e) Your program must control the amount of gasoline and speed.
For example: If the current amount of gasoline is bigger than previous amount of gasoline or 50 liters in the initial condition, your pogram should display a warning message. Speed values can be between 0-169. If the user enters bigger speed values than 169, he/she should see a warning message on the screen like “Speed values must be between 0-169”.
Example output: Amount of gasoline : 50 liters Current speed : 80 km/h Distance (km) : 819.672 km Amount of gasoline : 40 liters Current speed : 100 km/h Distance (km) : 588.235 km Amount of gasoline : 20 liters Current speed : 150 km/h Distance (km) : 240.963 km
Q14. Write a complete C program that calculates the distance according to given speed and
amount of gasoline in tankful of a car. Use Do-While construction.
a) Car has 50 liters (litre) of a tankful.
b) Your program will take “speed” and “amount of gasoline” from user.
c) Then, your program will calculate the distance according to following table (Table-1) and display
it on command prompt.
d) This cycle will continue until the tankful is empty (amount of gasoline is “0 ”).
e) Your program must control the amount of gasoline and speed.
For example: If the current amount of gasoline is bigger than previous amount of gasoline or 50
liters in the initial condition, your pogram should display a warning message.
Speed values can be between 0-169. If the user enters bigger speed values than 169, he/she
should see a warning message on the screen like “Speed values must be between 0-169”.
speed: 0-50 Lt/100km:9.9 litre
speed: 50-70 Lt/100km:8.7 litre
speed: 70-90 Lt/100km:6.1 litre
speed: 90-120 Lt/100km:6.8 litre
speed: 120-140 Lt/100km:7.4 litre
speed: 140-169 Lt/100km:8.3 litre
Example output:
Amount of gasoline : 50 liters
Current speed : 80 km/h
Distance (km) : 819.672 km
Amount of gasoline : 40 liters
Current speed : 100 km/h
Distance (km) : 588.235 km
Amount of gasoline : 20 liters
Current speed : 150 km/h
Distance (km) : 240.963 km