Welcome to the Java Programming Forums


The professional, friendly Java community. 21,500 members and growing!


The Java Programming Forums are a community of Java programmers from all around the World. Our members have a wide range of skills and they all have one thing in common: A passion to learn and code Java. We invite beginner Java programmers right through to Java professionals to post here and share your knowledge. Become a part of the community, help others, expand your knowledge of Java and enjoy talking with like minded people. Registration is quick and best of all free. We look forward to meeting you.


>> REGISTER NOW TO START POSTING


Members have full access to the forums. Advertisements are removed for registered users.

Results 1 to 13 of 13

Thread: java balloon project

  1. #1
    Junior Member
    Join Date
    Sep 2013
    Posts
    5
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default java balloon project

    hello need help writing this program
    don't really know where to begin

    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, for that matter - is to consult the documentation, Balloon.html (online). You can also read the javadoc comments that appear just above the class heading and above each method heading, 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 if 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 250 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 100 meters.

    8. Make the object you created in step 2 descend to the same altitude as the other object.

    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 in any way to set the altitude, it is not correct.

    9. Call the accessor methods of the Balloon class 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 of the Balloon class to get the name and altitude of each object. Print the data, one object per line.


  2. #2
    Junior Member
    Join Date
    Sep 2013
    Posts
    5
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default need help with assignment..dont knowwhere to start

    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, for that matter - is to consult the documentation, Balloon.html (online). You can also read the javadoc comments that appear just above the class heading and above each method heading, 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 if 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 250 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 100 meters.

    8. Make the object you created in step 2 descend to the same altitude as the other object.

    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 in any way to set the altitude, it is not correct.

    9. Call the accessor methods of the Balloon class 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 of the Balloon class to get the name and altitude of each object. Print the data, one object per line.

  3. #3
    Super Moderator
    Join Date
    Jun 2013
    Location
    So. Maryland, USA
    Posts
    3,446
    My Mood
    Mellow
    Thanks
    86
    Thanked 476 Times in 467 Posts

    Default Re: need help with assignment..dont knowwhere to start

    Please don't post the same topic multiple times.

    Waddya mean you don't know where to start? It tells you exactly where to start and what to do step by step. What don't you understand?

  4. #4
    Super Moderator
    Join Date
    Jun 2013
    Location
    So. Maryland, USA
    Posts
    3,446
    My Mood
    Mellow
    Thanks
    86
    Thanked 476 Times in 467 Posts

    Default Re: java balloon project


  5. The Following User Says Thank You to GregBrannon For This Useful Post:

    jps (September 19th, 2013)

  6. #5
    Junior Member
    Join Date
    Sep 2013
    Posts
    5
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Re: need help with assignment..dont knowwhere to start

    how do I create the balloon. I am new to this site as well as programming apologize for duplicate post. also not sure how to set up the main class

  7. #6
    Grand Poobah
    Join Date
    Mar 2011
    Posts
    1,465
    My Mood
    Grumpy
    Thanks
    0
    Thanked 158 Times in 149 Posts

    Default Re: java balloon project

    Thanks for posting your homework assignment. I start working on it right away while you put your feet up, have a beer and play some x-box.
    Improving the world one idiot at a time!

  8. The Following User Says Thank You to Junky For This Useful Post:

    mstabosz (September 19th, 2013)

  9. #7
    Grand Poobah
    Join Date
    Mar 2011
    Posts
    1,465
    My Mood
    Grumpy
    Thanks
    0
    Thanked 158 Times in 149 Posts

    Default Re: need help with assignment..dont knowwhere to start

    Then you haven't been paying attention in class. Time to do some revision.

    --- Update ---

    http://www.javaprogrammingforums.com...n-project.html

    Duplicate post
    Improving the world one idiot at a time!

  10. #8
    Member
    Join Date
    May 2013
    Posts
    96
    My Mood
    Amused
    Thanks
    16
    Thanked 9 Times in 9 Posts

    Default Re: need help with assignment..dont knowwhere to start

    That seems pretty obvious. Do you know how to create objects and call their member functions?

    Go through some of the stuff here for further details.

  11. #9
    Junior Member
    Join Date
    Sep 2013
    Posts
    5
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Re: java balloon project

    I am just looking for a starting point I don't see the need to pass judgement. But whatever this was a waste of time.

  12. #10
    Member
    Join Date
    May 2013
    Posts
    96
    My Mood
    Amused
    Thanks
    16
    Thanked 9 Times in 9 Posts

    Default Re: java balloon project

    srozo22, I'm sorry if you're feeling offended, but you asked a very broad question and didn't show what things, if any, you tried. I know that some teachers are worse than others, but I highly doubt your teacher would have assigned this project if he didn't teach you the basics of classes. The questions in my post were meant to assess what you know and prompt you to think about the project so you would know where to begin.

    We can't just tell you the answer, because aside from ethical issues of academic dishonesty, doing so would not help you learn. You would be completely sunk on your next assignment which would inevitably be more difficult. The best way to learn is by practice, and the best way to teach is by asking the right questions to evoke a gauge of knowledge from the student.

    The way to start, most broadly, is to open up your development program and create a new program.

    It sounds like the balloon class was already provided to you, which is good. You should know how to work with classes before designing your own.

    Do you know how to declare a new integer?
    Do you know how to declare a new instance of a class?
    Do you know how to access the member variables in a class once you've declared an instance of it?
    Do you know how to access the member functions in a class once you've declared an instance of it?

  13. #11
    Junior Member
    Join Date
    Sep 2013
    Posts
    5
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Re: java balloon project

    Yes I know how to. Open the new project and use the existing file provided with the tester class I need to create. I have an issue with the terminology and also creating the new integer or. Balloon and assigning its altitude. The class declarations I am also confused about, and how to literally begin writing the testt class. From there I believe I can access the names and altitudes of the balloons created. My problem as I stated is where to begin in creating the balloon to be more specific.

  14. #12
    Super Moderator jps's Avatar
    Join Date
    Jul 2012
    Posts
    2,642
    My Mood
    Daring
    Thanks
    90
    Thanked 262 Times in 231 Posts

    Default Re: java balloon project

    Quote Originally Posted by srozo22 View Post
    creating the balloon to be more specific.
    Creating objects tutorial

  15. #13
    Member
    Join Date
    May 2013
    Posts
    96
    My Mood
    Amused
    Thanks
    16
    Thanked 9 Times in 9 Posts

    Default Re: java balloon project

    Ok I think the teacher is using some terminology that may be confusing you. It seems that in this context, the "test class" is just the main program. Every program in Java contains at the very least one class. So here I create the "Hello world" class.

    public class HelloWorld
    {
        public static void main(String[] args)
        {
          System.out.println("Hello world!");
         }
    }

    That's just the most basic class. You can get more complex and add additional functions and class variables, which is what your teacher did in the balloon class.

    As for using the balloon class your teacher provided, the link JPS supplied will help. Just think of classes this way: a class is thing that defines how you create objects. To put it in more concrete terms, think of an apple pie. The pie is the object, the recipe is the class.

    Objects are also, essentially, variables. You can do things with them that you can do with primitive variables (like int and double)--pass them to functions, have functions return them. In that vein, you declare them sort of like variables, except you use the "new" keyword followed by the object's name, followed by whatever parameters the constructor requires in parentheses.

    Read the link JPS provided. It's pretty good stuff.

Similar Threads

  1. Help me in java project
    By Gowtham511 in forum What's Wrong With My Code?
    Replies: 1
    Last Post: March 17th, 2013, 06:58 AM
  2. Balloon code
    By Pinares in forum What's Wrong With My Code?
    Replies: 12
    Last Post: January 26th, 2013, 11:28 AM
  3. Balloon.java, what in the world do i do?
    By toterzuko in forum What's Wrong With My Code?
    Replies: 13
    Last Post: September 13th, 2010, 05:19 PM
  4. Replies: 0
    Last Post: August 30th, 2010, 07:34 AM
  5. Replies: 2
    Last Post: August 1st, 2010, 06:29 AM