$20
Control flow if-else if switch statement
Use the following Guidelines: Give identifiers semantic meaning and make them easy to read (examples numStudents, grossPay, etc). Keep identifiers to a reasonably short length. User upper case for constants. Use title case (first letter is upper case) for classes. Use lower case with uppercase word separators for all other identifiers (variables, methods, objects). Use tabs or spaces to indent code within blocks (code surrounded by braces). This includes classes, methods, and code associated with ifs, switches and loops. Be consistent with the number of spaces or tabs that you use to indent. Use white space to make your program more readable.
Important Note: All submitted assignments must begin with the descriptive comment block. To avoid losing trivial points, make sure this comment header is included in every assignment you submit, and that it is updated accordingly from assignment to assignment.
Your programming assignments require individual work and effort to be of any benefit. Every student must work independently on his or her assignments. This means that every student must ensure that neither a soft copy nor a hard copy of their work gets into the hands of another student. Sharing your assignments with others in any way is NOT permitted. Violations of the University Academic Integrity policy will not be ignored. The university academic integrity policy is found at http://www.asu.edu/studentlife/judicial/integrity.html
//*********************************************************** // Name: Your name // Title: Assignment3.java // Description: Description of the program // Time spent: // Date: 9/11/2016 //**************************************************************
Reasonably good amount of comments should be added in your program so that it is easy for other people to understand it. Please see the comment style in the textbook.
Part 1: Written Exercises (None)
Part 2: Programming (20 points)
Algorithms and Output Specification
Implementation Details for an Employee’s Raise and Tax calculation
This program should be implemented using only one class named Assignment3. The program must contain a main method only.
The program should give two options to the user: 1. Calculating the raise for an employee, which will be based on employee’s performance 2. Calculating the tax for an employee
Main Menu Display
As the program starts, a menu is to be displayed which gives two options to the user: Choose from an option below (1 or 2): 1. Calculate raise for an employee 2. Calculate tax for an employee Your choice:
The user will enter a number, either 1 or 2.
After the user enters a valid action your program will use a switch statement to go to the appropriate case. 1. Calculate Raise for an employee
The first option is to calculate raise for an employee.
a. Ask the user and read an employee’s annual salary Enter current annual salary of employee:
b. Ask the user and read an employee’s performance rating Enter the performance rating (Excellent, Good, or Poor):
c. Calculate employee’s raise based on performance rating For excellent performance, employees get a 6% raise on their current salary For good performance, employees get a 4% raise on their current salary For poor performance, employees get a 1.5% raise on their current salary
d. Calculate new salary of employee by adding the raise to their current salary e. Display the amount of raise and new salary for employee (Format the amounts to display as currency). Hint: Use getCurrencyInstance() from NumberFormat class
2. Calculate Tax for an employee
The second option is to calculate tax for an employee.
a. Ask the user and read an employee’s annual salary Enter current annual salary of employee:
b. Calculate employee’s tax based on the following tax bracket For salary in the range (100000, 150000] Tax is computed as: tax = (currentSalary - 100000) * 0.1 For salary in the range (150000, 250000], Tax is computed as: tax = 5000.0 + (currentSalary - 150000) * 0.2 For salary 250000, Tax is computed as: tax = 25000.0 + (currentSalary - 250000) * 0.3
c. Display the amount of tax for employee (Format the amounts to display as currency).
Example Execution Run
Sample Run #1: User input is in bold
Choose from an option below (1 or 2): 1. Calculate raise for an employee 2. Calculate tax for an employee Your choice: 1
Enter current annual salary of employee: 76000 Enter the performance rating (Excellent, Good, or Poor): Good Amount of raise: $3,040.00 New annual salary: $79,040.00
Sample Run #2: User input is in bold
Choose from an option below (1 or 2): 1. Calculate raise for an employee 2. Calculate tax for an employee Your choice: 2
Enter current annual salary of employee: 150000 Tax amount: $5,000.00
Submit your homework by following the instructions below:
*********************************************************************************
Go to the course web site (my.asu.edu), and then click on the on-line Submission tab. Login to the page by typing your email and password
Submit your Assignment3.java file on-line. Make sure to choose Hw3 from drop-down box.
Assignment3.java should have the following, in order: o In comments, the assignment Header described in "Important Note" o The working Java code o
The Assignment3.java file must compile and run as you submit it. You can confirm this by viewing your submission results.
Important Note: You may resubmit as many times as you like until the deadline, but we will only mark your last submission.