198k views
5 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. 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. Infer Class and Method Specifications from JUnit Tests You may have noticed that the above "overview" descriptions are not as precise as the class specifications and method implementations. In fact, unlike the previous labs, we will not provide detailed specifications in this handout. To obtain the precise specification, you need to carefully analyze the test cases in the provided JUnit tests to understand the expected behaviours of each method. In professional software development, test cases often play a vital role in specifying software requirements. This is called Test-Driven Development (TDD).

User Jacmoe
by
8.2k points

1 Answer

3 votes

Final answer:

The question involves creating a Java-based toy order system using computational thinking and object-oriented programming, guided by the principles of Test-Driven Development and mathematical modeling.

Step-by-step explanation:

The student's question involves using computational thinking and object-oriented programming in Java to create a simulation of an order system for children's toys. Applying knowledge of mathematics, science, and engineering, the software developer must design a system that includes classes for Toys, Children, and Orders, keeping in mind constraints and the need for efficiency and functionality. The developer must utilize methods like constructors, getters, and setters for managing toy attributes, while also implementing functionality for children to manage their toy collections and to create orders with a maximum of five children.

Test-Driven Development (TDD) is a critical aspect in this scenario as the requirements are represented through the provided JUnit tests. Through TDD, the developer is expected to write code that will fulfill the test cases, ensuring the resulting software is rigorously tested and meets the desired needs. This is crucial for developing a problem-solving strategy and assessing the significance of the numerical solutions and results provided by the program.

The ability to design and conduct experiments, analyze and interpret data, and to thoughtfully estimate and apply mathematical models is paramount to ensure that the system works as intended. In context, each child is a unique object with their own toy collection that can be modified through donations, and orders manage a small group of these children, emphasizing personalization and conducive logical thinking.

User Embedc
by
8.2k points