Third time Java job

Source: Internet
Author: User

public class Liti1 {


public static void Main (string[] args) {
TODO auto-generated Method Stub
Address A = new address ("China", "Liaoning Province", "Dandong", "Tongjiang Street",
123456);
System.out.println ("Country" + a.getcountry () + ", province" + a.getprovince ()
+ ", City" + a.getcity () + ", street" + a.getstreet () + ", postcode"
+ A.getpost ());
}


}


Class Address {
String Country;
String Province;
String City;
String Street;
int post;

Public Address (String country, String province, String city, String Street,
int post) {
This.setcountry (country);
This.setprovince (province);
This.setcity (city);
This.setstreet (street);
This.setpost (POST);
}

public void Setcountry (String country) {
This.country = country;
}
public void Setprovince (String province) {
this.province = Province;
}
public void Setcity (String city) {
this.city = City;
}
public void Setstreet (String street) {
This.street = Street;
}
public void Setpost (int post) {
This.post = post;
}

Public String Getcountry () {
return this.country;
}

Public String getprovince () {
return this.province;
}

Public String getcity () {
return this.city;
}

Public String Getstreet () {
return this.street;
}
public int Getpost () {
return this.post;
}
}

public class liti2{


public static void Main (string[] args) {
TODO auto-generated Method Stub
Employee me = new Employee ("140201115", "Shing", 5000, 0.1);
System.out.println ("Number:" + me.getnumber () + "name" + me.getname ()
+ "Base Salary" + me.getbasal () + "growth rate" + me.getincrease () + "total wage"
+ me.salary ());
}


}


Class Employee {
private String number;
private String name;
private double basal;
private double increase;

Public Employee (string number, string name, double basal, double increase) {
This.setnumber (number);
This.setname (name);
This.setbasal (basal);
This.setincrease (Increase);
}

public void Setnumber (String number) {
This.number = number;
}


public void SetName (String name) {
THIS.name = name;
}


public void setbasal (double basal) {
This.basal = basal;
}


public void setincrease (double increase) {
This.increase = increase;
}


Public String GetNumber () {
return this.number;
}


Public String GetName () {
return this.name;
}


Public double getbasal () {
return this.basal;
}


Public double getincrease () {
return this.increase;
}


Public double salary () {
return basal * increase;
}
}

Third time Java job

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.