Question: ASSIGNMENT 3 Assignment 3 tests your basic knowledge of Arrays and ArrayList ( Chapter 7 ) , Text Processing and wrapper classes ( Chapter 8

ASSIGNMENT 3
Assignment 3 tests your basic knowledge of Arrays and ArrayList (Chapter 7), Text Processing and wrapper classes (Chapter 8), and classes and
inheritance (Chapter 9) and should have the following exact (name, parameters, types, and functionality) classes, fields, and methods, order, and
have your name in the names (replace YourName with your actual name) and exact requested functionality.
1. Design an abstract class called YourNamePet with the following exact fields, methods, and functionality, in this order:
Field/Method Description
name A private string field that holds the name of the pet (e.g. Spot, Fluffy)
type A private string field that holds the type of animal that the pet is (e.g. dog, cat, bird, fish, rabbit)
YourNamePet A constructor with 2 parameters name and type that initializes the 2 fields with the corresponding parameters values.
sound An abstract void method that output the sound the pet makes.
eat A void method that outputs Eating...
sleep A void method that outputs Sleeping...
toString A string method that returns a string with the format: NAME=name, TYPE=type where name and type are the fields values.
2. Design a class called YourNameCat that extends the YourNamePet class with the following exact fields and methods:
Field/Method Description
YourNameCat A constructor with one parameter name that calls the superclass constructor to set the superclass name field to parameter
name and type to cat.
sound Override the superclass method to output Meow
purr A void method that outputs Purring...
jump A void method that outputs Jumping...
toString Override the superclass toString method to add CAT: at the beginning.
3. Design a class called YourNameDog that extends the YourNamePet class with the following exact fields and methods:
Field/Method Description
YourNameDog A constructor with one parameter name that uses the superclass constructor to set the superclass field name to parameter
name and the type to dog.
sound Override the superclass method to output Woof
fetch A void method that outputs Fetching...
run A void method that outputs Running...
toString Override the superclass toString method to add DOG: at the beginning.
4. Design a class called YourNameData with the following exact fields and methods:
Field/Method Description
cats A private array or ArrayList of YourNameCat objects field that holds the cats
dogs A private array or ArrayList of YourNameDog objects field that holds the dogs
YourNameData A no-arg constructor that reads the data from the Assingment3Data.txt files The format of the file lines is name type with
the 2 one-word values separated by a tab. Then, if the type is cat, create an object of type YourNameCat and add it to the
cats array and if it is dog, create an object of type YourNameDog and add it to the dogs array.
printCounts A void method that computes the numbers of cats and dogs from the class and print the NumberCats and NumberDogs in this
format: CATS=NumberCats, DOGS=NumberDogs.
printCats A void method that looks at each object from the cats arrays, and uses the toString of the object to get the string format and
print it, and calls the eat, sleep, sound, purr, jump, to demonstrate the other object methods.
printDogs A void method that looks at each object from the dogs arrays, and use the toString of the object to get the string format and
print it, and call the eat, sleep, sound, fetch, run to demonstrate the other object methods.
5. Design a driver class called YourNameAssignment3(replace YourName with your actual name) with this main functionality:
Creates an object of the YourNameData class called myData.
Use myData objects printCounts method to print the numbers in the specific format
Use myData objects printCats to print the cats data.
Use myData objects printDogs to print the dogs data.
6. Implement the classes in NetBeans IDE and JAVA: Create a JAVA project called YourNameAssignment3(same name as the driver class), add the
class YourNamePet, YourNameCat, YourNameDog, YourNameData to the YourNameAssignment3 project and add your code to the YourNamePet,
YourNameCat, YourNameDog, YourNameData classes and YourNameAssignmen3 project/driver class main method. Your program should be welldocumented/commented (have comments for every line of code) and use only concepts learned in class (chapters 19).
7. Create the screenshot document for your code and output: Create a Microsoft Word document from the YourName-Assignment3.docx template
and call it YourName-Assignment3.docx (replace YourName with your actual name) with your screenshots of the NetBeans editor window showing
the entire JAVA source code for the 5 YourNameAssignment3, YourNamePet, YourNameCat, YourNameDog, and YourNameData classes and the
entire output. If the entire class JAVA source code or the output does not fit in one screenshot or the screenshots cannot be easily read, c

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!