ГлавнаяСборникиТурнирыРазделыФорумыУчастникиПечатьПомощьО системе

Сборники > Object Oriented Programming > задача:


50345 - Orders

Гость
• Вопросы к жюри (1)

Задачи сборника

• 50530 - Sum of Ratios
• 50345 - Orders
• 50346 - The Biggest Date
• 50992 - Top K Obese Classes
• 50991 - Intersecting Circles
• 50989 - Rectangles and Points
• 50984 - Top m hardworking employees
• 50269 - Matrix Determinant
• 50986 - The Oldest Person
• 170. 50327 - Parallel Lines

Обратная связь

Если у вас есть предложения или пожелания по работе Contester, посетите форум сайта www.contester.ru.

Лимит времени 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.


Для отправки решений необходимо выполнить вход.

www.contester.ru