java佣金代码 java赚钱
求解一道java题,谢谢。
代码如下,说明几点:
创新互联从2013年成立,先为秦都等服务建站,秦都等地企业,进行企业商务咨询服务。为秦都企业网站制作PC+手机+微官网三网同步一站式服务解决您的所有建站问题。
1.共有6个文件,五个类和一个测试文件
2.有些类的命名可能打的不一样,比如掉了个ee之类的,不过很好看出来
3.为了利于实现,没有使用java自带的toString,而是自定义了个toStr.
-------------Employee.java------------
/*
* @(#)Employee.java 2007-11-25
*/
package cn.com.robert.baidu.employee;
/**
* @author R
*/
public class Employee {
private String name;
private String socialSecurityNumber;
public String employeeType;
public Employee(String pname,String pnumber) {
name=pname;
socialSecurityNumber=pnumber;
employeeType=null;
}
public Employee(String pname) {
name=pname;
socialSecurityNumber=null;
employeeType=null;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getSocialSecurityNumber() {
return socialSecurityNumber;
}
public void setSocialSecurityNumber(String socialSecurityNumber) {
this.socialSecurityNumber = socialSecurityNumber;
}
public void toStr(){
System.out.println(employeeType+" "+getName());
System.out.println("Social Security number: "+getSocialSecurityNumber());
}
}
----------end of Employee.java--------
----------SalariedEmploy.java --------
/*
* @(#)SalariedEmploy.java 2007-11-25
*/
package cn.com.robert.baidu.employee;
/**
* @author R
*/
public class SalariedEmploy extends Employee {
private int weekSalary;
public SalariedEmploy(String pname, String pnumber) {
super(pname, pnumber);
employeeType="Salaried Employ";
}
public SalariedEmploy(String pname) {
super(pname);
employeeType="Salaried Employ";
}
public int getWeekSalary() {
return weekSalary;
}
public void setWeekSalary(int weekSalary) {
this.weekSalary = weekSalary;
}
public void toStr(){
super.toStr();
System.out.println("Week Salary:"+getWeekSalary()+"$");
}
}
------end of SalariedEmploy.java -----
-------CommissionEmployee.java-------
/*
* @(#)CommissionEmployee.java 2007-11-25
*/
package cn.com.robert.baidu.employee;
/**
* @author R
*/
public class CommissionEmployee extends Employee {
private double commitionRate;
private int grossSales;
public CommissionEmployee(String pname, String pnumber) {
super(pname, pnumber);
employeeType="Commission Employee";
}
public CommissionEmployee(String pname) {
super(pname);
}
public double getCommitionRate() {
return commitionRate;
}
public void setCommitionRate(double commitionRate) {
this.commitionRate = commitionRate;
}
public int getGrossSales() {
return grossSales;
}
public void setGrossSales(int grossSales) {
this.grossSales = grossSales;
}
public void toStr(){
super.toStr();
System.out.println("CommitionRate : "+getCommitionRate());
System.out.println("Gross sales : "+getGrossSales()+"$");
}
}
------------end of CommissionEmployee.java---
------------HourEmployee.java----------
/*
* @(#)HourEmployee.java 2007-11-25
*/
package cn.com.robert.baidu.employee;
/**
* @author R
*/
public class HourEmployee extends Employee {
private int hourSalary;
private int hour;
public HourEmployee(String pname, String pnumber) {
super(pname, pnumber);
employeeType="HourEmployee";
}
public HourEmployee(String pname) {
super(pname);
employeeType="HourEmployee";
}
public int getHour() {
return hour;
}
public void setHour(int hour) {
this.hour = hour;
}
public int getHourSalary() {
return hourSalary;
}
public void setHourSalary(int hourSalary) {
this.hourSalary = hourSalary;
}
public void toStr(){
super.toStr();
System.out.println("Hour Salary:"+getHourSalary());
System.out.println("Hour:"+getHour());
}
}
-------end of HourEmployee.java-----
-------BaseplusEmployee.java ------
/*
* @(#)BaseplusEmployee.java 2007-11-25
*/
package cn.com.robert.baidu.employee;
/**
* @author R
*/
public class BaseplusEmployee extends CommissionEmployee {
private int basicSalary;
public BaseplusEmployee(String pname, String pnumber) {
super(pname, pnumber);
employeeType="Baseplus Employee";
}
public BaseplusEmployee(String pname) {
super(pname);
employeeType="Baseplus Employee";
}
public int getBasicSalary() {
return basicSalary;
}
public void setBasicSalary(int basicSalary) {
this.basicSalary = basicSalary;
}
public void toStr(){
super.toStr();
System.out.println("BasicSalary:"+getBasicSalary());
}
}
----------end of BaseplusEmployee.java --
------TestEmployee.java--------
/*
* @(#)TestEmployee.java 2007-11-25
*/
package cn.com.robert.baidu.employee;
/**
* @author R
*/
public class TestEmployee {
/**
* @param args
*/
public static void main(String[] args) {
SalariedEmploy salariedEmploy=new SalariedEmploy("John Smith","111-111-1111");
salariedEmploy.setWeekSalary(1000);
salariedEmploy.toStr();
CommissionEmployee commissionemployee=new CommissionEmployee("Sue Tom ","111-112-1111 ");
commissionemployee.setCommitionRate(0.09);
commissionemployee.setGrossSales(10000);
commissionemployee.toStr();
}
}
----end of TestEmployee.java-----
java答案求助,这是关于类方面的问题
//Employee对象应当有姓名、年龄和社会保险号码
public class Employee {//Employee.java
private String name;//姓名
private int age;//年龄
private int insurance;//社保号码
public String getName(){//获取姓名
return this.name;
}
public void setName(String name){//设置姓名
this.name=name;
}
public int getAge(){//获取年龄
return this.age;
}
public void setAge(int age){//设置年龄
this.age=age;
}
public int getInsurance(){//获取社保号码
return this.insurance;
}
public void setInsurance(int insurance){//设置设备号码
this.insurance=insurance;
}
}
//对象还有周薪
public class SalariedEmployee extends Employee{//SalariedEmployee.java
private double weeksalary;//周薪
public double getWeeksalary(){
return this.weeksalary;
}
public void setWeeksalary(double weeksalary){
this.weeksalary=weeksalary;
}
}
//HourlyEmployee对象有相应的基本工资和工作小时数,
public class HourlyEmployee extends Employee {//HourlyEmployee.java
private double basesalary;//工作小时对应的基本工资
private double hourlytime;//工作时间
public double getBaseSalary(){//获取工作基本工资
return this.basesalary;
}
public void setBaseSalary(double basesalary){//设置工作基本工资
this.basesalary=basesalary;
}
public double getHourlyTime() {//获取工作时间
return hourlytime;
}
public void setHourlyTime(double hourlytime) {//设置工作时间
this.hourlytime = hourlytime;
}
}
// CommissionEmployee 对象应当有佣金率和销售总额,
//承继Employee
public class CommissionEmployee extends Employee{//CommissionEmployee.java
private double commission;//佣金率,输出时候加%号
private double totalsales;//销售总额
public double getCommission(){//获取佣金率
return this.commission;
}
public void setCommission(double commission){//设置佣金率
this.commission=commission;
}
public double getTotalsales(){//获取总销售额
return this.totalsales;
}
public void setTotalsales(double totalsales){//设置总销售额
this.totalsales=totalsales;
}
}
//BasePlusCommissionEmployee 对象应当有对应的基本工资+提成 就是总工资
public class BasePlusCommissionEmployee extends Employee {
//BasePlusCommissionEmployee.java
private double basepluscommission;
//相应基本工资,实际上这里应该是基本工资+提成的意思
public double getBasePlusCommission(){//获取相应基本工资
return this.basepluscommission;
}
public void setBasePlusCommission(double basepluscommission){
//设置基本工资,可以根据实际需求更改下面算法
this.basepluscommission=basepluscommission;
}
}
public class Text {//主输出文件 Text.java 可以自行更改
public static void main(String[] args){
System.out.println("[测试一]Employee 员工基本信息:");
Employee employee=new Employee();
employee.setName("王一");
employee.setAge(28);
employee.setInsurance(2013100001);
System.out.println("姓名:"+employee.getName());
System.out.println("年龄:"+employee.getAge());
System.out.println("社保号码:"+employee.getInsurance());
System.out.println(" ");
System.out.println("[测试二]SalariedEmployee 周薪承继调用:");
SalariedEmployee salaried=new SalariedEmployee();
salaried.setName("小二");
salaried.setAge(18);
salaried.setInsurance(2013100002);
salaried.setWeeksalary(1200);
System.out.println("姓名:"+salaried.getName());
System.out.println("年龄:"+salaried.getAge());
System.out.println("社保号码:"+salaried.getInsurance());
System.out.println("周薪:"+salaried.getWeeksalary()+"元");
System.out.println(" ");
System.out.println("[测试三]HourlyEmployee 基本工资+工作时间承继调用:");
HourlyEmployee hourly=new HourlyEmployee();
hourly.setName("张三");
hourly.setAge(30);
hourly.setInsurance(2014100003);
hourly.setBaseSalary(400);
hourly.setHourlyTime(50);
System.out.println("姓名:"+hourly.getName());
System.out.println("年龄:"+hourly.getAge());
System.out.println("社保号码:"+hourly.getInsurance());
System.out.println("周薪:"+hourly.getBaseSalary()+"元");
System.out.println("周薪:"+hourly.getHourlyTime()+"小时");
System.out.println(" ");
System.out.println("[测试四] CommissionEmployee 对象应当有佣金率和销售总额::");
CommissionEmployee commission=new CommissionEmployee();
commission.setName("李四");
commission.setAge(33);
commission.setInsurance(2009100004);
commission.setCommission(23);//佣金率
commission.setTotalsales(33405);//总销售额
System.out.println("姓名:"+commission.getName());
System.out.println("年龄:"+commission.getAge());
System.out.println("社保号码:"+commission.getInsurance());
System.out.println("佣金率: "+commission.getCommission()+"%");
System.out.println("总销售额:"+commission.getTotalsales()+"元");
System.out.println(" ");
System.out.println("[测试五] BasePlusCommissionEmployee有对应的基本工资::");
BasePlusCommissionEmployee basepluscommission=new BasePlusCommissionEmployee();
basepluscommission.setName("陈五");
basepluscommission.setAge(40);
basepluscommission.setInsurance(200110005);
basepluscommission.setBasePlusCommission(3800);
System.out.println("姓名:"+basepluscommission.getName());
System.out.println("年龄:"+basepluscommission.getAge());
System.out.println("社保号码:"+basepluscommission.getInsurance());
System.out.println("基本工资:"+basepluscommission.getBasePlusCommission()+"元");
}
}
---------------------
运行结果:
[测试一]Employee 员工基本信息:
姓名:王一
年龄:28
社保号码:2013100001
[测试二]SalariedEmployee 周薪承继调用:
姓名:小二
年龄:18
社保号码:2013100002
周薪:1200.0元
[测试三]HourlyEmployee 基本工资+工作时间承继调用:
姓名:张三
年龄:30
社保号码:2014100003
周薪:400.0元
周薪:50.0小时
[测试四] CommissionEmployee 对象应当有佣金率和销售总额::
姓名:李四
年龄:33
社保号码:2009100004
佣金率: 23.0%
总销售额:33405.0元
[测试五] BasePlusCommissionEmployee 对象应当有对应的基本工资::
姓名:陈五
年龄:40
社保号码:200110005
基本工资:3800.0元
-----------------运行结束-----------------------
[备注]:大哥,因为不是很理解上面的应用,假如需要计算的话,你可以自己修改一下代码算法。基本的架构都已经搭建了,采用构造类和承继方法进行,你把这几个文件都分开存放在一个文件夹下面就可以了。运行Text.java 这个文件。
这些都是自己写的,希望能给予你参考作用。
佣金目的代码是
佣金目的代码是Console。根据相关公开信息查询,佣金制亦称中佣或者行佣,证券经纪商代理投资买卖证券成交后由投资者支付给经纪商的手续费和报酬。证券经纪商代理投资者从事证券交易活动的主要目的就是为了获得收入,因此佣金制也就成为一种必然的现象。
名称栏目:java佣金代码 java赚钱
网页链接:http://scyanting.com/article/dojicjd.html