| 本帖最后由 buttonzhu 于 2012-5-8 15:00 编辑 
 Buddy, help u modify a bit, good luck :). The code is written in Java and has not been compiled/tested yet.
 
 class Info{
 String Gender;
 String Occupation;
 String Height;
 String Look;
 String Description;
 
 }
 
 import java.io.* ;
 
 public class PersonalInfo extends Info{
 
 String Gender;
 String Occupation;
 String Height;
 String Look;
 public PersonalInfo(String Gender, String Occupation, String Height, String Look, String Description){
 this.Gender = Gender;
 this.Occupation = Occupation;
 this.Height = Height;
 this.Look = Look;
 this.Description = Description;
 }
 
 void LookingFor(String Gender, double Weight, String Description){
 if(Gender.equals("女"){
 if(weight > 50 && Weight <65) && Description.StringSimilarity("能毕业后相互加分的更好"){
 System.out.println("Please add My QQ:" + "549274828");
 
 }else{
 System.out.println("No, maybe next time");
 
 }
 }else{
 System.out.println("No, I am looking for a girl.");
 }
 
 }
 
 void myInfo(){
 System.out.println("My gender is:" + Gender);
 System.out.println("My occupation is:" + Occupation);
 System.out.println("My height is:" + Height);
 System.out.println("My look is:" + Look);
 }
 
 }
 
 public class MainBoard{
 
 public static void main(String[] args){
 
 PersonalInfo pi = new PersonalInfo("男","UQ student 软件工程","177cm", "五官端正");
 InputStreamReader istream = new InputStreamReader(System.in) ;
 BufferedReader bufRead = new BufferedReader(istream) ;
 
 
 try {
 pi.myInfo();
 System.out.println("Please input your gender: ");
 String gender= bufRead.readLine();
 
 System.out.println("Please Enter your weight: ");
 double weight = bufRead.readLine();
 
 System.out.println("Please Enter your prefer: ");
 String description = bufRead.readLine();
 
 pi.Lookingfor(gender, weight, description);
 
 
 }
 catch (IOException err) {
 System.out.println("Error reading line");
 }
 catch(NumberFormatException err) {
 System.out.println("Error Converting Number");
 }
 
 }
 
 
 }
 |