Write a program that lets the user enter four quarterly sales figures, Java programming help

timer Asked: May 1st, 2016
account_balance_wallet $35

Question description

A company has six divisions, numbered 1-6. Write a program  that lets the user enter
four quarterly sales figures for these six divisions, in the order division 1 
quarter 1, division 1 quarter 2, division 1 quarter 3, division 1 quarter 4, 
division 2 quarter 1, etc. There should be input validation, allowing the user to 
only input positive numbers for sales figures. If a user inputs a negative number,
the program  should ignore it and prompt them again.

The figures should be stored  in a two-dimensional array  of doubles . Once the 
figures are entered, the program  should display the following data for each quarter:

● A list of the sales figures by division
● Each division’s increase  or decrease  from the previous quarter 
(this will not be displayed for the first quarter)
● The total sales for the quarter
● The company’s increase  or decrease  from the previous quarter 
(this will not be displayed for the first quarter)
● The average sales for all divisions that quarter
● The division with the highest sales for that quarter

Tutor Answer

School: Carnegie Mellon University

First let me help you with the increase and decrease part. To find the increase/decrease for each division, you'll need a for loop that iterates through each division. On each iteration, you'll need another for loop that iterates through the quarters. Have it start at the second quarter, or index of 1. The increase or decrease can be calculated by taking the value at the current index, and subtracting the value at index - 1.
To do increase/decrease for each quarter in each division looks something like thisfor (int divIndex = 0; divIndex < division; divIndex++){for (int qtrIndex = 1; qtrIndex < quarter; qtrIndex++){System.out.println("Division " + (divIndex + 1) + " change in quarter " + (qtrInd...

flag Report DMCA

Outstanding Job!!!!

Similar Questions
Hot Questions
Related Tags

Brown University

1271 Tutors

California Institute of Technology

2131 Tutors

Carnegie Mellon University

982 Tutors

Columbia University

1256 Tutors

Dartmouth University

2113 Tutors

Emory University

2279 Tutors

Harvard University

599 Tutors

Massachusetts Institute of Technology

2319 Tutors

New York University

1645 Tutors

Notre Dam University

1911 Tutors

Oklahoma University

2122 Tutors

Pennsylvania State University

932 Tutors

Princeton University

1211 Tutors

Stanford University

983 Tutors

University of California

1282 Tutors

Oxford University

123 Tutors

Yale University

2325 Tutors