Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

task5 thank you Aims and Objectives This laboratory has been designed to help you e learn how to define classes which are instantiated in the

task5 thank you image text in transcribed
image text in transcribed
image text in transcribed
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 e 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 reterence. Getting Started Create a directory called prac4 (in your cpl directory) and make it your current working directory All programs wil 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" iii. 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 #-KAregNum 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

Machine Learning And Knowledge Discovery In Databases European Conference Ecml Pkdd 2019 Wurzburg Germany September 16 20 2019 Proceedings Part 2 Lnai 11907

Authors: Ulf Brefeld ,Elisa Fromont ,Andreas Hotho ,Arno Knobbe ,Marloes Maathuis ,Celine Robardet

1st Edition

3030461467, 978-3030461461

More Books

Students also viewed these Databases questions

Question

List three design goals for a firewall.

Answered: 1 week ago

Question

What is group replacement? Explain with an example. (2-3 lines)

Answered: 1 week ago