All class are supported with default constructor, proper constructor, set, get and toString method.
1. create a class “Employee” having id ,name ,gender, and job.
2. create a subclass “Worker” having hours worked, wages per hour. Write getSalary method to salary.
3. create a subclass “SalesMan” having sales and commission percent . Write getCommission method to calculate salary.
4. create a client class “Roll” to have any employee by identifying using menu to print salary details(详细资料).
Input can be random(任意的, 随便的 ), but collect Worker and SalesMan details separately.
1. create a class “Employee” having id ,name ,gender, and job.
2. create a subclass “Worker” having hours worked, wages per hour. Write getSalary method to salary.
3. create a subclass “SalesMan” having sales and commission percent . Write getCommission method to calculate salary.
4. create a client class “Roll” to have any employee by identifying using menu to print salary details(详细资料).
Input can be random(任意的, 随便的 ), but collect Worker and SalesMan details separately.
解决方案 »
- Matcher的返回结果怎么不对、明明是多个字母的。
- 使用SSLSocket发送接收utf-8编码的汉字为什么是乱码??
- JAVA问题
- 请教字节流 和 文本文件的问题
- java.sql.SQLException: [Microsoft][SQLServer 2000 Driver for JDBC][SQLServer]用户 'sa' 登录失败。
- 一个正则表达式的问题
- 一个JTable 放在JScrollPane中,如果这个JTable有50行,而JScrollPane中一页只能显示20行,我想让JTable 从第25行开始显示,怎么做?
- 新手求解,各位大大帮一把。(有关接口 Map Hashtable)
- 在网页上如何实现类似QQ中新消息提醒的功能!
- 用Corba做分布式应用程序
- 问个简单的正则,在线等,马上结贴,谢谢
- jar 文件不能打开?
2. 建立一个class “Worker” 包括 hours (工作时间), wages(每小时工资)
3. 建立一个class “ SalesMan” 包括 sales(销售额),commission percent(佣金百分率)
4. 建立一个class “ Roll” 连接以上class , 然后能输出详细信息
public class Employee{
pravite String id;
pravite String name;
pravite String gender;
pravite String job; public Employee(){
}
public Employee(String id,String name,String gender,String job){
this.id = id;
this.name = name;
this.gender = gender;
this.job = job;
}
public void setId(String id){
this.id = id;
}
public void getId(){
return id;
}
public void setName(String name){
this.name = name;
}
public void getName(){
return name;
}
public void setGender(String gender){
this.gender = gender;
}
public void getGender(){
return gender;
}
public void setJob(String job){
this.job = job;
}
public void getJobr(){
return job;
}
}
public class Worker{
private Double hours;
private Double wages;
public Worker(){}
public Worker(Double hours,Double wages){
this.hours = hours;
this.wages = wages;
}
public void setHours(Double hours){
this.hours = hours;
}
public Double getHours(){
return hours;
}
public void setWages(Double wages){
this.wages = wages;
}
public Double getWages(){
return wages;
}
}public class SalesMan{ private Double sales;
private Double percent;
public void SalesMan(){}
public void SalesMan(Double sales,Double percent){
this.sales = sales;
this.percent = percent;
}
public void setSales(Double sales){
this.sales = sales;
}
public Double getSales(){
return sales;
}
public void setPercent(Double percent){
this.percent = percent;
}
public Double getPercent(){
return percent;
}
}public class Roll{ public static main(String[] agr){
Employee employee = new Employee("id","name","gender","job");
Worker worker = new Worker(new Double(40),new Double(200));
SalesMan salesMan = new SalesMan(new Double(100000),new Double(0.01));
System.out.println("Employee: Id=" + employee.getId() + " Name=" + employee.getName() );
System.out.println("Worker: Hours=" + worker.getHours().toString() + " Wages=" + worker.getWages().toString() );
System.out.println("SalesMan: Sales=" + salesMan.getSales().toString() + " Percent" + salesMan.getPercent().toString() );
}
}