Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Kindly to change the code below to make it user interface code instead of display code as follow The main program will run to show

Kindly to change the code below to make it user interface code instead of display code as follow

The main program will run to show below display

1. Add supplier

2. Add Manpower

3. Display All expenses

4. Exit

If you chose 1 then will let you pick one of the three suppliers in the system

If you chose 2 then it will show you to add the name , ID, designation , hourly pay , weekly worked hour, overtime

If you chose display all expenses the program will show you all data you entered ?

The answer should be full code

?

import odai.Contractor; import odai.Employee; import odai.Nameofsuppliers; //main class class Employee { //initialize person common attribute String name, id; String designation; //set initial value when create new instance public Employee(String name, String id, String designation) { super(); this.name = name; this.id = id; this.designation = designation; } /** * @return the name */ public String getName() { return name; } // name the name to set public void setName(String name) { this.name = name; } /** * @return the id */ public String getId() { return id; } // id the id to set public void setId(String id) { this.id = id; } /** * @return the designation */ public String getDesignation() { return designation; } // designation the designation to set public void setDesignation(String designation) { this.designation = designation; } /* (non-Javadoc) * @see java.lang.Object#toString() */ @Override public String toString() { return "Employee [name=" + name + ", id=" + id + ", designation=" + designation + "]"; } } /* * A class Contractor which extends Employee class */ // Example of Inheritance here class Contractor extends Employee { double hourlyRate; // the regular hourly rate of the part time employee int weeklyHours[] = new int[7]; // the number of hours worked by the employee weekly double overtimeRate; // overTimeRate is applied for the hours greater than 60 hours public Contractor(String name, String id, String designation, double rate, int hours[], double overtimeRate) { super(name, id, designation); this.hourlyRate = rate; this.weeklyHours = hours; this.overtimeRate = overtimeRate; } /** * @return the hourlyRate public double getHourlyRate() { return hourlyRate; } /** * @param hourlyRate the hourlyRate to set */ public void setHourlyRate(double hourlyRate) { this.hourlyRate = hourlyRate; } /** * @return the weeklyHours */ public int[] getWeeklyHours() { return weeklyHours; } /** * @param weeklyHours the weeklyHours to set */ public void setWeeklyHours(int[] weeklyHours) { this.weeklyHours = weeklyHours; } /** * @return the overtimeRate */ public double getOvertimeRate() { return overtimeRate; } /** * @param overtimeRate the overtimeRate to set */ public void setOvertimeRate(double overtimeRate) { this.overtimeRate = overtimeRate; } // This method calculates the weekly total pay of the contractor double getWeeklyTotalPay() { double totalPay = 0.0; int numberOfHours = weeklyTotalHoursWorked(); if(numberOfHours > 60) { totalPay = 60 * hourlyRate + (numberOfHours - 60) * overtimeRate; } else { totalPay = numberOfHours * hourlyRate; } return totalPay; } // This method calculates the weekly total number of hours worked by the contractor int weeklyTotalHoursWorked() { int numberOfHours = 0; // Repetition statements for(int i=0; i

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Income Tax Fundamentals 2013

Authors: Gerald E. Whittenburg, Martha Altus Buller, Steven L Gill

31st Edition

1111972516, 978-1285586618, 1285586611, 978-1285613109, 978-1111972516

More Books

Students also viewed these Programming questions