Example: fruit store

A fruit store during week days sells on the following prices:

Fruit Price
banana
apple
orange
grapefruit
kiwi
pineapple
grapes
2.50
1.20
0.85
1.45
2.70
5.50
3.85

During the weekend days the prices are higher:

Fruit Price
banana
apple
orange
grapefruit
kiwi
pineapple
grapes
2.70
1.25
0.90
1.60
3.00
5.60
4.20

Write a program, which reads from the console a fruit (banana / apple / …), a day of the week (Monday / Tuesday / …) and a quantity (a decimal number) and calculates the price according to the prices from the tables above. The result has to be printed rounded to 2 digits after the decimal sign. Print “error” at an invalid day from the week or an ivalid name of a fruit.

Sample Input and Output

Input Output Input Output
orange
Sunday
3
2.70 kiwi
Monday
2.5
6.75
Input Output Input Output
grapes
Saturday
0.5
2.10 tomato
Monday
0.5
error

results matching ""

    No results matching ""