I am having trouble with this assignment. Please help.
For this assignment, you will select either the Cat or Dog Java class from the UML diagram provided in Project One and implement it. Open the Virtual Lab by clicking on the link in the Virtual Lab Access module. Then open your IDE and create a new class. Use the Eclipse IDE and Downloading Files From Eclipse tutorials to help you with this project.

CODE
/**
* Pet.java
* =======================
*/
/** Definition of the Pet class */
public class Pet
{
/** private instance variables of the class Pet */
private String petType;
private String petName;
private int petAge;
private boolean dogSpace;
private boolean catSpace;
private int daysStay;
private double amountDue;
/** Default constructor - Parameterless constructor */
public Pet()
{
petAge = 0;
petName = "";
petType = "";
dogSpace = false;
catSpace = false;
amountDue = 0;
daysStay = 0;
}
/** Parameterized constructor to initialize all instance variables */
public Pet(String type, String name, int age, boolean dog, boolean cat, int stay, double amount)
{
petType = type;
petName = name;
petAge = age;
dogSpace = dog;
catSpace = cat;
daysStay = stay;
amountDue = amount;
}
/** Setters for all the attributes of Pet class */
public void setPetType(String type)
{
petType = type;
}
public void setPetName(String name)
{
petName = name;
}
public void setPetAge(int age)
{
petAge = age;
}
public void setDogSpace(boolean dog)
{
dogSpace = dog;
}
public void setCatSpace(boolean cat)
{
catSpace = cat;
}
public void setDaysStay(int stay)
{
daysStay = stay;
}
public void setAmountDue(double due)
{
amountDue = due;
}
/** Getters for all the attributes of Pet class */
public String getPetType()
{
return petType;
}
public String getPetName()
{
return petName;
}
public int getPetAge()
{
return petAge;
}
public boolean getDogSpace()
{
return dogSpace;
}
public boolean getCatSpace()
{
return catSpace;
}
public int getDaysStay()
{
return daysStay;
}
public double getAmountDue()
{
return amountDue;
}
/** The methods that are given in UML diagram */
/** Implementation of the methods are not given in the question
* and hence the body of the methods are left blank
*/
public void checkIn() {}
public void checkOut() {}
public void getPet() {}
public void createPet() {}
public void updatePet() {}
}
/**
* Cat.java
* ===================
*/
/** Cat is a subclass that inherits from the Parent class Pet */
public class Cat extends Pet
{
/** Attribute of Cat class */
private int catSpaceNbr;
/** Non-Parameterised constructor */
public Cat()
{
super();
catSpaceNbr = 0;
}
/** Parameterized constructor */
public Cat(String type, String name, int age, boolean dog, boolean cat, int stay, double amount,int space)
{
super(type,name,age,dog,cat,stay,amount);
catSpaceNbr = space;
}
/** setter of the instance variable */
public void setCatSpaceNbr(int space)
{
catSpaceNbr = space;
}
/** getter of the instance variable */
public int getCatSpaceNbr()
{
return catSpaceNbr;
}
}
I am having trouble with this assignment. Please help. For this assignment, you will select either...
Assignment Requirements
I have also attached a Class Diagram that describes the
hierarchy of the inheritance and interface behaviors . The link to
the PDF of the diagram is below
MotorVehical.pdf
Minimize File Preview
User Define Object Assignment:
Create a Intellij Project. The
Intellij project will contain three user defined
classes. The project will test two of the User Define Classes by
using the invoking each of their methods and printing the
results.
You are required to create three UML...
This is the question about object-oriend programming(java) please show the detail comment and prefect code of each class, Thank you! This question contain 7 parts(questions) Question 1 Create a class a class Cat with the following UML diagram: (the "-" means private , "+" means public) +-----------------------------------+ | Cat | +-----------------------------------+ | - name: String | | - weight: double | +-----------------------------------+ | + Cat(String name, double weight) | | + getName(): String | | + getWeight(): double | |...
Could someone help me out. I am not sure what I should
be doing. Seeing it worked out will allow me to understand what I
should be doing and then I can complete it on my own.
Usando 2. Complete the Dog Class: a. Using the UML Class diagram to the right declare the instance variables. A text version is available: UML Class Diagram Text Version b. Create a constructor that incorporates the type, breed, and name variables (do not...
Hi, the language is Java.
Learning Outcomes and Introduction In this lab assignment you will practice: . applying access modifiers using getters and setters to mediate access using getters and setters to create derived attributes using static variables and methods testing code using a unit testing approach . For each of the tasks in this lab, you will create a new class or create an improved version of one of the classes from the previous lab. Remember to document all...
Use Java and please try and show how to do each section. You are creating a 'virtual pet' program. The pet object will have a number of attributes, representing the state of the pet. You will need to create some entity to represent attributes in general, and you will also need to create some specific attributes. You will then create a generic pet class (or interface) which has these specific attributes. Finally you will make at least one subclass of...
We are going to create a few different classes in this project. I will supply one of the classes: Pound (as in a pound for animals). Your goal will be to create proper Dog and Cat classes that will work in conjunction with this Pound class. Before starting to the design process for the Dog/Cat classes, carefully inspect this code. Get an idea of the goal of the Cat/Dog classes. How many fields will they store? What will the constructors...
I want to know how to translate the design into a computer program write an interface class java and please put on the comments I would use the eclipse This lab is a stepping stone to project 01. The ADT Bag is a group of items, much like what you might have with a bag of groceries. The ADT Bag should have the following operations. You should use the same operation names that are shown below. • create an empty...
Java assignment. There are five classes. You figure out the inheritance hierarchy. Animal, Dog, Brindle, Cat, Driver Note: Brindle is a kind of dog that has stripes The following classes will have a makeSound method that displays the kind of sound the animal makes. Animal, Dog, Cat In the Brindle class, you will have an instance variable noOfStripes One of the classes should have an instance variable to hold the name of the animal Name One of the classes should...
[Continued] Your Course class should have:
1)a getter for the course 'code', so that it is read-only;
2)a getter and setter for the lecturer attribute, so that it is
readable and writable;
3)a constructor that creates the associations shown in the UML
diagram;
4)an enrolStudent method that adds a given Student object into
the 'enrolled' set;
5)a withdrawStudent method that removes a given Student object
from the 'enrolled' set and returns true if the student was
successfully found and removed,...
C++ Programming Assignment S Mammal Lab This lab's goal is to give you some practice using inheritance, virtual functions, pointers, dynamic memory allocation, random numbers, and polymorphism. To complete the lab implement the following steps: Create a class called Mammal. All mammals have a weight and a name, so its data should be the mammal's weight and name. Provide a default constructor that sets the mammal's weight to 0 and name to null, and another constructor that allows the weight...