Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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):
    1. Small (s) that costs $1.25
    2. Large (l) that costs $2.25
  • There are also 2 types of dolls (d):
    1. Stuffed (s) that costs $15.50
    2. Ceramic (c) that costs $25.25

What you need to do:

  1. Design out the 3 classes (UML) in Word
  2. Code the three classes in Java
  3. To test your classes, code a class driver that will do the following:
    1. Create an method that returns (to main) an array of random toys that were purchased (minimum of 20).
    2. 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?
    3. Create a third method that reads the contents of the file into an array.
    4. 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 ... blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Information Technology Auditing

Authors: James A. Hall

4th edition

1133949886, 978-1305445154, 1305445155, 978-1133949886

More Books

Students also viewed these Programming questions

Question

=+1. Which of the given are Actions and which are States of Nature?

Answered: 1 week ago

Question

Describe the three-tier client-server model.

Answered: 1 week ago

Question

Discuss the relationship between attributes and entities.

Answered: 1 week ago

Question

3. How do we perceive high-frequency sounds (above 4000 Hz)?

Answered: 1 week ago