QuestionQuestion

Part I
Create a class named Pay that includes five double variables that hold hours worked, rate of pay per hour, withholding rate, gross pay, and net pay. Create three overloaded computeNetPay () methods. When computeNetPay () receives values for hours, pay rate, and withholding rate, it computes the gross pay and reduces it by the appropriate withholding amount to produce the net pay. (Gross pay is computed as hours worked multiplied by pay per hour.)

When computeNetPay () receives two parameters, they represent the hours and pay rate, and the withholding rate is assumed to be 15%. When computeNetPay () receives one parameter, it represents the number of hours worked, the withholding rate is assumed to be 15%, and the hourly rate is assumed to be 5.85. Write a main() method that tests all three overloaded methods. Save the application as Pay.java

Part II
Create a class named Circle with fields named radius, diameter, and area. Include a constructor that sets the radius to 1 and calculates the other two values. Also include methods named setRadius () and getRadius (). The setRadius () method not only sets the radius, it also calculates the other two values. (Remember that the diameter of a circle is twice the radius, and the area of a circle is pi multiplied by the square of the radius.) Save the class as Circle.java.

Create a class named TestCircle whose main () method declares several Circle objects. Using the setRadius () method, assign one Circle a small radius value, and assign another a larger radius value. Do not assign a value to the radius of the third circle. Instead, retain the value assigned at construction. Display all the values for all the Circle objects. Save the application as TestCircle.java.

Solution PreviewSolution Preview

This material may consist of step-by-step explanations on how to solve a problem or examples of proper writing, including the use of citations, references, bibliographies, and formatting. This material is made available for the sole purpose of studying and learning - misuse is strictly forbidden.

public class Pay {
    double hours_worked;
    double rate_of_pay_per_hour;
    double withholding_rate;
    double gross_pay;
    double net_pay;

    public Pay() {
    }

    public Pay(double hours_worked, double rate_of_pay_per_hour, double withholding_rate, double gross_pay, double net_pay) {
       this.hours_worked = hours_worked;
       this.rate_of_pay_per_hour = rate_of_pay_per_hour;
       this.withholding_rate = withholding_rate;
       this.gross_pay = gross_pay;
       this.net_pay = net_pay;
    }
   
    public void computeNetPay(double hours_worked, double rate_of_pay_per_hour, double withholding_rate){
       this.hours_worked = hours_worked;
       this.rate_of_pay_per_hour = rate_of_pay_per_hour;
       this.withholding_rate = withholding_rate;
       gross_pay = hours_worked * rate_of_pay_per_hour;...
$21.00 for this solution

PayPal, G Pay, ApplePay, Amazon Pay, and all major credit cards accepted.

Find A Tutor

View available Java Programming Tutors

Get College Homework Help.

Are you sure you don't want to upload any files?

Fast tutor response requires as much info as possible.

Decision:
Upload a file
Continue without uploading

SUBMIT YOUR HOMEWORK
We couldn't find that subject.
Please select the best match from the list below.

We'll send you an email right away. If it's not in your inbox, check your spam folder.

  • 1
  • 2
  • 3
Live Chats