标题:show 出现错误
取消只看楼主
清风易水
Rank: 1
来 自:江苏扬州
等 级:新手上路
帖 子:18
专家分:3
注 册:2009-5-13
结帖率:66.67%
 问题点数:0 回复次数:1 
show 出现错误
abstract class EmpDemo
{
    String name;
    double basicSalary;
    double totalSalary;
    public EmpDemo(){}
    public EmpDemo(String _name, double _basicSalary)
    {
        name = _name;
        basicSalary = _basicSalary;
    }
   
    public abstract void paySalary();
}
class Seller extends EmpDemo
{
    double totalSalary;
    int daytime = 8;
    int hourget = 10;
    public Seller(String _name, double _basicSalary, int daytime, int hourget)
    {
        name = _name;
        basicSalary = _basicSalary;
    }
   
    public void paySalary()
    {
        totalSalary = basicSalary + 30 * daytime * hourget;
    }
   
    void showSeller()
    {
        System.out.println("销售员" + name + "的薪水为:" + totalSalary);
    }
}
class Manager extends EmpDemo
{
    double totalSalary;
    int times = 12;
    public Manager(String _name, double _basicSalary, int times)
    {
        name = _name;
        basicSalary = _basicSalary;
    }
   
    public void paySalary()
    {
        totalSalary = basicSalary + 2400 / times;
    }
   
    void showManager()
    {
        System.out.println("经理" + name + "的薪水为:" + totalSalary);
    }
}
public class Employee
{
    public static void main(String[] args)
    {
        EmpDemo e1 = new Seller("刘欢", 100, 8, 10);
        e1.showSeller();
        EmpDemo e2 = new Manager("王菲", 100, 12);
        e2.showManager();
    }
}

搜索更多相关主题的帖子: show 
2009-11-01 21:18
清风易水
Rank: 1
来 自:江苏扬州
等 级:新手上路
帖 子:18
专家分:3
注 册:2009-5-13
得分:0 
回复 2楼 wsckt
谢谢
2009-11-03 13:21



参与讨论请移步原网站贴子:https://bbs.bccn.net/thread-290708-1-1.html




关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 1.490808 second(s), 8 queries.
Copyright©2004-2025, BCCN.NET, All Rights Reserved