Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Good morning, not sure where to start on the following Java problem but here it goes: Use arrays & methods. USE METHODS. DO NOT use

Good morning, not sure where to start on the following Java problem but here it goes:

Use arrays & methods. USE METHODS. DO NOT use global variables. All data must be passed to methods using the parameters. A car dealership wants to process sales information for each of his dealers. Ask the user to enter the number of dealers. Dont allow the user to enter a negative number for the number of dealers and also dont allow for a number more than 30 for the number of dealers. For each dealer, store the name of the dealer and the amount of sales in 2 parallel arrays. Dont allow the user to enter a negative number for sales.

Create a continuous loop to keep asking the user for valid values. Calculate commission in dollars and store it in another array based on the following table:

Sales commission
$1 - $5,000 8%
More than $5,000 to $15,000 15%
More than $15,000 20%

Write a method to input and return the number of dealers. Perform the appropriate data validation here.

Write a method to gather the required input data. Perform the appropriate data validation here.

Write a method to calculate the commission array. Write a method to calculate and return total sales for the dealership. Totals sales do not include the commission.

Write a method to calculate and return average sales for the dealership. The average sales value does not include the commission.

Write a method to calculate and return the total commission for the dealership.

Write a method to display the dealer name and amount of sales and the amount of commission for all dealers in a tabular format.

Write a method that accepts the name of a dealer as its parameter and returns the amount of commission for the given dealer. If the given name does not exist, return an error code (i.e. -1) that can be used in the main method to issue an error message. NOTE that the method does not have any print statements in it.

In your main method, make sure to call your methods to perform the operations. MAKE sure to display all the calculated data returned by your methods. For example, the totals and averages must be displayed, so the answers could be checked. Make output descriptive and provide 2 digits after the decimal point for all monetary values.

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Fundamentals Of Database Systems

Authors: Sham Navathe,Ramez Elmasri

5th Edition

B01FGJTE0Q, 978-0805317558

More Books

Students also viewed these Databases questions

Question

5. List the forces that shape a groups decisions

Answered: 1 week ago

Question

4. Identify how culture affects appropriate leadership behavior

Answered: 1 week ago