1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
Travka [436]
4 years ago
9

Design aPayrollclass that has fields for an employee’sname, ID number, hourly pay rate,and number of hours worked. Write theappr

opriate accessor and mutator methods and a constructor that accepts theemployee’s name and ID number as arguments. The class should also have amethod that returns the employee’s gross pay, which is calculated asthenumber of hours worked multiplied by the hourly pay rate. Write anotherclass/programwithmain()methodthat demonstrates the class by creatingaPayrollobject, then asking the user to enter the data for anemployee.The program should display the amount of gross pay earn
Computers and Technology
1 answer:
wariber [46]4 years ago
5 0

Answer:

public class Payroll {

   private String employeeName;

   private int employeeId;

   private double ratePerHour;

   private double totalWorkHours;

   public Payroll(String employeeName, int employeeId) {

       this.employeeName = employeeName;

       this.employeeId = employeeId;

   }

   public String getemployeeName() {

       return employeeName;

   }

   public voemployeeId setemployeeName(String employeeName) {

       this.employeeName = employeeName;

   }

   public int getemployeeId() {

       return employeeId;

   }

   public voemployeeId setemployeeId(int employeeId) {

       this.employeeId = employeeId;

   }

   public double getratePerHour() {

       return ratePerHour;

   }

   public voemployeeId setratePerHour(double ratePerHour) {

       this.ratePerHour = ratePerHour;

   }

   public double gettotalWorkHours() {

       return totalWorkHours;

   }

   public voemployeeId settotalWorkHours(double totalWorkHours) {

       this.totalWorkHours = totalWorkHours;

   }

   public double getGrossPay() {

       return ratePerHour * totalWorkHours;

   }

}

import java.util.Scanner;

public class PayrollTest {

   public static voemployeeId main(String[] args) {

       Scanner in = new Scanner(System.in);

       String employeeName;

       int employeeId;

       System.out.print("Enter employee's Name: ");

       employeeName = in.next();

       System.out.print("Enter employee's Id: ");

       employeeId = in.nextInt();

       Payroll payroll = new Payroll(employeeName, employeeId);

       System.out.print("Enter employee's hourly rate: ");

       payroll.setratePerHour(in.nextDouble());

       System.out.print("Enter employee's total hours worked:  ");

       payroll.settotalWorkHours(in.nextDouble());

       System.out.println("Gross pay = " + payroll.getGrossPay());

   }

}

Explanation:

  • Inside the Payroll class, initialize variables for employee name, ID number, hourly pay rate, and number of hours worked.
  • Define the getter and setter methods for the necessary variables inside the Payroll class.
  • Inside the main method, create an object of the Payroll class.
  • Get all the employee information as an input from user.
  • Call the getter function of  the class and display the gross pay of employee.

You might be interested in
Susan is in charge of the inventory reports for her company.She will need to find specific inventory items as well as project in
Nezavi [6.7K]

Answer:

lookup function

Explanation:

We can use the lookup function to find some values or reference in a range, we can use this syntax: LOOKUP( value, lookup_range, [result_range] ), where value is what we are going to look for, lookup_range is the single row or column is the range, and result_range is an optional part, in this range we're going to get the value.

8 0
4 years ago
What read a page on website​
katovenus [111]

Answer:

Dino

Explanation:

3 0
3 years ago
ERP implementation probably will not require:
Mamont248 [21]

Answer:

c. just a few weeks to install.

Explanation:

ERP is known as Enterprise Resource Planning.ERP implementation involves software installation, transfer of the financial data to the new system, configuration of the users and processes and training the users on the software.

It also involves upgrades after installation,cross-functional teams, intensive training, high funding for both initial cost and maintenance. This whole process usually takes place between 6 months to 2 years. This makes option C which says it takes few weeks to install incorrect.

3 0
3 years ago
Read 2 more answers
5. List three safety concerns when using hand<br> ertain safety<br> tools.
sveta [45]

Answer:

Inspect regularly. ...

Wear gloves. ...

Carry with care. ...

Don't pocket sharp objects. ...

Be aware of your surroundings. ...

Use the right tools.

6 0
3 years ago
What is the Slide Sorter View used for?
bonufazy [111]

Answer:

b. bc u can delete and add slides in ur presentation

3 0
3 years ago
Read 2 more answers
Other questions:
  • To prevent class objects from being copied or assigned, you can:
    8·1 answer
  • A university wants to install a client-server network. Which feature do you think is important for them as they set up the netwo
    8·1 answer
  • The term median means
    9·2 answers
  • Write a program that first gets a list of integers from input. The input begins with an integer indicating the number of integer
    7·1 answer
  • Which three skills are useful for success in any career?
    8·1 answer
  • The Mohs scale is used to express which mineral property?
    15·1 answer
  • Which of the following is a windows feature that allows you to temporanily store text
    8·2 answers
  • List at least five smaller behaviours you could break the complex behaviour ""brushing my teeth"" into.
    6·1 answer
  • PLEASEE HELPP.... QUESTION... how does coding impact your life​
    14·2 answers
  • Spreadsheets are sometimes credited with legitimizing the personal computer as a business tool. Why do you think they had such a
    13·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!