Question: ASSIGNMENT 3 Assignment 3 tests your basic knowledge of Arrays and ArrayList ( Chapter 7 ) , Text Processing and wrapper classes ( Chapter 8
ASSIGNMENT
Assignment tests your basic knowledge of Arrays and ArrayList Chapter Text Processing and wrapper classes Chapter and classes and
inheritance Chapter 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.
Design an abstract class called YourNamePet with the following exact fields, methods, and functionality, in this order:
FieldMethod Description
name A private string field that holds the name of the pet eg Spot, Fluffy
type A private string field that holds the type of animal that the pet is eg dog, cat, bird, fish, rabbit
YourNamePet A constructor with parameters name and type that initializes the 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: NAMEname, TYPEtype where name and type are the fields values.
Design a class called YourNameCat that extends the YourNamePet class with the following exact fields and methods:
FieldMethod 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.
Design a class called YourNameDog that extends the YourNamePet class with the following exact fields and methods:
FieldMethod 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.
Design a class called YourNameData with the following exact fields and methods:
FieldMethod 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 noarg constructor that reads the data from the AssingmentData.txt files The format of the file lines is name type with
the oneword 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: CATSNumberCats, DOGSNumberDogs
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.
Design a driver class called YourNameAssignmentreplace 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.
Implement the classes in NetBeans IDE and JAVA: Create a JAVA project called YourNameAssignmentsame name as the driver class add the
class YourNamePet, YourNameCat, YourNameDog, YourNameData to the YourNameAssignment project and add your code to the YourNamePet,
YourNameCat, YourNameDog, YourNameData classes and YourNameAssignmen projectdriver class main method. Your program should be welldocumentedcommented have comments for every line of code and use only concepts learned in class chapters
Create the screenshot document for your code and output: Create a Microsoft Word document from the YourNameAssignmentdocx template
and call it YourNameAssignmentdocx replace YourName with your actual name with your screenshots of the NetBeans editor window showing
the entire JAVA source code for the YourNameAssignment 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
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
