Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Java 1 I need to come up with a program with the following specs. Prompt the user to input the total sales. That number will

Java 1 I need to come up with a program with the following specs.

Prompt the user to input the total sales. That number will be input from the keyboard.

Use if and else statements to determine the appropriate commission rate to be used to calculate the commission on the sales amount entered by the user. Commission is paid at the rate of 2% on any amount of $10,000 or less in sales. Anyone selling over $10,000 is paid at the rate of 5% on the total sales amount.

Declare the necessary variables. Note that in the multiplication of the commission rate the result will potentially have a fractional part. Since the commission rates do not change, initialize them as constants.

Use the if and else statements to determine the appropriate rate for the amount of the total sales, then calculate the commission following the if/else structure.

You only need to calculate the commission in one place, rather than having a calculation for each type of commission. Give this aspect of the problem some thought. There are two basic ways you can do this problem as far as the location of the calculation after you have determined the commission rate. Your objective is to do the commission calculation in one place near the end of the program.

Output the total sales amount and the commission amount and use appropriate labels for each (see below).

Use text labels on the output which make it clear what information is being displayed. Do not simply use single words like Commission or Total. Single words such as those are not descriptive enough.

Use: good variable names (should be evident what they hold), indentations of four spaces, comments within the body of the program, and label the output appropriately.

Test your program with numbers above and below the commission limits for accuracy in its calculations. Do not submit programs in which the calculations are not done correctly. Try numbers above, below, and at the commission break points.

Format the output using the printf() function. Also use a $ where appropriate.

All methods will be in the same class for this problem. The new methods will be just below the main method.

Place one blank line between each method.

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

Essentials of Database Management

Authors: Jeffrey A. Hoffer, Heikki Topi, Ramesh Venkataraman

1st edition

133405680, 9780133547702 , 978-0133405682

More Books

Students also viewed these Databases questions