Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Will someone help me code this in Java? Thanks Name your Java source code file BonusCalculatorAppXXX.java, where XXX is your initials. Remember that your class

Will someone help me code this in Java? Thanks

Name your Java source code file BonusCalculatorAppXXX.java, where XXX is your initials. Remember that your class name will need to match your file name!

Your program will accept four input values from the user: an employee name (String), the employees base pay (double), the number of items sold (int), and the value of the items sold (double). Using those values, your program will determine if the employee earns a bonus and will display the amount the employee will be paid.

Your input dialog boxes should look like:

Enter emolyee name: Smelly vonBrownshirt

Enter base pay for Smelly vonBrownshirt: 1000

Enter number of items sold: 3

Enter value of items sold: 2500

Your output should look like:

Smelly vonBrownshirt will be paid $1300.0 for selling 3 items at a value of $2500.0

Pres any key to continue

In this project, you use:

These elements from Chapter 2

Declaration statements for variables and constants

Arithmetic expressions

The Double.parseDouble( ) method to convert String input received through the dialog boxes to double values

The Integer.parseInt( ) method to convert String input received through dialog boxes to integer values (not in Chapter 2, but just like converting to a double)

These elements from Chapter 4:Relational operators

Dual path if statement, also known as if-else

Nested if or combined decisions

Include comments in your Java source code to explain what the code is doing, and use a block comment at the top of your application to include your name, filename, date, and a purpose.

In designing the program logic, we have developed:

pseudocode you need in your main( ) method body choose to use either nested if statements or combined decisions and

test cases to run to ensure that your program is working correctly. USE THEM!

Either use the pseudocode using nested if statements:

start

Declarations

string name

num basePay

num totalPay

num itemSold

num valueSold

const ITEMS_MIN = 5

const VALUE_MIN = 2000

const BONUS = 300.00

input name, basePay, itemsSold, valueSold

if itemsSold > ITEMS_MIN

totalPay = basePay + BONUS

else

if valueSold >= VALUE_MIN

totalPay = basePay + BONUS

else

totalPay = basePay

output name, will be paid $, totalPay, for selling , itemsSold, items at a value of $, valueSold

stop

or use the pseudocode using combined decisions (OR logic):

start

Declarations

string name

num basePay

num totalPay

num itemSold

num valueSold

const ITEMS_MIN = 5

const VALUE_MIN = 2000

const BONUS = 300.00

input name, basePay, itemsSold, valueSold

if itemsSold > ITEMS_MIN OR valueSold >= VALUE_MIN

totalPay = basePay + BONUS

else

totalPay = basePay

output name, will be paid $, totalPay, for selling , itemsSold, items at a value of $, valueSold

stop

Suggested test cases to use when checking your program:

basePay = 1000, items sold = 3, valueSold = 2500 totalPay = 1300

basePay = 1000, items sold = 3, valueSold = 1500 totalPay = 1000

basePay = 1000, items sold = 5, valueSold = 2000 totalPay = 1300

basePay = 1000, items sold = 10, valueSold = 3500 totalPay = 1300

basePay = 1000, items sold = 5, valueSold = 1500 totalPay = 1000

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

Concepts Of Database Management

Authors: Philip J. Pratt, Joseph J. Adamski

4th Edition

0619064625, 978-0619064624

More Books

Students also viewed these Databases questions