Explore BrainMass

Explore BrainMass

    Java Programming

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

    See attach files. I am having a hard time to figure out how to display the output. I was trying to use the my.displayInformation(); clause but wasnt sucessful. Any help would be greatly apperciated.

    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."

    © BrainMass Inc. brainmass.com March 4, 2021, 6:03 pm ad1c9bdddf
    https://brainmass.com/computer-science/java/java-programming-26068
    $2.19

    ADVERTISEMENT