INSTRUCTIONS: Read thoroughly first. You are graded on how well you follow the instructions and the accuracy of the final output. Plan out on paper before you start coding. Jot down all variables at the class and method level that have to be declared. Use separate sheets of paper representing each method. Jot down what needs to go in each method according to the instructions. Please refer to the Java Style Guide for alignment, format, and spacing rules (see navigation bar on left). Name the program YourLastNameFirstInitialCapstones0203Salary.java. When you call these methods make sure you send the correct arguments and properly process the value that is returned. Returning from the keyboard means you return what is typed through the keyboard rather than what is stored in a variable. There are no local variables in the methods other than in the main(). Refer to the sample output for details about and verbiage for the prompts and final output.
- The Scanner input, firstName and lastName variables are the only fields (class variables). The other variables are local to main(). There are 7 variables local to main(). Declare all local variables at the beginning of main().
- The variable report stores the final output. This variable is declared with the header "RAISES IN 9999 AT HOBBIT, INC." where the 9999 represents the year. Use String.format() to initialize report with the header.
- setEmployee(): This method prompts for the employee's firstName, lastName, status, and returns the employment status from the keyboard. The names are captured into separate variables through one prompt. Use nextLine() for the first name, and nextLine() for the last name.
- setCurrentSalary(): This method prompts for the employee's current annual salary (currentSalary) and returns it from the keyboard.
- setRaise(): This method prompts for the employee's annual raise (raise) as a percent and returns it from the keyboard.
- calcNewSalary(): This method receives currentSalary and raise, and returns the calculated value for the employee's newSalary by adding 1 to the raise divided by 100 and multiplying by the currentSalary.
- updateReport(): This method receives the employee's status, the report, currentSalary, raise, and newSalary, and adds this information to the parameter variable report, and returns report. Use a switch statement to determine the employee's status which figures out what is to be added to report. Terminated employees only have their names and "TERMINATED" representing their status in the report whereas active employees have their names, currentSalary, raise, and newSalary in the report. Below is the Java code for the switch statement. The code illustrates concatenation (+=) which adds a String to another String to essentially create a report as the program executes.
- case 1: report += String.format("%nEmployee: %s %s"
- + "%nCurrent Salary: $%,.2f"
- + "%nRaise: %.2f%%"
- + "%nNew Salary: $%,.2f%n", firstName, lastName,
- currentSalary, raise, newSalary);
- default: report += String.format("%nEmployee: %s %s"
- + "%nStatus: TERMINATED%n", firstName, lastName);
- }//END switch on status
- printReport(): This method receives report and prints it. The year in the report header must come from the computer. It cannot be hardcoded.
- main(): The main() will call the above methods in the order listed for as many salaries as needed; therefore, you'll need a sentinel do-while repetition structure controlled by the variable another. Use a switch statement to only call setCurrentSalary(), setRaise() and calcNewSalary() when the employee status is 1; otherwise, zero out the currentSalary, raise and newSalary variables. These method calls will require you to either send arguments and/or receive values. The arguments sent must be of the same type as the parameter variables and the values returned must be assigned to variables of the same type in the main(). Don't forget to exit the main().
- First Javadoc Comment Box:
* @author Student Name
* @version 1.00 Date and Time
* PROGRAM PURPOSE: Student inserts.
10. Javadoc Comment Boxes for the Methods: Describe what is going with the code in each method.
11. Line comment all import statements, each field and local variable, and the close braces.
12. Zip your student folder and upload to Bb. Any program files not in a student folder receives a 0. No redos.
Put your .java, .java~, and .class files in a student folder labeled as: YourLastNameFirstInitialCapstone0203.
13. Refer to the sample output attached above for the sample data to test your program. You output has to resemble the sample in formatting (line advancing, and spacing
Recently Asked Questions
- can i have a practical application example for pull based supply chains. And a example of a pull based supply chain
- A 65 year old man presents for her annual physical examination and notes increasing fatigue and heart palpitations over the past 2 months. Her history is
- How is the disk and washer methods for calculating volumes are taken from the method of slicing? Please provide an example.