Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

In this assignment, you will take the category, objects, attributes, and methods that you created in Assignment 5.03 and apply them to the structure of

In this assignment, you will take the category, objects, attributes, and methods that you created in Assignment 5.03 and apply them to the structure of an Object-Oriented Program.

Before you begin to create your own program, examine this partial program created from the Matching exercise on page 2 - part 2 of the lesson. The comments in the code highlight important functionality and terminology, read them carefully. You will want to keep this assignment handy as you complete module 5 and learn more about each of these concepts in more detail (private instance variables, constructors, and invoking instance methods).

Part 1

Follow the directions to complete each step and fill in the blanks for the implementation class.

  1. From your worksheet inAssignment 5.03, choose one of your categories and its associated objects to fill out the template below:
  2. Insert your category name from Assignment 5.03. Class names should be capitalized.
  3. Declare a variable type and name for two your objects' attributes. Attributes are characteristics of your object. These are called private instance variables.

Insert the class name for the constructor. This should match exactly to the class name you have above. The constructor is a special type of method that is used to create the objects.

Inside the parathesis, include the two parameters that will be used to initialize your object's attributes. While these have a 1:1 correlation to your instance variables above, they should have different names. The parameters need to include their type and name. For example, int age or String name.

  1. Set the instance variable equal to the local variable (the parameter you used in the constructor)
  2. From your worksheet in Assignment 5.03, complete the method headers by entering the names of your object's behaviors. You do not need to complete the method body at this time.

Part 2

In Part 1 you completed the structure for your class. In this part you will complete the structure for the tester or client class. This class contains the main() method used to run the program, creates the objects, and calls their methods.

Follow the directions to complete each step and fill in the blanks for the client class.

  1. Enter your class name above.
  2. Create 3 new objects from your class using the parameters in your constructor in Part 1. Use the example and explanation below to help complete the statement.
    • Animal cat = new Animal("brown", 3);
    • Animal is the class
    • cat is the name of the object
    • Animal is also the constructor
    • brown is an attribute
    • 3 is an attribute
  3. Create two calls to one of your object's methods. Use the example and explanation below to help complete the statement.
    • cat.meow();
    • cat is the name of the object
    • meow() is the name of the method

Step by Step Solution

3.28 Rating (163 Votes )

There are 3 Steps involved in it

Step: 1

Part 1 Assuming you have completed Assignment 503 and have a category and objects defined heres an e... blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Introduction To Leadership Concepts And Practice

Authors: Peter G Northouse

5th Edition

1544351593, 978-1544351599

More Books

Students also viewed these Programming questions

Question

Explain all drawbacks of application procedure.

Answered: 1 week ago