Description
Java Class Unit 3. There is 1 discussion, 1 Assignment, and 1 Test to be done by 3 January. I attached the instructions and the Data for the assignment and how to submit it. Also attached the instructions for the discussion. In the assignment on the “YourName” part please use this name: AhmetSahin To take the test you need to login to my school account which I’ll be providing whenever you are ready to take it. Please let me know if you have any questions.
Unformatted Attachment Preview
Formatted
…
Formatted
…
Formatted
…
Formatted
…
Formatted
…
Formatted
…
1. Design an abstract class called YourNamePet with the following exact fields, methods, and functionality, in this order:
Formatted
…
Field/Method
Description
A private string field that holds the name of the pet (e.g. Spot, Fluffy)
A private string field that holds the type of animal that the pet is (e.g. dog, cat, bird, fish, rabbit)
A constructor with 2 parameters name and type that initializes the 2 fields with the corresponding parameters’ values from the
parameters.
An abstract void method that output the sound the pet makes.
A void method that outputs “Eating…”
A void method that outputs “Sleeping…”
A string method that returns a string with the format: “NAME=name, TYPE=type” where name and type are the fields’ values. of
the fields
Formatted
…
Formatted
…
Formatted
…
Formatted
…
Formatted
…
Formatted
…
Formatted
…
Formatted
…
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 uses calls the superclass constructor to set the superclass name field to
parameter name and the type of the pet 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.
Formatted
…
Formatted
…
Formatted
…
Formatted
…
Formatted
…
Formatted
…
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 of the pet 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.
Formatted
…
Formatted
…
Formatted
…
Formatted
…
Formatted
…
Formatted
…
Formatted
…
Formatted
…
Formatted
…
Formatted
…
Formatted
…
Formatted
…
Formatted
…
Formatted
…
Formatted
…
Formatted
…
Formatted
…
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 object’s printCounts method to print the numbers in the specific format
▪
Use myData object’s printCats to print the cats data.
▪
Use myData object’s printDogs to print the dogs data.
Formatted
…
Formatted
…
Formatted
…
Formatted
…
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 1 – 9).
Formatted
…
Formatted
…
Formatted
…
Formatted
…
Formatted
…
Formatted
…
Formatted
…
Formatted
…
Formatted
…
Formatted
…
Formatted
…
Formatted
…
Formatted
…
Formatted
…
Formatted
…
Formatted
…
Formatted
…
Formatted
…
Formatted
…
Formatted
…
ASSIGNMENT 3 WINTER
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.
name
type
YourNamePet
sound
eat
sleep
toString
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.
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, create
multiple screenshots and add multiple screenshots to the screenshot document. Make sure both entire code and output is visible in the screenshots.
If your output is longer than a line and does not fit on one screen, Wrap Text in your output panel.
8. Submit your work: Submit YourName-Assignment3.docx on eCampus under the Assignment 3. Do not archive the files (e.g. no RAR, ZIP, etc.) or
submit other types/formats of files (e.g. no CLASS, PDF, JAVA, ZIP, RAR, etc.). Please take time after submitting to review the file and check it is correct
and resubmit it if there are any errors.
Formatted: Font: 5 pt
Formatted: Font: 9 pt
Formatted: Font: 9 pt
NAME: Your Name
ID: Your Student ID
ASSINGMENT 3
CLASS 1: Class1.java
Screenshots of the JAVA source code for CLASS1 in editor
CLASS 2: Class2.java
Screenshots of the JAVA source code for CLASS2 in editor.
CLASS 3: Class3.java
Screenshots of the JAVA source code for CLASS3 in editor.
CLASS 4: Class4.java
Screenshots of the JAVA source code for CLASS4 in editor.
DRIVER CLASS: DriverClass.java
Screenshots of the JAVA source code in editor
OUTPUT
Screenshots of the program output in editor
Purchase answer to see full
attachment