Question: computer programming 1 java. write a class and a Java program to use the class Create a class called Earning that contains the following Two

 computer programming 1 java. write a class and a Java program

computer programming 1 java.

write a class and a Java program to use the class Create a class called Earning that contains the following Two (2) instance variables: a d The class s the earningYTD and the hourlyRate respectively ouble called 'earningYTD and double called 'hourlyRate 2. a constructor that receives 2 double parameters the constructor will use these parameters to initialize 3. setEarningYTD: it receives a double parameter and assigns it to the earningYTD 4. getEarningYTD i returns the earningYTD value calculateEarning: it receives a double parameter and calculates and returns the current earning amount for the current hourly rate (earning hourlyRate x workingHours) 5. DO NOT WRITE ANY OTHER METHODS Part 2, Write a class (with a main method) called EarningDemo that performs the following steps 1. Declare 2 double variables named: earnedAmount and earnedAmountYTD 2 Declare an object of the above class Earning called Jane" and initialize it with the following 2500, 25.78 3. Call the appropriate method to calculate the earning amount of Jane object using the working time value of 200 hr and assign it to the variable earnedAmount 4. Add the earnedAmount variable (above) to the current YTD earning of Jane and assign the the variable 'earnedAmountYTD 5. Use the earnedAmountYTD variable (above) to set the new earningYTD of Jane object. 6. Declare a new object of the Earning class called "Bill' and initialize it with the following data: 10000, 34.26 7. Repeat the above procedures with the object Bill using the working time 120 hr. 8. Compare the earning YTD values of Jane and Bill and print the largest one

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!