HomeVolumesContestsSectionsForumsUsersPrintHelpAbout

Contests > CEN112 Homeworks 2013-2015 > problem:


50345 - Orders

CEN112 Homeworks 2013-2015

Start: Dec.15.2013 at 12:00:00 PM
Finish: Dec.15.2013 at 05:00:00 PM
The contest is finished!
• Contest scoreboard

Guest
• Review clarifications (1)

Contest problems

• 50530 - Sum of Ratios
• 50375 - Area of Circles
• 50388 - Number of Armstrong Num...
• 50393 - Palindromic Numbers
• 50339 - The Largest Rectangle
• 50345 - Orders
• 50758 - National Elections - Revisited
• 50754 - Team Standings
• 12-Spr1-40. 50327 - Parallel Lines
• 13-Fall2-20. 50395 - Page "Like" Av...
• 14-Spr1-30. 50492 - Contest Score...
• 14-Spr1-40. 50538 - Sum of kth Dia...
• 14-Spr1-60. 50647 - Spiral
• 14-Spr2-20. 50442 - Polynomial Add...

Feedback

If you notice incorrect translations in Contester, please let author know.

Time limit 2000/4000/4000/4000 ms. Memory limit 65000/65000/65000/65000 Kb.
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