31.8k views
3 votes
Computational thinking for a software developer/computer programmer is a critical skill that is consistently applied. This lab requires you to develop a solution using Java object-oriented programming that simulates an order system for children's toys. The child will manage a collection/list of toys (each child owns his toys), and an order system will create an order containing up to 5 children (i.e., the maximum number of children in any given order is 5).

The system manages information about a single toy. The system stores the following information (for each attribute, choose any type that you think is appropriate--you must be able to justify the decisions you make):

• Toy ID: the toy id of the toy (a positive number)

• Toy name: the name of the toy

• Toy quantity: the quantity of this toy that child owns. The quantity of any given toy is a positive integer value.

• Toy price: the price of this toy

The system manages information about a single child. The system stores the following information (for each attribute, choose any type that you think is appropriate--you must be able to justify the decisions you make):

• Child name: the name of a child

• Child age: a positive integer number represents the child's age in years.

• Child list of toys: the system allows a child to have as many toys as the child want. There is no maximum number of toys that a child can own.

• Child number of toys: a positive number represents a child's number of toys at any given moment.

The system manages information about a single order. The system stores the following information (for each attribute, choose any type that you think is appropriate--you must be able to justify the decisions you make):

• List of children in this order: The maximum number of children in any given order is 5. Thus, an order can contain any number of children between zero and 5.

• The number of children in this order at any given moment.

Your task is to drive and create class(es) and method(s) from the given JUnit class and then add them to the package using the following facts:

• You can get and set any toy attributes.

• The child object can be constructed by receiving the child's name, age and list of toys.

• There is no need to check if there are duplicated toys (e.g., two toys with the same information).

• Each child owns their toys and does not share them with other children.

• A child can dispose of his toys.

• A child can denote his toys to another child. In this case, the toys will be removed from the donor child, and the toys will be added to the list of toys of another child.

• You can get and set the child's name.

• You can get and set the child's age.

• You can get and set the child's list of toys.

• You can add a child to the order as long as you do not reach the maximum number of children per order, which is 5.

• You can remove a child from the order. If the child exists in a given order, then you need o update the number of children in this order. Otherwise, do nothing.

• You can retrieve the list of children in any given order.

Note: other system functionalities can be inferred from the given JUnit test. ​​​​​​​

Note: It is expected that the JunitTest_ChildOrderToyTest.java JUnit class contains compilation errors. This is because the declarations and definitions of the required class(es) and method(s) it references are missing. It is important to drive and create class(es) and method(s) from the given JUnit class and then add them to the package.

User Ranieuwe
by
7.4k points

1 Answer

2 votes

Final answer:

Computational thinking is essential for software development. The lab requires developing a Java solution for a toy order system. The system manages information about toys, children, and orders.

Step-by-step explanation:

Computational Thinking in Software Development

Computational thinking is a critical skill for software developers and computer programmers. It involves approaching problems in a logical and systematic way, breaking them down into smaller steps, and designing algorithms to solve them.

Object-Oriented Programming in Java

Object-oriented programming is a programming paradigm that organizes code into reusable objects. In this lab, you are required to develop a solution using Java object-oriented programming to simulate an order system for children's toys.

Information Management in the System

The system manages information about toys, children, and orders. For each attribute, appropriate data types should be chosen. The toy information includes the toy ID, toy name, toy quantity, and toy price. The child information includes the child's name, child's age, child's list of toys, and the number of toys the child owns. The order information includes the list of children in the order and the number of children in the order.

Functionalities of the System

The system should allow various functionalities such as getting and setting toy attributes, constructing child objects with name, age, and list of toys, adding a child to an order (up to a maximum of 5 children per order), removing a child from an order, retrieving the list of children in an order, etc.

User Memetech
by
8.0k points