Лимит времени 2000/4000/4000/4000 мс. Лимит памяти 65000/65000/65000/65000 Кб. Question by Ibrahim Mesecan.
Orders
Write a program that has a class called Order
that a restaurant might use to represent
orders from customers.
Every order item includes three data members
- Ordered object ID: an integer less than 1000,
- Number of items ordered: an integer less than 30
- and a price per item : a floating point number
Your class should have proper constructors that initialize
data members. Provide also an overloaded input stream
operator to get information and a method called
totalAmount() where the total amount returns
(the number of items) * (price per item) .
Question:
Using the given class above, write a program that
reads information for n items ordered and calculates
and shows the total amount from the order.
Input specification
You will be given an integer (n) the number of items ordered.
Then, in each of the following n lines you will be given
three integers: Ordered object ID, number of items ordered
and a price per item where 1 ≤ n ≤ 100.
Output specification
Show the total amount of the orders.
Sample Input
3
1 5 40
2 3 70
7 3 50
|
Sample Output
560
|
Explanation: There are 5 items bought
from 40 leke (200), 3 items bought from 70 leke (210) and
3 items from 50 leke (150). The total is 560 leke.
Для отправки решений необходимо выполнить вход.
|