Question 3 Used cars showrooms are places where used cars are displayed and sold. Write a method generateReport() that takes as a parameter a two-dimensional array named prices of size 7 x 5 that contains used car prices in which each row represents a day and each column represents a showroom. The method displays the average used car price for each showroom. In addition, it should display the showroom with the highest average car price. For example, if the main method for this program has prices array values as given below: public static void main(String[] args) { double [] [] prices = { } }; (3.0, 1.0, 1.0,7.0,5.0}, (1.5, 1.0,3.0, 1.0, 4.7}, {2.5,2.2,1.0,1.9,1.7}, (1.0, 1.0, 8.0, 2.2, 4.1}, {4.5,9.0, 8.0, 4.2,2.7}, {1.5, 1.0, 4.0, 4.2,2.3}, {6.5,4.5,9.7,2.9,3.7} generateReport (prices); Your generateReport() method should display the following output: Showroom 0 average used car price is 2.9285714285714284 Showroom 1 average used car price is 2.814285714285714 Showroom 2 average used car price is 4.957142857142857 Showroom 3 average used car price is 3.3428571428571425 Showroom 4 average used car price is 3.457142857142857 Showroom 2 has the highest average of 4.957142857142857 *You must use nested-loops to process the 2-dimensionals array

Database System Concepts
7th Edition
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Chapter1: Introduction
Section: Chapter Questions
Problem 1PE
icon
Related questions
Question
Question 3
Used cars showrooms are places where used cars are displayed and sold. Write a method generateReport0
that takes as a parameter a two-dimensional array named prices of size 7 x 5 that contains used car prices in
which each row represents a day and each column represents a showroom. The method displays the average
used car price for each showroom. In addition, it should display the showroom with the highest average car
price.
For example, if the main method for this program has prices array values as given below:
public static void main(String[] args) {
double [] [] prices = {
(3.0, 1.0, 1.0,7.0,5.0},
{1.5, 1.0,3.0, 1.0, 4.7},
(2.5,2.2, 1.0,1.9,1.7},
(1.0, 1.0, 8.0,2.2, 4.1},
{4.5,9.0, 8.0, 4.2,2.7},
{1.5,1.0, 4.0, 4.2,2.3},
{6.5,4.5,9.7,2.9,3.7}
}
};
generateReport (prices);
Your generateReport() method should display the following output:
Showroom 0 average used car price is 2.9285714285714284
Showroom 1 average used car price is 2.814285714285714
Showroom 2 average used car price is 4.957142857142857
Showroom 3 average used car price is 3.3428571428571425
Showroom 4 average used car price is 3.457142857142857
Showroom 2 has the highest average of 4.957142857142857
*You must use nested-loops to process the 2-dimensionals array
Transcribed Image Text:Question 3 Used cars showrooms are places where used cars are displayed and sold. Write a method generateReport0 that takes as a parameter a two-dimensional array named prices of size 7 x 5 that contains used car prices in which each row represents a day and each column represents a showroom. The method displays the average used car price for each showroom. In addition, it should display the showroom with the highest average car price. For example, if the main method for this program has prices array values as given below: public static void main(String[] args) { double [] [] prices = { (3.0, 1.0, 1.0,7.0,5.0}, {1.5, 1.0,3.0, 1.0, 4.7}, (2.5,2.2, 1.0,1.9,1.7}, (1.0, 1.0, 8.0,2.2, 4.1}, {4.5,9.0, 8.0, 4.2,2.7}, {1.5,1.0, 4.0, 4.2,2.3}, {6.5,4.5,9.7,2.9,3.7} } }; generateReport (prices); Your generateReport() method should display the following output: Showroom 0 average used car price is 2.9285714285714284 Showroom 1 average used car price is 2.814285714285714 Showroom 2 average used car price is 4.957142857142857 Showroom 3 average used car price is 3.3428571428571425 Showroom 4 average used car price is 3.457142857142857 Showroom 2 has the highest average of 4.957142857142857 *You must use nested-loops to process the 2-dimensionals array
Expert Solution
steps

Step by step

Solved in 4 steps with 4 images

Blurred answer
Knowledge Booster
void method
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
Database System Concepts
Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
Starting Out with Python (4th Edition)
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
C How to Program (8th Edition)
C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON
Database Systems: Design, Implementation, & Manag…
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
Programmable Logic Controllers
Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education