Question: only need task3 answer Aims and Objectives This laboratory has been designed to help you o learn how to define classes which are instantiated in

only need task3 answer  only need task3 answer Aims and Objectives This laboratory has been
designed to help you o learn how to define classes which are
instantiated in the main method of an application; gain further practice with
defining methods which are only used within a class (object) and those

Aims and Objectives This laboratory has been designed to help you o learn how to define classes which are instantiated in the main method of an application; gain further practice with defining methods which are only used within a class (object) and those which are intended to be invoked using an object reference. Getting Started Create a directory called prac4 (in your cpl directory) and make it your current working directory. All programs will be created from scratch and so there are no files to copy. Start jGrasp and be prepared to write complete class definitions. The program will contain "boat" objects. Task 1 On completion of this task you will have demonstrated the ability to construct a simple class definition containing instance variables and methods, and a class containing only a main method which creates an instance of a class (an object) and accesses instance variables, and invokes methods, through a reference to the object Use jGrasp to create a new file called BoatMaker_16.java containing two class definitions 1. Boat this class contains: i. an instance variable, regNum, of type int initialised to -1 ii. an instance variable, bClass, of type String initialised to "unknown" ii. an instance variable name of type String which is initialised to "unknown" iv. a method print which does not return a value (i.e. the return type is void), has no formal parameters and prints the boat's name, class and registration number. in the following format Boat name, Class-bClass, Registration #--KA rgNum where the words in italics should be replaced with the values of the corresponding instance variables. 2. BoatMaker 16 - this class should contain a main method which performs the following actions

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 Databases Questions!