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

Разделы > Linear Data Structures: Arrays > задача:


50345 - Orders

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

Задачи раздела

• 51129 - Hexagon
• 51246 - Swap largest word, reverse ...
• 50431 - Sultan's Game
• 50420 - Teachers Sightseeing
• 50977 - Gaussian Elimination
• 50395 - Page "Like" Averages
• 50516 - Lines
• 50446 - Snake
• 50345 - Orders
• 51127 - Maze solver
• 50822 - Linked List
• 51126 - Dr. Fllanxha
• 50529 - Row to Table
• 50499 - Table to Row
• 50823 - Secret Number
• 50853 - Parking Place
• 50990 - Two Neighbors

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

Если у вас есть предложения или пожелания по работе 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