Purchase Solution

Creating a Java Program

Not what you're looking for?

Ask Custom Question

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.

Purchase this Solution

Purchase this Solution


Free BrainMass Quizzes
Basic UNIX commands

Use this quiz to check your knowledge of a few common UNIX commands. The quiz covers some of the most essential UNIX commands and their basic usage. If you can pass this quiz then you are clearly on your way to becoming an effective UNIX command line user.

Word 2010: Tables

Have you never worked with Tables in Word 2010? Maybe it has been a while since you have used a Table in Word and you need to brush up on your skills. Several keywords and popular options are discussed as you go through this quiz.

Word 2010: Table of Contents

Ever wondered where a Table of Contents in a Word document comes from? Maybe you need a refresher on the topic? This quiz will remind you of the keywords and options used when working with a T.O.C. in Word 2010.

Java loops

This quiz checks your knowledge of for and while loops in Java. For and while loops are essential building blocks for all Java programs. Having a solid understanding of these constructs is critical for success in programming Java.

C++ Operators

This quiz tests a student's knowledge about C++ operators.