admjhosef's Profile User Rating: -----

Reputation: -1 Dishonored
Group:
Members
Active Posts:
42 (0.03 per day)
Joined:
02-October 10
Profile Views:
1,509
Last Active:
User is offline Oct 05 2013 09:20 AM
Currently:
Offline

Previous Fields

Dream Kudos:
0
Icon   admjhosef has not set their status

Posts I've Made

  1. In Topic: converting boolean to string and about my output

    Posted 1 Oct 2013

    @schutzz

    Thanks It Already Solve :)
  2. In Topic: converting boolean to string and about my output

    Posted 1 Oct 2013

    Here is my Updated Code

    /*
     * To change this template, choose Tools | Templates
     * and open the template in the editor.
     */
    package testpersons;
    
    /**
     *
     * @author Admin Joseph
     */
    public class TestPersons {
    
        /**
         * @param args the command line arguments
         */ 
        public static void main(String[] args) {
            // TODO code application logic here
            
            String Person1 = "Jose/9-7-1979"; 
            String Result[] = Person1.split("/");
            String Dates[] = Result[1].split("-");
            MyDate d = new MyDate(Integer.parseInt(Dates[0]),Integer.parseInt(Dates[1]),Integer.parseInt(Dates[2]));
            
            String Person2 = "Jose/9-7-1989";
            String Results[] = Person2.split("/");
            String Dated[] = Results[1].split("-");
            MyDate e = new MyDate(Integer.parseInt(Dated[0]),Integer.parseInt(Dated[1]),Integer.parseInt(Dated[2]));
            
            Person p1 = new Person(Result[0], d);
            Person p2 = new Person(Results[0], e);
            
            
            
            
            
            System.out.println(p1.equals(p2));
    	//System.out.println(p1.equals(p2));
            
    	//System.out.println(p1.hashCode());
    	//System.out.println(p2.hashCode());
            
            System.out.println(p1);
    	System.out.println(p2.toString());
            
        }
    
        
    }
    
    


    /*
     * To change this template, choose Tools | Templates
     * and open the template in the editor.
     */
    package testpersons;
    
    //import java.util.Date;
    
    /**
     *
     * @author Admin Joseph
     */
    public class Person
    {
        private String name;
        private MyDate DoB;
        
        public Person(String name, MyDate DoB)
        {
            this.name = name;
            this.DoB = DoB;
        }
        public String getName()
        {
            return name;
        }
        public MyDate getDoB()
        {
            return DoB;
        }
        
        
        public boolean equals(Object o)
        {
                    
            	boolean result = true;
    		if (o != null || o instanceof Person)
    		{
    			Person p = (Person)o;
    			if (this.getName().equals(p.getName())
                                  && this.DoB.equals(p.DoB)) {
                              System.out.println("Identical");
                              //result = true;
                        } else {
                            System.out.println("Not Identical");
                        }
    		
    		}   
    		return result;
        }
        
        public int hashCode()
        {
            return  getName().hashCode() ^ getDoB().hashCode();
            //return getName().hashCode() ^ getAge();
        }
        
        public String toString()
        {
            return getName() + "\nDate of Birth:" + getDoB(); 
        }
    }
    
    


    /*
     * To change this template, choose Tools | Templates
     * and open the template in the editor.
     */
    package testpersons;
    
    /**
     *
     * @author Admin Joseph
     */
    public class MyDate extends Object
    {
        //String Result[] = 
        private int day, month, year;
        
        public MyDate(int day, int month, int year)
        {
            this.day = day;
            this.month = month;
            this.year = year;
        }
        public int getDay()
        {
            return day;
        }
        public int getMonth()
        {
            return month;
        }
        public int getYear()
        {
            return year;
        }
        
        public boolean equals(Object o)
        {
                     
            	boolean result = true;
                    
    		if (o != null && o instanceof MyDate)
    		{
    			MyDate p = (MyDate)o;
    			if (this.day == p.getDay()
                                    && this.month == p.getMonth()
                                    && this.year == p.getYear()) {
                                System.out.println("Identical");
                                //result = true;
                         } else {
                            System.out.println("Not Identical");
                        } 
    		}
    		return result;
    
        }
        
        public int hashCode()
        {
            return  getYear() ^ getDay() ^ getMonth();
            //return getName().hashCode() ^ getAge();
        }
        
        public String toString()
        {
            return getMonth() + "-" + getDay() + "-" + getYear();
        }
    }
    
    



    The Output is

    Not Identical
    Identical
    true
    Jose
    Date of Birth:7-9-1979
    Jose
    Date of Birth:7-9-1989

    But the Output must be

    Not Identical
    Jose
    Date of Birth:7-9-1979
    Jose
    Date of Birth:7-9-1989
  3. In Topic: converting boolean to string and about my output

    Posted 1 Oct 2013

    @ryano121

    yes i already Edit that

    but its thee Same
  4. In Topic: converting boolean to string and about my output

    Posted 1 Oct 2013

    @ryano

    its working the Converting the Boolean to String

    thanks


    @all

    my 2nd problem is the output :(

    when the Output

    false
    Joseph
    Date of Birth:7-9-1989
    Joseph
    Date of Birth:7-9-1989

    this output must be

    true
    Joseph
    Date of Birth:7-9-1989
    Joseph
    Date of Birth:7-9-1989
  5. In Topic: I cannot Convert my String to MyDate

    Posted 1 Oct 2013

    @goose

    Thanks for answering ... but i have the second Problem

    this is my New Code Now

    public class TestPersons {
    
        /**
         * @param args the command line arguments
         */ 
        public static void main(String[] args) {
            // TODO code application logic here
            
            String Person1 = "Joseph/9-7-1989"; 
            String Result[] = Person1.split("/");
            String Dates[] = Result[1].split("-");
            MyDate d = new MyDate(Integer.parseInt(Dates[0]),Integer.parseInt(Dates[1]),Integer.parseInt(Dates[2]));
            
            String Person2 = "Joseph/9-7-1989";
            String Results[] = Person2.split("/");
            String Dated[] = Results[1].split("-");
            MyDate e = new MyDate(Integer.parseInt(Dated[0]),Integer.parseInt(Dated[1]),Integer.parseInt(Dated[2]));
            
            Person p1 = new Person(Result[0], d);
            Person p2 = new Person(Results[0], e);
            
            
            
            
            
            System.out.println(p1 == p2);
    
            
            System.out.println(p1);
    	System.out.println(p2.toString());
            
        }
    
        
    }
    
    


    /*
     * To change this template, choose Tools | Templates
     * and open the template in the editor.
     */
    package testpersons;
    
    //import java.util.Date;
    
    /**
     *
     * @author Admin Joseph
     */
    public class Person extends Object
    {
        private String name;
        private MyDate DoB;
        
        public Person(String name, MyDate DoB)
        {
            this.name = name;
            this.DoB = DoB;
        }
        public String getName()
        {
            return name;
        }
        public MyDate getDoB()
        {
            return DoB;
        }
        
        
        public boolean equals(Object o)
        {
                    String r1 = "NOT IDENTICAL";
                    String r2 = "IDENTICAL";
            	boolean result = Boolean.valueOf(r1);
                    
    
    		if (o != null && o instanceof Person)
    		{
    			Person p = (Person)o;
    			if (this.getName().equals(p.getName())
                                  && this.DoB == p.DoB);
    			{
    				result = Boolean.valueOf(r2);
                                    
    			}
    		}
    		return result;
        }
        
        public int hashCode()
        {
            return  getName().hashCode() ^ getDoB().hashCode();
            //return getName().hashCode() ^ getAge();
        }
        
        public String toString()
        {
            return getName() + "\nDate of Birth:" + getDoB(); 
        }
    }
    
    
    


    /*
     * To change this template, choose Tools | Templates
     * and open the template in the editor.
     */
    package testpersons;
    
    /**
     *
     * @author Admin Joseph
     */
    public class MyDate extends Object
    {
        //String Result[] = 
        private int day, month, year;
        
        public MyDate(int day, int month, int year)
        {
            this.day = day;
            this.month = month;
            this.year = year;
        }
        public int getDay()
        {
            return day;
        }
        public int getMonth()
        {
            return month;
        }
        public int getYear()
        {
            return year;
        }
        
        public boolean equals(Object o)
        {
         
            	boolean result = false;
                    
    		if (o != null && o instanceof MyDate)
    		{
    			MyDate p = (MyDate)o;
    			if (this.getDay() == p.getDay() 
    		 	 && this.getMonth() == p.getMonth()
                              && this.getYear() == p.getYear());
    			{
    				result = true;
                                    
    			}
    		}
    		return result;
    
        }
        
        public int hashCode()
        {
            return  getYear() ^ getDay() ^ getMonth();
            //return getName().hashCode() ^ getAge();
        }
        
        public String toString()
        {
            return getMonth() + "-" + getDay() + "-" + getYear();
        }
    }
    
    
    



    when the Output

    false
    Joseph
    Date of Birth:7-9-1989
    Joseph
    Date of Birth:7-9-1989

    this output must be

    true
    Joseph
    Date of Birth:7-9-1989
    Joseph
    Date of Birth:7-9-1989



    and how to convert the boolean to string because i must said in the output must be

    True is become Identical
    False is become Not Identical


    Thanks you Very Much for answering my quest

My Information

Member Title:
New D.I.C Head
Age:
Age Unknown
Birthday:
Birthday Unknown
Gender:

Contact Information

E-mail:
Private

Friends

Comments

admjhosef has no profile comments yet. Why not say hello?