Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Help with java program! implement a class name cPointType.java. A cPointType has

ID: 3813038 • Letter: H

Question

Help with java program!

implement a class name cPointType.java. A cPointType has a label and missing x, y values (doubles). It provides the methods to set each of the coordinates (g…[] initial value), change the each(increasing or decreasing the position by some value), to a current value, to get the label value and to return the label value of the or second constructor that allows for setting the label and position on instan…([]) cPrintType has a toString method that returns the cPointType as label(x,y)

When I received this question, some of the words were cut off, so I am undressing them as []

Explanation / Answer

Capitalisation of key words

Since you get into the habit of writing class names in capital letters you will occasionally find yourself writing keywords such as class andint with a capital beginning letter. The compiler will object to this and will issue an error message which depends on which keyword was capitalised. The compiler will issue an error message such as:

Line nn: class or interface declaration expected when, for example, you capitalise the keyword class.

Writing a string over a new line

Sometimes you will need to write a long string. A common error is to have a new line embedded in the string. The compiler will object to this and will issue an error message such as:

Line nn: ';' expected
When this happens the solution is to split the string into two, making sure that neither string has a new line in it, and concatenate them with +. Thus you might replace:

String s = "A very long string which just happens to go over the end of a line and causes a problem with the compiler";with:

String s = "A very long string which just happens to go over the end "+"of a line and causes a problem with the compiler"
Missing brackets in a no-argument message

When you use a method which has no arguments you should place brackets after the name of the method. For example, if you have declared a method carryOut with no arguments and you want to send a message corresponding to the method to the object objSend then you should code this as:

objSend.carryOut()
rather than:

objSend.carryOut
The compiler will usually emit an error message of the form:

Line nn: Invalid expression statement

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote