A spacecraft leaves the Earth headed for the Planet-Formerly-Known-As-Pluto, traveling at 5.2 km/sec. How long will it take to reach its destination? Assume that is 4.34 billion km away from the earth. Suppose that it consumes fuel for stability systems and life support. If it starts out with 50 liters of fuel, and consumes it at a rate of 0.078 liters every hour, will it have enough fuel to reach ? What if the spacecraft can travel at half the speed by consuming only one-quarter of the fuel?
Your program should input the distance (in kilometers), the amount of fuel (in liters), and the speed. Output this information, describing it briefly. Use the input command, as the following example shows.
>> distance = input('How far away is Decatur? ');
How far away is Decatur? 8
>> disp(sprintf('Decatur is %d kilometers away.', distance));
Decatur is 8 kilometers away.
Your program should report how long it would take to reach the destination, and if the fuel will run out.
Your program should work for all possible inputs. Make sure that you test it with several different cases. Suppose the distance is so far that it would take millions of years. In this situation, your program should end (after, say, 80 simulated years) with a message informing the user that we have reached the destination, and there are still X kilometers left to go.