Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved 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

only need task3 answer image text in transcribed
image text in transcribed
image text in transcribed
image text in transcribed
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

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Transactions On Large Scale Data And Knowledge Centered Systems Xxviii Special Issue On Database And Expert Systems Applications Lncs 9940

Authors: Abdelkader Hameurlain ,Josef Kung ,Roland Wagner ,Qimin Chen

1st Edition

3662534541, 978-3662534540

More Books

Students also viewed these Databases questions

Question

Perception in a Diverse World Cognition: Perceiving Ourselves

Answered: 1 week ago