Create a balloon object with a name of your own choosing

Assignment Help JAVA Programming
Reference no: EM13970953

Programming Assignment

Creating Objects and Calling Accessor and Mutator Methods

I. The Assignment

This assignment is to write a "test" class (aka: a "driver" class or "client code") that uses the class Balloon.java, available on the class web page.

To use the Balloon class, download it and store it in the src folder of your NetBeans project. Make sure you save it as Balloon.java.

The best way to learn how to use the Balloon class - or any other Java class - is to consult the documentation, Balloon.html (online). You can also read the javadoc comments that appear just above the class declaration and above each method declaration, which explain what each method does, what the method's parameters are, and what value - if any - is returned by the method. The html "help" pages are generated from these comments.

Don't worry if you don't understand the code. It will all be covered later. It is not necessary to know how a method works as long as you know what it does and how to call it.

- Review declaring variables, creating objects, calling methods that return a value vs. "void" methods, and accessor and mutator methods before beginning.

To receive credit for this assignment, you must not modify the Balloon class in any way!

II. Your BalloonTester Class

Your BalloonTester class will have only a single method - main - and will perform each of the following operations, in the exact order listed below. Each operation may be done in one or two statements. Make sure you follow directions faithfully, and note that once you have done step 3, you can copy and paste it to do steps 6, 9, and 12.

1. Create a Balloon object with a name of your own choosing and an altitude of 100 meters.

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

3. Call the accessor methods of the Balloon class to get the name and altitude of each Balloon object. Print the data, one object per line.

4. Make the object you created in step 1 ascend to an altitude of 300 meters.

5. Call the adjustAltitude method to increase the altitude of the object you created in step 2 by 200 meters.

6. Call the accessor methods of the Balloon class to get the name and altitude of each object. Print the data, one object per line.

7. Call the adjustAltitude method to decrease the altitude of the object you created in step 1 by 150 meters.

8. Make the object you created in step 2 descend to the same altitude as the other object. You may assume that the other object is at a lower altitude.

To get credit for step 8., the statement(s) you write must always work, regardless of the actual altitude of the second object. It cannot depend on you knowing the altitude of the second object, but must utilize the fact that the object knows its own altitude. In other words, if you use a literal to set the altitude, it is not correct.

9. Call the accessor methods to get the name and altitude of each object. Print the data, one object per line.

10. Move the object you created in step 1 to an altitude that is three times its current altitude. As in step 8, the statement(s) you write must work for any altitude and may not depend on you "figuring out" the new altitude beforehand.

11. Attempt to move the object you created in step 2 to an altitude that is 200 meters below its current altitude.

12. Call the accessor methods to get the name and altitude of each object. Print the data, one object per line.

Reference no: EM13970953

Questions Cloud

Accepting the special order : Indicate the net income (loss) Harley would realize by accepting the special order.
Company budget for fixed advertising : To make up for the promotions that the independent sales agents had been running on behalf of Marston, management believes that the company's budget for fixed advertising expenses should be increased by $410,000.
Data needed to evaluate this capital investment project : What types of decisions need to be made when healthcare companies are getting ready to make an investment and indicate the main kinds of information/data needed to evaluate this capital investment project?
Arise during the investment decision making process : Consider a healthcare organization that you are familiar with and present one or two challenges that is likey to arise during the investment decision making process, as well as any possible solutions.
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.
Forecasted statements and ratios : Upton Computers makes bulk purchases of small computers, stocks them in conveniently located warehouses, ships them to its chain of retail stores, and has a staff to advise customers and help them set up their new computers. If sales are projected to..
Briefly describe the organization : In a 1-page submission, briefly describe the organization, and then design the voluntary, supplemental, and other benefits that you believe to be the best fit for this organization based on your understanding of its needs and financial abilities
What is its self-supporting growth rate : Maggie's Muffins, Inc., generated $2,000,000 in sales during 2013, and its year-end total assets were $1,300,000. Also, at year-end 2013, current liabilities were $1,000,000, consisting of $300,000 of notes payable, $500,000 of accounts payable, and ..
Problem regarding the tax return project : Based on the information provided, you are to complete the appropriate 2014 individual tax form and any supporting schedules/forms for Jonathan Hales.

Reviews

Write a Review

JAVA Programming Questions & Answers

  How many numbers do you want to enter

Write a program that asks the user "How many numbers do you want to enter?" With that value, create an array that is big enough to hold that amount of numbers (integers).

  Write java program which will permit user to make selection

Write the Java Program which will permit the user to make selection. You will present user with two options to perform, then you will perform action selected by user.

  Explain how to declare and manipulate data in arrays

Please respond to all of the following prompts: Explain how to declare and manipulate data in arrays. Explain the meaning of "array index out of bounds".

  Find the solution of all these java question

find the solution of all these java question

  Define get and set functions and two constructors

Create a class called Building. It will have one data member of type string (used for a postal address). Define get and set functions and two constructors.

  What purpose does the wbs serve

What purpose does the WBS serve? Describe the structure of a WBS. How does a WBS contribute to accurate estimates?

  Construct a bulls and cows program for my intro java class

construct a Bulls and Cows program for my intro Java class. This program needs to perform the basic functions of the game (determining how many cows there are and how many bulls there are and tell the player when they win), but it also needs to offer..

  Displays every perfect number from 1 through 1000

Write an application that displays every perfect number from 1 through 1000. A perfect number is one that equals the sum of all the numbers that divide evenly into it.

  Sorted list adt and the binary search tree adt

Explain the differences between our specifications of the Sorted List ADT and the Binary Search Tree ADT.

  Determine various currents and voltages

1. To troubleshoot a complex circuit and determine various currents and voltages using mesh analysis. 2. To simulate the complex circuit in MultiSim and record the required quantities.

  Java program that will add the corresponding elements

Develop a Java program that will add the corresponding elements of two 1-dimensional arrays X and Y to produce the 1-dimensional array Z. Arrays X, Y, Z have the same dimension [M].

  Briefly explain the code in sort inventory

Draw a UML diagram of the Shoe class using the code that has been provided - Briefly explain the code in sort Inventory. What is the inventory being sorted by? What is the sort algorithm that is being used. Explain in words how it works. Why do you..

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