有一个KTV,每一包厢里配备一个服务员,服务员有服务功能,有姓名和编号属性,经理也属于服务员的一种,经理还多了一种发工资的功能。程序写出来有点问题,大家帮忙看看。- class Room
- {
- private String id;
- private int NumberOfChair;
- private int NumberOfTV;
- class Waiter
- {
- private String name;
- private int WaiterId;
- Waiter(String name,int WaiterId)
- {
- this.name=name;
- this.WaiterId=WaiterId;
- }
- public void service()
- {
- System.out.println("很高兴为您服务!");
- }
- }
- }
- class Manager extends Room.Waiter
- {
- Manager(String name,int WaiterId)
- {
- super(name,WaiterId);
- }
- public void wages()
- {
- System.out.println("今天发工资啦");
- }
- }
- class TestDemo
- {
- public static void main(String[] args)
- {
- Manager m=new Manager("zhangsan",001);
- m.wages();
- }
- }
复制代码 |