ladyJava's Profile User Rating: -----

Reputation: 3 Apprentice
Group:
Members
Active Posts:
21 (0.04 per day)
Joined:
24-January 13
Profile Views:
761
Last Active:
User is offline Apr 16 2013 10:59 AM
Currently:
Offline

Previous Fields

Dream Kudos:
0
Icon   ladyJava has not set their status

Posts I've Made

  1. In Topic: Beginners Problem.(Cannot be resolved

    Posted 9 Apr 2013

    View PostGregBrannon, on 09 April 2013 - 11:35 AM, said:

    The two files you posted are in different packages, complicating things a bit. Is there a requirement to do it that way? If not, put them both in the same package and try again.



    These were my instructions:

    To Do
    1. Create an Eclipse workspace named c:\temp\YourNamePair.
    2. Create project pair.
    3. Create package edu.westga.pair.model in the src folder.
    4. Create class Pair in the new package.
    5. Create package edu.westga.pair.controller in the src folder.
    6. Create class PairTester in the new controller package. Donít create a main method.
    7. Create class PairDriver in the controller package. It should have a main method.
    8. Implement Pair and PairTester as described in exercise P4.4 in the chapter 4
    programming exercises of the text.
  2. In Topic: Beginners Problem.(Cannot be resolved

    Posted 9 Apr 2013

    View Postmodi123_1, on 09 April 2013 - 09:57 AM, said:

    Create an instance of the object "Pair" in your "PairTester". Feed it the values.. get the output.

    Just like how you created instances of the object "int" ( public int someNumber;) you would do the same, but instead of 'int' you would use 'Pair'.


    It now says that Pair is not a type.

     package edu.westga.pair.controller;
    
    public class PairTester {
    	
    	public int someNumber;
    	public int someNumber2;
    	public Pair sum;
    
  3. In Topic: Help with errors and questions

    Posted 19 Feb 2013

    CasiOo

    Did I tell you, you are a really big help. Thanks so much. :winkiss:/>/>
    package edu.westga.rhombus.controller;
    
    import java.awt.geom.Point2D;
    
    public class TestDriver {
    	
    	public static void main(String[] args)
    	{
    		Point2D.Double point= new Point2D.Double(10,10);
    		 
    	RhombusTester tester = new RhombusTester(point);
    	tester.testRhombus(); 
    	}
    
    }
    
    


    Its not giving me errors. When I run them though, it gives me 4.0, the x value from class Rhombus Tester and not class Test Driver, Is it something im doing wrong?
  4. In Topic: Help with errors and questions

    Posted 19 Feb 2013

    View PostCasiOo, on 18 February 2013 - 09:29 PM, said:

    View PostladyJava, on 19 February 2013 - 04:23 AM, said:

    I should declare my instance variable in the constructor with actual double values right? Would using (this. )without assigning value work?

    You do not declare instance variables in the constructor, that would make them local variables and not instance variables
    I don't really understand your question
    The keyword 'this' is referring to the current object/instance. You can read more about it here


    Im sorry, I knew that I just worded my question incorrectly.
    I changed my code around , only still having one problem

    package edu.westga.rhombus.controller;
    
    import java.awt.geom.Point2D;
    
    public class TestDriver {
    	
    	public static void main(String[] args)
    	{
    		Point2D TestRhombus;
    		 
    		TestRhombus = new Point2D.Double(4.0,6.5);
    	TestRhombus.testRhombus(); // Im having a problem, its saying that this method is undefined
    									//for the type 2D
    	}
    
    }
    
    


    So from the understanding of the error, its saying that my method testRhombus is undefined for Point2D. So I looked at my code for that method.

    package edu.westga.rhombus.controller;
    
    import java.awt.geom.Point2D;
    
    public class RhombusTester {
    
    		Point2D topPoint;
    		Double topPointX;
    	public RhombusTester(Point2D aDouble)
    	{
    		topPoint= new Point2D.Double(4.0,6.5);
    	}
    	//The instructions for this :
    //1. Implement method testRhombus, a void method with no parameters, and the 
    //instance variable it needs to do its job.
    //In the methodís body, display the expected and actual x, y values of the top point of the 
    //rhombus.
    //- Note: class Point2D.Double defines accessor methods getX and getY.
    	public void testRhombus(Point2D point)
    	{
    		System.out.println("The Expected Value of the top point is");
    		topPointX=this.topPoint.getX();// 
    		//this.topPoint.getY();
    		 System.out.println(topPoint.getX());
    		
    		
    	}
    }
    
    


    I just cant get my TestDriver class working because of the testRhombus method above.. :helpsmilie:
  5. In Topic: Help with errors and questions

    Posted 18 Feb 2013

    View PostCasiOo, on 18 February 2013 - 08:54 PM, said:

    Quote

    Obviously Point2D.Double is not a type because when I tried to declare topPoint with type Point2D.Double it says its not a type. But to my instructor it is.

    Not true. If you read the docs (you linked to it) you will see that it's a class
    public class Rhombus {
    	Point2D.Double topPoint;
    	double hLength;
    	double vLength;
    	
    	
    	public Rhombus(Point2D.Double topPoint, double hLength, double vLength) {
    		this.topPoint = topPoint;
    		this.hLength = hLength;
    		this.vLength = vLength;
    	}
    
    	public Point2D.Double getTopPoint() {
    		return topPoint;
    	}
    }
    
    

    You might need to import the class
    import java.awt.geom.Point2D;
    
    


    I should declare my instance variable in the constructor with actual double values right? Would using (this. )without assigning value work?

My Information

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

Contact Information

E-mail:
Click here to e-mail me

Friends

Comments

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