Question: write java programme : A hydrofoil is a lifting surface, or foil, that operates in water. They are similar in appearance and purpose to airfoils

write java programme : A hydrofoil is a lifting surface, or foil, that operates in water. They are similar in appearance and purpose to airfoils used by airplanes. Boats that use hydrofoil technology are also simply termed hydrofoils. As a hydrofoil craft gains speed, the hydrofoils lift the boat's hull out of the water, decreasing drag and allowing greater speeds. Write a class named hydrofoils that has the following fields.

MANUFACTURER The manufacturer field references a String object that holds the manufacturer of the hydrofoil. NAME The name field references a String object that holds the name of the hydrofoil. YEAR_MADE The year_made field is an int that holds the manufacturing year when the hydrofoils were made. SPEED The speed field is an int that holds the current speed of the hydrofoil. In addition, the class should have the following constructor and other methods.

Constructor The constructor should accept the hydrofoils manufacturer, name, year made and initial speed as arguments. These values should be assigned to the objects manufacturer, name, and year_made fields. The constructor should also assign a chosen initial speed to the speed field. Accessors and Mutators Appropriate accessor and mutator methods should get and set the values stored in an objects manufacturer, name, year_made and speed fields. The accelerate method The accelerate method should add 10 to the speed field each time it is called. The decelerate method The decelerate method should subtract 5 from the speed field each time it is called. The checklift method The checklift check the current speed of the hydrofoil to determine whether the hull is in the water or lifted out of the water.

Demonstrate the class in a program that creates these two hydrofoil objects:

1. Name: Freedom

Manufacturer: Lockheed

Year Made: 2008

Initial Speed (knots): the 1st and 3rd digit of your Matric Number. ( take 1 and 2 )

2. Name: Independence

Manufacturer: General Dynamics

Year Made: 2010

Initial Speed (knots): the sum of the 4th and 6th digit of your Matric Number. (take 4)

** if your matric number is 1715946, then the Initial Speed for Freedom is 2 & for Independence is 9.

Once the hydrofoils are created display their details and then call the accelerate method five times for each object. After each call to the accelerate method, get the current speed of the hydrofoils, and display it. Then call the decelerate method five times. After each call to the decelerate method, get the current speed of the hydrofoil, and display it. At the end of the test run, determine whether the hydrofoil hull is in the water of lifted above it. Assume that the minimum speed to lift the boat's hull out of the water is at least 30 knots.

sample run :

write java programme : A hydrofoil is a lifting surface, or foil,

Enter the number of suitecases: 3 Enter the dimensions of the suitcase 1 (length and width and height) 12 10 6 Enter the dimensions of the suitcase 2 (length and width and height) 17 16 13 Enter the dimensions of the suitcase 3 (length and width and height) 16 18 2 Carton 1 contains objects with volume 720 576 Carton 2 contains objects with volume 3536 The total charges are 625.0

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!