源程序:
源程序:
import *;
interface StudentManageInterface
{
void setFee();
int getFee();
}
interface TeacherManageInterface
{
void setPay();
int getPay();
}
public class Graduate implements StudentManageInterface,TeacherManageInterface
{
String str;
String name;
String sex;
int age;
int fee;
int pay;
public void setFee()
{
}
public int getFee()
{
System.out.println("请输入学费:");
try
{
DataInputStream in = new DataInputStream(System.in);
str = in.readLine();
fee = Integer.parseInt(str);
}
catch (Exception e){}
return fee ;
}
public void setPay()
{
}
public int getPay()
{
System.out.println("请输入月工资:");
try
{
DataInputStream in = new DataInputStream(System.in);
str = in.readLine();
pay = Integer.parseInt(str);
}
catch (Exception e){}
return (pay*12);
}
public static void main(String args[])
{
Graduate graduate =
new Graduate();
graduate.name = "zhangsan";
graduate.sex = "male";
graduate.age = 26;
System.out.println(graduate.name);
System.out.println(graduate.sex);
System.out.println(graduate.age);
if(graduate.getPay()-graduate.getFee()<2000)
System.out.println("provide a loan");
else
System.out.println("Don't need to provide a loan");
}
}