第三次做業

class Employee{
 int number;
 String name;
 int xinshui;
 int zengzhang;
 public void tell(){
  System.out.println("編號:"+number+",姓名:"+name+",薪水:"+xinshui+",增加:"+zengzhang+",工資:"+(zengzhang+xinshui));
 } 
}
public class dier{
 public static void main(String args[]){
  Employee per=new Employee();
  per.number=140201128;
  per.name="遼寧";
  per.xinshui=3000;
  per.zengzhang=1000;
  per.tell();
 }
}ui

 

 

class Dog{
 private String name;
 private String color;
 private int age;
 public Dog(String name,String color,int age){
  this.setName(name);
  this.setColor(color);
  this.setAge(age);
 }
 public void tell(){
  System.out.println("名字:"+name+",顏色:"+color+",年齡:"+age);
 }
 public String getName(){
  return name;
 }
 public void setName(String a){
  name=a;
 }
 public String getColor(){
  return color;
 }
 public void setColor(String b){
  color=b;
 }
 public int getAge(){
  return age;
 }
 public void setAge(int c){
  age=c;
 }
}
public class disi{
 public static void main(String args[]){
  Dog per=new Dog("大黃","黃",3);
  per.tell();
 }
}this

 

 

class User{
 private String name;
 private String cdk;
 private int num;
 public User(){}
 public User(String name){
  this.setName(name);
 }
 public User(String name,String cdk){
  this.setName(name);
  this.setCdk(cdk);
 }
 public void tell(){
  System.out.println("名字:"+name+",口令:"+cdk+",個數:"+num);
 }
 public String getName(){
  return name;
 }
 public void setName(String a){
  name=a;
 }
 public String getCdk(){
  return cdk;
 }
 public void setCdk(String b){
  cdk=b;
 }
 public int getNum(){
  return num;
 }
 public void setNum(int c){
  num=c;
 }
}
public class diwu{
 public static void main(String args[]){
  User per=new User("LinXinHua","lxh",3);
  per.tell();
 }
}ci

 

class Address{
 String country;
 String shengfen;
 String city;
 String jiedao;
 int youbian;
 public void tell(){
  System.out.println("國家:"+country+",省份:"+shengfen+",城市:"+city+",街道:"+jiedao+",郵編:"+youbian);
 
}
public class diyi{
 public static void main(String args[]){
  Address per=new Address();
  per.country="中國";
  per.shengfen="遼寧";
  per.city="瀋陽";
  per.jiedao="沈北新區";
  per.youbian=11300;
  per.tell();
 } 
}get

相關文章
相關標籤/搜索
本站公眾號
   歡迎關注本站公眾號,獲取更多信息