Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

For this assignment, you will select either the Cat or the Dog Java class from the UML diagram. Open the Virtual Lab (Apporto) by clicking

For this assignment, you will select either the Cat or the Dog Java class from the UML diagram. Open the Virtual Lab (Apporto) by clicking on the link in the Virtual Lab Access module. Then open your Eclipse IDE and create a new class. Use the Eclipse IDE Tutorial Video if you need help with creating a class in Eclipse.

Before you begin, review the following UML Class Diagram, paying special attention to the attributes and behaviors of each class. As a note, though the diagram illustrates an inheritance relationship between the classes, the class you choose to implement does not have to inherit from the Pet class for the purposes of this assignment. You will learn more about implementing inheritance in later modules.

image text in transcribed

Next, you will implement either the Cat or Dog Java class. Your class must meet all of the specifications from the UML Class diagram. Be sure to include the following in your Cat or Dog class:

All attributes (variables) with appropriate data types. Note that the types are not specified in this UML class diagram. You will need to think about what the most appropriate data type is for each attribute.

At least one constructor method that initializes values for all attributes

Accessors and mutators for all attributes. Each attribute should have a corresponding accessor (getter) and mutator (setter) method. These methods are indicated in the class diagram.

In-line comments and appropriate white space, according to the style guidelines you have learned so far in the course

This is my code so far:

public class Pet { private int dogSpaceNumber; private int dogWeight; private String grooming;

//constructor public Pet(int dogSpaceNumber,int dogWeight,String grooming) { this.dogSpaceNumber = dogSpaceNumber; this.dogWeight = dogWeight; this.grooming = grooming; }

//setter for dogSpaceNumber public void setDogSpaceNumber(int dogSpaceNumber) { this.dogSpaceNumber = dogSpaceNumber; }

//setter for weight public void setDogWeight(int dogWeight) { this.dogWeight = dogWeight; }

//setter for grooming public void setGrooming(String grooming) { this.grooming = grooming; }

//getter for dogSpaceNumber public int getDogSpaceNumber() { return dogSpaceNumber; } //getter for dogWeight public int getDogWeight() { return dogWeight; } //getter for grooming public String getGrooming() { return grooming; }

public static void main(String[] args) { } }

I've tried a million different ways and codes etc. At first I was getting "revisit the relationship" but now I only get undefined. every time undefined. I'm losing my marbles with this assignment. When I run this in eclipse it works fine, no errors. i dont understand what am I missing

Step by Step Solution

There are 3 Steps involved in it

Step: 1

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

Step: 3

blur-text-image

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

More Books

Students also viewed these Databases questions