Java application that defines a class boat

Assignment Help JAVA Programming
Reference no: EM131585585

This is about a Java application that defines a class Boat. The Boat class should provide three fields/attributes:

1) name is a variable of type String,

2) sail position is a variable of type boolean,

3) speed is a variable of type float.

The Boat class must define a constructor and three methods: goFast, goSlow, whereIsTheSail.

goFast sets the position of the sail to true and increase the speed of the boat by 10 mph and prints the following text (BlueSea is the boat name):

BlueSea is raising the sail at the speed of 10 mph.

goSlow sets the position of the sail to false and decreases the speed of the boat by 5 mph and prints the following text:

BlueSea is lowering the sail at the speed of 5 mph.

whereIsTheSail prints the name of the boat and "sail is up" or "sail is down" depending on the sail position:

BlueSea sail is up.

Note: The boat speed should not exceed 100 mph (max speed is 100 mph) and cannot go below 0 mph.

Start out by writing a Java class Boat. Provide the methods described above. Create the main class (call it SimpleBoatMain) with a static main method (example provided below). Inside the main method we need a new instance of class Boat and then invoke the proper methods as shown below:


public class SimpleBoatApp {

public static void main (String[] args) {

Boat simpleBoat = new Boat("Destinty");

simpleBoat.goFast();

simpleBoat.goSlow();

simpleBoat.whereIsTheSail();

simpleBoat.goFast();

simpleBoat.whereIsTheSail();

simpleBoat.goFast();

}

}

Reference no: EM131585585

Questions Cloud

How many nodes are left in the tree of partial solutions : How many different binary search trees can be made with three pieces of data? What about with four pieces of data?
Problem related to edge crossing : Try to draw K4 twice, once with at least two edges crossing and once with no edges crossing. Can you do it?
Drawing on the information : Drawing on the information we covered this semester what would you tell her?
Define sociocultural theory in your own words : Individuals do not exist in a vacuum. We are constantly influenced by our surroundings which shape our attitudes, character, and identity.
Java application that defines a class boat : Java application that defines a class Boat - Provide the methods described above. Create the main class - Inside the main method we need a new instance of class
List the four guidelines for good form design : List the four guidelines for good form design. What is a specialty form? What are some disadvantages of using specialty forms? What are dynamic Web pages?
Explain about career prospects in the health care field : If a young person asked you about career prospects in the health care field, what answer would you give? What profession or specialty would you recommend?
Write a method named swapall : Write a method named swapAll that accepts two arrays of integers as parameters and swaps their entire contents
Position of the displaced whirlpool employees : What are the arguments supporting the position of the displaced whirlpool employees?

Reviews

Write a Review

JAVA Programming Questions & Answers

  Provide the class declaration for three of the classes

MN404 Fundamentals of Operating Systems and Java Programming Assessment. Provide the class declaration for three of the classes

  Consider a class that could be used to play a game of

consider a class that could be used to play a game of hangman. the class has the following attributesthe secret wordthe

  Advance programming hi i want two copies of the assignment

hi ltbrgti want two copies of the assignment me and my friend are doing same assignment. ltbrgtwe need both the

  Write a class house that correctly compiles and runs

Write a class House that correctly compiles and runs with the following TestHouse code. You cannot change a single thing in the TestHouse class,

  A uml activity diagram that illustrates how program works

Create a UML activity diagram that illustrates how your program works. Your diagram must include all the data items in your program.

  Describe the differences between relative and linear layouts

Describe the differences between relative and linear layouts. Why are .png files the preferred type of image resource for the Android device? Write a paragraph that gives at least three reasons.

  Create a balloon object with a name of your own choosing

Create a Balloon object with a name of your own choosing and an altitude of 100 meters. Create a second Balloon object with a name of your own choosing, and specify an initial altitude of -100 meters.

  Develop auto inventory system which contains functionality

You will develop a simple auto inventory system which contains the following basic functionality: Read the supplied autoInventory.txt file to obtain the auto inventory with the file path supplied as the first run-time parameter.

  Define inventory program assignment from java class

This is part 6 of the inventory program assignment from Java class IT 215 from UOP and all the codes are written well and includes everything all the functionality from the previous parts and there's absolutely no errors.

  Find the errors in the code

You may assume that the following statements precede those in the table below:

  Modify the java application using java netbeans ide

Modify the Java application using Java NetBeans IDE to meet these additional and changed business requirements. The application will now compare the total annual compensation of at least two salespersons.

  Data structures and algorithms

Code analysis and programming.

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd