Ask a Question(Create a thread) |
|
Java applicationTalk about anything here, just keep it clean. |
![]() |
|
Thread Tools |
Get rid of these ads by registering for a free Tomísimo account.
|
#2
|
||||
|
||||
Quote:
|
#3
|
||||
|
||||
Quote:
I won't do your homework for you, of course, but I'm happy to give you some pointers. You're right, what you've written doesn't do the job. You have a LOT of syntax (grammar) errors in your code. Quote:
a. Your class should contain the main() function. All of your code should be inside your main() function; that is, between the '{' that follows the declaration of main() and the '}' that ends the function body. The main() function itself should be the only thing inside the body of your class (that is, inside the sequence of '{' and '}' that mark the beginning and end of the body of the class). b. Each numbered instruction tells you what statement (or group of statements) should come next inside your main() function. Reviewing your instructions: The Application: Write a simple class called PointChecker that will 1) Declare a variable as a Point (What does a variable declaration look like? How do you define a variable that holds a value whose type is the class Point?) 2) Using the constructor that has two double parameters construct a point at location 93,67 (What does the constructor look like? How do you create a variable for the class Point?) 3) Using the methods getX and getY and the System.out.print and println methods output the actual values that the created point contains (The class Point defines the methods getX and getY. You invoke those functions by using a variable whose value is an instance of the class Point. What does that look like?) 4) The output the expected values (what you expect to see) (The package 'system.out' provides the methods 'system.out.print' and 'system.out.println'. They print the arguments that are inside the parentheses. The arguments may be literal constants, or they may be the names of variables. What do literal constants look like? What do variable names look like?) 5) Then using the translate method move the x coordinate 13 to the left (negative) and the Y value 7 down (positive). (The class Point also implements a method called translate. You invoke it by using a variable whose value is an instance of the class Point. The method has 2 arguments: the amount to add to the X axis, and the amount to add to the Y axis. The values to add may be positive, negative or zero. Invoking the method adds the specified values to the corresponding X and Y property values.) 6) Output values as described in steps 3 and 4 (Repeat the same type of code you used in steps 3 and 4 in order to write out the new (translated) coordinate values of the variable of type class Point against which you invoked the translate function in step 5.) Let us know whether any of this helps. Last edited by wrholt; January 17, 2013 at 10:45 PM. |
#4
|
||||
|
||||
Quote:
PS You might want to Code:
import java.awt.Point; ** java.io.PrintStream Last edited by pjt33; January 18, 2013 at 01:27 AM. |
#5
|
||||
|
||||
Quote:
I noticed that the first line of code in Jessica's program is: Code:
package course.jzc22.lab01; |
![]() |
Link to this thread | |
|
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
Application? | workingmom20 | Idioms & Sayings | 2 | September 03, 2008 11:21 PM |