Question

Please write the following program in Java That last idea at PicoSoft didn't work out too...

Please write the following program in Java

That last idea at PicoSoft didn't work out too well … management has a massive public relations disaster on their hands, and thus they decide to revise the bonus structure, as well as give eveyone some additional vacation time.

Write a program that reads in (from the keyboard) the following information about an employee:

Last name

First name

Years worked (a whole number)

Annual salary

An employee's vacation time is based upon the following table:

Bonuses are determined by the following table:

Your program should read in the information for an employee, calculate the vacation time and bonus amount for the employee, and display the employee's name, number of years worked, number of weeks of vacation and amount of bonus (on a single line). Please note that you are to print the actual amount of the bonus (calculated as 5% of the annual salary), and not simply the words 5% of salary".

This should be done for eight (8) employee (using a for loop).

Test Run

Enter last name: Weiss
Enter first name: Gerald
Enter years worked: 1
Enter salary: 100
Gerald Weiss gets 1 weeks vacation, and a bonus of $0

Enter last name: Arnow
Enter first name: Davis
Enter years worked: 3
Enter salary: 200
Davis Arnow gets 1 weeks vacation, and a bonus of $0

Enter last name: Tenenbaum
Enter first name: Aaron
Enter years worked: 4
Enter salary: 100
Aaron Tenenbaum gets 2 weeks vacation, and a bonus of $0

Enter last name: Thurm
Enter first name: Joe
Enter years worked: 6
Enter salary: 100
Joe Thurm gets 2 weeks vacation, and a bonus of $200

Enter last name: Whitlock
Enter first name: Paula
Enter years worked: 7
Enter salary: 400
Paula Whitlock gets 3 weeks vacation, and a bonus of $200

Enter last name: Jones
Enter first name: Jackie
Enter years worked: 9
Enter salary: 500
Jackie Jones gets 3 weeks vacation, and a bonus of $200

Enter last name: Dreizen
Enter first name: Phil
Enter years worked: 10
Enter salary: 1000
Phil Dreizen gets 3 weeks vacation, and a bonus of $50

Enter last name: Augenstein
Enter first name: Moshe
Enter years worked: 12
Enter salary: 1500
Moshe Augenstein gets 3 weeks vacation, and a bonus of $75

0 0
Add a comment Improve this question Transcribed image text
Answer #1

EmpVacationAndBonus.java

import java.util.Scanner;

public class EmpVacationAndBonus {

public static void main(String[] args) {

// Declaring variables
String lastname, firstname;
int yearsWorked, vacationWeeks = 0;
double bonus = 0, annSal;

/*
* Creating an Scanner class object which is used to get the inputs
* entered by the user
*/
Scanner sc = new Scanner(System.in);

for (int i = 1; i <= 8; i++) {
// Getting the first name entered by the user
System.out.print("\nEnter last name:");
lastname = sc.next();

// Getting the last name entered by the user
System.out.print("Enter first name:");
firstname = sc.next();

// Getting the no of years entered by the user
System.out.print("Enter years worked:");
yearsWorked = sc.nextInt();

// Getting the annual salary entered by the user
System.out.print("Enter salary:");
annSal = sc.nextDouble();

// based on years worked find the no of vacation weeks and bonus

if (yearsWorked >= 0 && yearsWorked <= 3)
vacationWeeks = 1;
else if (yearsWorked >= 4 && yearsWorked <= 6)
vacationWeeks = 2;
else if (yearsWorked >= 7)
vacationWeeks = 3;

if (yearsWorked >= 0 && yearsWorked <= 4)
bonus = 0;
else if (yearsWorked >= 5 && yearsWorked <= 9)
bonus = 200;
else if (yearsWorked >= 7)
bonus = annSal * 0.05;

// Displaying the output
System.out.println(firstname + " " + lastname + " gets " + vacationWeeks + " weeks vacation, and a bonus of $" + bonus);
}

}

}

______________________

Output:


Enter last name:Weiss
Enter first name:Gerald
Enter years worked:1
Enter salary:100
Gerald Weiss gets 1 weeks vacation, and a bonus of $0.0

Enter last name:Arnow
Enter first name:Davis
Enter years worked:3
Enter salary:200
Davis Arnow gets 1 weeks vacation, and a bonus of $0.0

Enter last name:Tenenbaum
Enter first name:Aaron
Enter years worked:4
Enter salary:100
Aaron Tenenbaum gets 2 weeks vacation, and a bonus of $0.0

Enter last name:Thurm
Enter first name:Joe
Enter years worked:6
Enter salary:100
Joe Thurm gets 2 weeks vacation, and a bonus of $200.0

Enter last name:Whitlock
Enter first name:Paula
Enter years worked:7
Enter salary:400
Paula Whitlock gets 3 weeks vacation, and a bonus of $200.0

Enter last name: Jones
Enter first name: Jackie
Enter years worked: 9
Enter salary: 500
Jackie Jones gets 3 weeks vacation, and a bonus of $200

Enter last name: Dreizen
Enter first name: Phil
Enter years worked: 10
Enter salary: 1000
Phil Dreizen gets 3 weeks vacation, and a bonus of $50

Enter last name: Augenstein
Enter first name: Moshe
Enter years worked: 12
Enter salary: 1500
Moshe Augenstein gets 3 weeks vacation, and a bonus of $75

_____________Could you rate me well.Plz .Thank You

Add a comment
Know the answer?
Add Answer to:
Please write the following program in Java That last idea at PicoSoft didn't work out too...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • Multiple Conditional Statements Summary In this lab, you complete a Python program that calculates an employee's...

    Multiple Conditional Statements Summary In this lab, you complete a Python program that calculates an employee's annual bonus. Input is an employee's first name, last name, salary, and numeric performance rating. If the rating is 1, 2, or 3, the bonus rate used is .25, .15, or .1 respectively. If the rating is 4 or higher, the rate is 0. The employee bonus is calculated by multiplying the bonus rate by the annual salary. Variables have been declared for you,...

  • Please write in C++ MEMO To: The Programming Staff From The Boss I need a program that will help me figure out who gets...

    Please write in C++ MEMO To: The Programming Staff From The Boss I need a program that will help me figure out who gets what for this year’s annual bonuses. Here are the conditions: Every employee gets a basic bonus of $1000. All the employees in department 2 get an additional $1000 bonus (above the basic bonus) unless they have more than five dependents. Any employee with more than five dependents gets a $5000 bonus. And no – you can’t...

  • In this lab, you complete a prewritten C++ program that calculates an employee’s productivity bonus and...

    In this lab, you complete a prewritten C++ program that calculates an employee’s productivity bonus and prints the employee’s name and bonus. Bonuses are calculated based on an employee’s productivity score as shown below. A productivity score is calculated by first dividing an employee’s transactions dollar value by the number of transactions and then dividing the result by the number of shifts worked. Productivity Score Bonus <=30 $50 31–69 $75 70–199 $100 >= 200 $200 Instructions Ensure the file named...

  • I really need help with this, please. This is a java programming assignment. Project 1 The first programming project inv...

    I really need help with this, please. This is a java programming assignment. Project 1 The first programming project involves writing a program that computes the salaries for a collection of employees of different types. This program consists of four classes. 1. The first class is the Employee class, which contains the employee's name and monthly salary, which is specified in whole dollars. It should have three methods: a. A constructor that allows the name and monthly salary to be...

  • PYTHON PROGRAMMING LANGUAGE (NEEDED ASAP) Using a structured approach to writing the program: This section will...

    PYTHON PROGRAMMING LANGUAGE (NEEDED ASAP) Using a structured approach to writing the program: This section will guide you in starting the program in a methodical way. The program will display a window with GUI widgets that are associated with particular functions: Employee Payroll O X -- - - - - - - - - - - Show Payroll Find Employee by Name Highest Lowest Find Employee by Amount Write Output to Fie Cancel - -------- ------------- Notice that some of...

  • Java Description Write a program to compute bonuses earned this year by employees in an organization....

    Java Description Write a program to compute bonuses earned this year by employees in an organization. There are three types of employees: workers, managers and executives. Each type of employee is represented by a class. The classes are named Worker, Manager and Executive and are described below in the implementation section. You are to compute and display bonuses for all the employees in the organization using a single polymorphic loop. This will be done by creating an abstract class Employee...

  • ASAP Please. Python Program Description Create an object-oriented program that allows you to enter data for...

    ASAP Please. Python Program Description Create an object-oriented program that allows you to enter data for employees. Specifications Create an abstract Employee class that provides private attributes for the first name, last name, email address, and social security number. This class should provide functions that set and return the employee’s first name, last name, email address, and social security number. This class has a function: get_net_income which returns 0. Create a Manager class that inherits the Employee class. This class...

  • In this assignment, you will write one (1) medium size C program. The program needs to...

    In this assignment, you will write one (1) medium size C program. The program needs to be structured using multiple functions, i.e., you are required to organize your code into distinct logical units. The following set of instructions provide the specific requirements for the program. Make sure to test thoroughly before submitting. Write   a   program,   named   program1.c,   that   reads   and   processes   employee   records   (data   about   an   employee).   Each   employee   record   must   be   stored   using   a   struct   that   contains   the   following  ...

  • Code a complete Java program for the following payroll application: First, hard code the following data...

    Code a complete Java program for the following payroll application: First, hard code the following data for the object ‘Employee’ into 4 separate arrays: SSN: 478936762, 120981098, 344219081, 390846789, 345618902, 344090917 First name      : Robert, Thomas, Tim, Lee, Young, Ropal Last name       : Donal, Cook, Safrin, Matlo, Wang, Kishal Hourly rate     : 12.75, 29.12, 34.25, 9.45,   20.95, 45.10 Hours worked: 45,        40,        39,       20,      44,        10 These 4 arrays must be declared inside the class and not within any method....

  • Java Programming Reading from a Text File Write a Java program that will use an object...

    Java Programming Reading from a Text File Write a Java program that will use an object of the Scanner class to read employee payroll data from a text file The Text file payroll.dat has the following: 100 Washington Marx Jung Darwin George 40 200 300 400 Kar Car Charles 50 22.532 15 30 The order of the data and its types stored in the file are as follows: Data EmployeelD Last name FirstName HoursWorked double HourlyRate Data Tvpe String String...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT