Задача: "Orders" от "Methods - Lab"
Условие:
Write a method that calculates the total price of an order and prints it on the console. The method should receive one of the following products: coffee, coke, water, snacks; and a quantity of the product. The prices for a single piece of each product are:
- coffee – 1.50
- water – 1.00
- coke – 1.40
- snacks – 2.00
Print the result formatted to the second decimal place
Example
Input |
Output |
water 5 |
5.00 |
coffee 2 |
3.00 |
Hints
- Read the first two lines
- Create a method the pass the two variables in
- Print the result in the method
https://pastebin.com/tmGNKNc1
Колеги, може ли малко напътствия?
Благодаря ти много!