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();
}
}