An algorithm for calculating
price of gas in Germany.
In this assignment you will develop an algorithm. Gather information
that you need to solve the problem and write a program.
Problem: In Germany the price of gas is 4.98 Euros per liter.
How does this compare to the price in the United States in dollars per gallon?
Hints, tips, questions (without giving away the algorithm):
- How much do you pay for 1 gallon of gas? How much is that
for 1 liter?
- You might buy a gallon of milk and a liter of soda. If you pay $1.25
for a liter of soda, how much would you expect to pay for a gallon?
More? Less?

- Could you write a program to input the price for a liter and print
the price per gallon?
- If you took $100 US to the bank and asked for Canadian dollars, how
much would you get back?
- If you took 100 Canadian dollars to the bank and asked for $US, how
much would you get back?
- If you took $100 US to the bank and asked for Euros, how much would
you get back?
- If you took 100DM to the bank and asked for $US how much would you
get?
- Could you write a program to convert any currency to dollars? What
information would you need?
- If the Germans pay 4.98Euros for a liter, how much would they pay
for a gallon in US dollars?
- How much is that in $US? (This is the answer you are looking for.)
- Is the price you pay for gas a constant or a variable?
- When you convert gallons to liters, do you use a constant or a variable?
- Are the numbers you use in this problem integers or do they have
decimal places?
- What numbers will I have to get from the user to solve this problem?
Work through the questions above. Make sure you can solve the problem
on paper before you start writing a program.