Question: 1.In Java we make a clear distinction between class and object. What is a class and what is an object in Java (i.e. from a

1.In Java we make a clear distinction between class and object. What is a class and what is an object in Java (i.e. from a source code point of view)? What is another term for an "object" in Java?

2.Explain, using an example, the principle of "information hiding"

3.Why are attributes in Java made private?

4.What is the main difference between an accessor method and a mutator method?

5.What is a parameter?

6.What is the purpose of a constructor in Java? How does the syntax of a constructor differ from other methods?

7.Can we have 2 or more constructors in one Java class? Give an example of a situation when we would need more than one constructor?

8.Implement the class Square (see previous tutorial for the UML class diagram) in Java.

9.Implement this class diagram for a Circle in Java (check theWikipediafor help with the formulae).

10.The Circle class is not a "program" : it cannot run without another file with a main method. Create a driver file that implements this pseudocode. Note well: this file should have only two variables: one for radius, and one for the circle object (do not have variables for area and radius)

CircleDriver

Prompt and Get radius

Create a circle with radius

Display circle's area

Display circle's circumferenceEND

Revision

13.Correct the syntax (or likely logical) errors in the following Java program. For each error, carefully note the error message and the fix

/* Display my name on the screenpublic Class question4 ;{static void main(string args)

/* Display my name */

System.Out.println("Lim Kok Wing.);System. out.println("************ '):

} / end of main method

14.Explain each of these terms

a.variable declaration

b.initialisation

c.assignment

15.Why do we use pseudocode and the other design techniques of creating identifier lists & defining diagrams?

17.A program is required to get the length and width of a rectangular block, and then the length and width of a rectangular house on that block. The total mowing time to cut the grass (the ground all around the house is covered by grass) is then calculated and displayed, where is mowing is at the rate of 2 square metres per minute. For the following algorithm

a.create 2 test sets (inputs and expected outputs)

b.desk check itthoroughly

c.verify the actual results against expected results

Calculate_mowing_time

Prompt for blockLength, blockWidthGet blockLength, blockWidthblockArea = blockLength * blockWidth

Prompt for houseLength, houseWidthGet houseLength, houseWidthhouseArea = blockLength * blockWidth

mowingArea = houseArea - blockAreamowingTime = mowingArea / 2

Display mowingTime

END

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!