Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Write a Java class definition for an Airplane. The Airlplane class should have the following data members: airplane_type: String Curent-speed: double max speed: double implement

Write a Java class definition for an Airplane. The Airlplane class should have the following data members:

airplane_type: String

Curent-speed:

double max speed:

double implement non-default constructor, do not implement the getters and setters, unless it is necessary for the solution. Make sure your solution does not violate the encapsulation concept.

The set current speed function (given below) has the potential of generating an exception of type llegalAgumentException add the necessary code in order to make your class definition more robust and achieve data validation. void set current_speed( double cur speed in)

{

current_speed =cur_speed _in

}

You have given a file called "airplane.dat' sample data is given below. Writea Driver class that reads the data form the file, then instantiates Airplane objects and add them to an Array list. Based on your answer to previous parts of the question. write your code to illustrate Java exceptionhandling mechanism. Sample file:

image text in transcribed

to illustrate Java exception handling chanism. ple file: Type Max Speed Current Speed 1000 850 1200 900 Boeing 775 Airbus_338

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

Microsoft Visual Basic 2008 Comprehensive Concepts And Techniques

Authors: Gary B. Shelly, Corinne Hoisington

1st Edition

1423927168, 978-1423927167

More Books

Students also viewed these Databases questions