Question
You have been hired by a toy store to make a program. After speaking with the owners you were assigned to build three classes: Toy,
You have been hired by a toy store to make a program. After speaking with the owners you were assigned to build three classes: Toy, Marble, Doll. Your team learned the following:
- There are 2 types of marbles (m):
- Small (s) that costs $1.25
- Large (l) that costs $2.25
- There are also 2 types of dolls (d):
- Stuffed (s) that costs $15.50
- Ceramic (c) that costs $25.25
What you need to do:
- Design out the 3 classes (UML) in Word
- Code the three classes in Java
- To test your classes, code a class driver that will do the following:
- Create an method that returns (to main) an array of random toys that were purchased (minimum of 20).
- Create a second method to write the toy and type to a file (for each toy in the array).
- Example: ms dc ds ml
- Be sure each toy/type is separated by spaces
- Can we use toString() to help us here?
- Create a third method that reads the contents of the file into an array.
- Create a 4th method that loops through the array in 3 and determine the total cost of the toys sold. Display the total cost of the toys sold.
You can work with each other but no sitting back to get the answer from someone else...be actively involved.
You have learned everything you need to know to do this: abstract classes, inheritance, file I/O, error catching, etc.
To upload: UML file, .java class files (2), .java test file (1), screenshot of the test run.
Extra Credit (10 points):
Create a method that lists the count of the toys sold. Break this out by toy and option.
Example (display how you prefer):
Marbles: Small Large 7 3
Dolls: Stuffed Ceramic 6 4
Step by Step Solution
3.38 Rating (173 Votes )
There are 3 Steps involved in it
Step: 1
Lets implement these classes in Java Toyjava public abstract class Toy protected String type protected double price ...Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started