View the step-by-step solution to:

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...

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. 

  1. 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(). 
  2. 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.   
  3. 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. 
  4. setCurrentSalary(): This method prompts for the employee's current annual salary (currentSalary) and returns it from the keyboard.
  5. setRaise(): This method prompts for the employee's annual raise (raise) as a percent and returns it from the keyboard.
  6. 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
  7. 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. 
  8. switch(status)
  9. {
  10.   case 1: report += String.format("%nEmployee: %s %s" 
  11.                      + "%nCurrent Salary: $%,.2f"
  12.                      + "%nRaise: %.2f%%"
  13.                      + "%nNew Salary: $%,.2f%n", firstName, lastName,
  14.                              currentSalary, raise, newSalary);
  15.   break;
  16.   default: report += String.format("%nEmployee: %s %s"
  17.                    + "%nStatus: TERMINATED%n", firstName, lastName);
  18. }//END switch on status
  19. printReport(): This method receives report and prints it. The year in the report header must come from the computer. It cannot be hardcoded. 
  20. 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().
  21. First Javadoc Comment Box: 

/**

 * @(#)YourLastNameFirstInitialCapstones0203Salary.java

 * @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.  

Example: FisherECapstone0203

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

Why Join Course Hero?

Course Hero has all the homework and study help you need to succeed! We’ve got course-specific notes, study guides, and practice tests along with expert tutors.

-

Educational Resources
  • -

    Study Documents

    Find the best study resources around, tagged to your specific courses. Share your own to gain free Course Hero access.

    Browse Documents
  • -

    Question & Answers

    Get one-on-one homework help from our expert tutors—available online 24/7. Ask your own questions or browse existing Q&A threads. Satisfaction guaranteed!

    Ask a Question