Question
must be in java Create a package named: LastFirstInitialExam1 Create a class called Payroll (Be sure and comment all your work) Create an instance variable
must be in java
Create a package named: LastFirstInitialExam1
Create a class called Payroll (Be sure and comment all your work)
Create an instance variable called payCheck. It should be an integer. Also, create an instance String variable called name.
Create a default constructor that sets the variable payCheck to 0 and name to blank.
Create a constructor that sets the variable payCheck to 0 and the name to a parameter.
Create a method called calculatePaycheck. This method should have two explicit parameters, the number of hours worked as an integer and the payRate as an integer. (They are separated by a comma). This method should calculate the payCheck by multiplying (*) by the number of hours by the payRate.
Create a method called getName() to return the name.
Create a method called getPayCheck to return the payCheck value.
Create a class called PayrollTester. This is the main with the plumbing.
Create an object called Dummy which uses the default constructor.
Print the name associated with the object Dummy from step 10 using the getName() method.
Print the payCheck associated with the object Dummy from step 10 using the getPayCheck() method.
Create an object called Me which use your name as the parameter.
Call the calculatePaycheck method using 40 hours and 10 dollars.
Print the name associated with the object Me from step 13 using the getName() method.
Print the payCheck associated with the object Me from step 13 using the getPayCheck() method.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started