Write a working algorithm in pseudo code to decide which commute is cheaper:
You want to decide whether you should drive your car to work or take the train. You know the one-way distance from your home to your place of work, and the fuel efficiency of your car(in miles per gallon). You also know the one-way price of a train ticket. You assume the cost of gas at $4 per gallon, and car maintenance at 5 cents per mile.
There are 4 basic steps to good algorithm design.
Step1: Determine the inputs and outputs
Step2: Break down the problem into smaller tasks
Step3: Describe each subtask in pseudo code
Step4: test your pseudo cose by working a problem