Explore BrainMass

Explore BrainMass

    Creating a Java Program

    Not what you're looking for? Search our solutions OR ask your own Custom question.

    This content was COPIED from BrainMass.com - View the original, and get the already-completed solution here!

    See Attach Files.

    Use the modular approach and build the program piece by piece. Use stubs and test each part of the program before combining the error free segments of code at the end. The modular approach really does work!!

    Write a Java program that does the following:
    1. Creates a Ball class with attributes for color, hardness, and size and instantiates the following Ball objects: golf, baseball, soccer.
    2. Creates a display method which can print the current state of the attributes for all objects.
    3. Creates attributes that have default values (your choice) which will display to the screen when the program is run and then each of the attributes for each object will be changed (your choice) during the program run and printed again to the screen with the appropriate message so that I can tell what the original values were and how they were changed during the program run.
    Your output should be as follows:
    A. Print each ball type's default attribute values i.e., "The golf ball color = white, hardness = hard, and size = small"
    B. Change each ball type's default attribute values and print the changes i.e., "The golf ball is now color = orange, hardness = soft, and size = large."
    Use the weekly coding examples I have included to help you structure the program.

    Write the program using Notepad and only submit the source .java file.

    © BrainMass Inc. brainmass.com November 24, 2022, 11:52 am ad1c9bdddf