✕
Object-Oriented ProgrammingCoding problems
Object-Oriented Programming: coding problems
Write a program that reads the input and prints the answer. Run checks it against every test, including hidden ones.
0 of 7 solved
A farmer has several rectangular plots. Each plot is described by a width and a height. Model a plot as a
Rectangleclass with a private width and height and aconstmethodarea(). Read every plot and print the total area of all of them.Use
long longfor the numbers, because the total can be larger than anintholds.Input. The first line holds `n`, the number of plots. Each of the next `n` lines holds a width and a height.
Output. One integer: the sum of the areas.
Example 1 input
3 2 3 4 5 1 1
Output
27
Example 2 input
2 7 1 3 3
Output
16