JAVA 关于class 的编程!In the following problems,you will build a series of Java classes,which you should be able to use with the following test program (containing the expected results as printed messages):public class TestWorkers{public static

来源:学生作业帮助网 编辑:作业帮 时间:2024/04/25 13:30:30
JAVA 关于class 的编程!In the following problems,you will build a series of Java classes,which you should be able to use with the following test program (containing the expected results as printed messages):public class TestWorkers{public static

JAVA 关于class 的编程!In the following problems,you will build a series of Java classes,which you should be able to use with the following test program (containing the expected results as printed messages):public class TestWorkers{public static
JAVA 关于class 的编程!
In the following problems,you will build a series of Java classes,which you should be able to use with the following test program (containing the expected results as printed messages):
public class TestWorkers
{
public static void main(String[] args)
{
Worker[] workers = new Worker[4];
workers[0] = new HourlyWorker("John",6);
workers[1] = new SalariedWorker("Jane",10);
workers[2] = new HourlyWorker("Bob",8);
workers[3] = new SalariedWorker("Boss",15);
int[] hours = { 30,35,60,20 };
for (int i = 0; i < workers.length; i++)
{
System.out.println(workers[i].getName() + "'s wage for "
+ hours[i] + " hours with $" + workers[i].getRate()
+ "/hour = " + workers[i].computePay(hours[i]));
}
System.out.println("Expected output:");
System.out.println("John's wage for 30 hours with $6.0/hour = 180.0");
System.out.println("Jane's wage for 35 hours with $10.0/hour = 400.0");
System.out.println("Bob's wage for 60 hours with $8.0/hour = 560.0");
System.out.println("Boss's wage for 20 hours with $15.0/hour = 600.0");
}
}

Questions:
1.\x05Does this program exhibit any polymorphic characteristics?  If so where?
2.\x05Can you make the ‘Worker’ class abstract?  If not, why not?
3.\x05If this project was also expanded to figure out taxes on wages where would the code for this calculation best be placed?
题目实在太长了.所以用截图了..图片看的到么? 还有一天就要交了.100分求编程.

JAVA 关于class 的编程!In the following problems,you will build a series of Java classes,which you should be able to use with the following test program (containing the expected results as printed messages):public class TestWorkers{public static
Worker这个类你没贴出来.而且你也不给点分!