接口、类
来源:互联网 发布:c语言用什么软件编写好 编辑:程序博客网 时间:2024/05/20 13:17
package zzy;
import static java.lang.System.*;
import java.util.*;
/**
*
* @author Zhu Zhengyan
*/
public class zzy14 {
public static void main(String[] args)
{
Scanner in = new Scanner(System.in);
Graduate yanjiusheng = new Graduate("zhangsan");
out.println("Please enter the fee");
yanjiusheng.setFee(in.nextInt());
out.println("Please enter the pay");
yanjiusheng.setPay(in.nextInt());
yanjiusheng.jisuan();
}
}
class Graduate implements StudentManageInterface,TeacherManageInterface
{
private String name;
private String sex;
private int age;
private int fee;
private int pay;
public Graduate(String name)
{
this.name = name;
this.sex = null;
this.age = 0;
this.fee = 0;
this.pay = 0;
}
public int setFee(int a)
{
this.fee = a;
return fee;
}
public void getFee()
{
out.println(fee);
}
public int setPay(int a)
{
this.pay = a;
return pay;
}
public void getPay()
{
out.println(pay);
}
public void jisuan()
{
if(fee - pay < 2000)
out.println("provide a loan");
else
out.println("does not need");
}
}
interface StudentManageInterface
{
int setFee(int a);
void getFee();
}
interface TeacherManageInterface
{
int setPay(int a);
void getPay();
}
import static java.lang.System.*;
import java.util.*;
/**
*
* @author Zhu Zhengyan
*/
public class zzy14 {
public static void main(String[] args)
{
Scanner in = new Scanner(System.in);
Graduate yanjiusheng = new Graduate("zhangsan");
out.println("Please enter the fee");
yanjiusheng.setFee(in.nextInt());
out.println("Please enter the pay");
yanjiusheng.setPay(in.nextInt());
yanjiusheng.jisuan();
}
}
class Graduate implements StudentManageInterface,TeacherManageInterface
{
private String name;
private String sex;
private int age;
private int fee;
private int pay;
public Graduate(String name)
{
this.name = name;
this.sex = null;
this.age = 0;
this.fee = 0;
this.pay = 0;
}
public int setFee(int a)
{
this.fee = a;
return fee;
}
public void getFee()
{
out.println(fee);
}
public int setPay(int a)
{
this.pay = a;
return pay;
}
public void getPay()
{
out.println(pay);
}
public void jisuan()
{
if(fee - pay < 2000)
out.println("provide a loan");
else
out.println("does not need");
}
}
interface StudentManageInterface
{
int setFee(int a);
void getFee();
}
interface TeacherManageInterface
{
int setPay(int a);
void getPay();
}
阅读全文
0 0
- C# 类 接口 接口
- 接口继承接口,类内接口
- 接口类
- 接口类
- 接口、类
- 类与类:接口与接口:类与接口
- 接口和接口实现类、接口与抽象类
- Java容器Collection接口 Collections类Iterator接口Comparable接口
- 抽象类abstract;接口和接口特点;接口举例;
- 集合接口与抽象类 collection接口 Iterator接口
- 接口与接口、接口与类之间的关系
- 接口与接口、接口与类之间的关系
- 接口与类、接口与接口之间的关系
- 关于接口、接口继承类、PropertyGrid控件
- java 接口 interface ,接口与抽象类
- java 接口 interface ,接口与抽象类
- 对接口编程:接口和抽象类
- Servlet--HttpSession接口,HttpSessionContext接口,Cookie类
- 192. Word Frequency。
- freemarker中include与import的区别
- Jquery之选项卡效果
- Spring IOC原理
- POJ 3624 Charm Bracelet
- 接口、类
- sqlite3学习笔记
- 百度云的高速下载技巧系列4---Village(原名山寨云)(安卓)
- hibernate 一级缓存(Session缓存)和持久化对象的四种状态
- UVA 624 CD
- PAT (Advanced) 1005. Spell It Right (20)
- 跨域
- 内核移植
- 打印杨辉三角