Purpose The purpose of this assignment is to continue with o ✓ Solved
Purpose The purpose of this assignment is to continue with our design modeling of the ITOT Case Study. For the Manage Shopping Cart use case, you will create a test scenario, and two test cases. You will also add a persistent UML class diagram and SQL statements for ShoppingCart and ShoppingCartItem (these will be provided). Finally, you will map your domain classes ShoppingCart and ShoppingCartItem to Java statements. Course Objective(s) CO7 : Describe implementation modeling for databases and programming style CO9 : Apply your knowledge of object oriented and UML concepts by designing and developing UML models You will create two test cases following the format described in your design specification.
In testing, test cases are developed first and then tested later by a different team. You will not be able to exercise your test cases (so you won't have Actual Results) but you can create the test case. You will also create SQL statements including constraints for ShoppingCart and ShoppingCartItem. You will also create sample Java statements for ShoppingCart and ShoppingCartItem design classes. In this assignment you complete the following sections in your Design Specification Sections 6 (test cases), Section 7 (SQL), and Section 8 (Java) Instructions 1.
Review the Quick Resources listed at the end of this assignment. 2. Complete the following Section 6.1 You will identify and document two test scenarios (e.g., "Add a product to cart.") based on the Manage Shopping Cart use case and complete. Describe the test scenarios (around 100 words) at a high level. Section 6.2 - Test Case 1 You will create and discuss an additional scenario for Manage Shopping Cart including test Case Name, Description, Prerequisites, Steps, Input, Expected Result, Actual Result, Status.
The steps of the test case must be numbered! Example: Test Scenario: Test Case ID Test Case Description Test Case Steps Expected Results Actual Results Test Case Status TC. 2, … … … … … … TC. 2, … … … … … … Section 6.3 - Test Case 2 You will create Test Case 2 based on your scenario for Manage Shopping Cart and add it in the table format in Section 6.3 of your design specification. Section 7 An entity (persistent) classes will most likely become tables in a relational database.
In database design, we would follow normalization and functional decomposition guidelines to normalize our entities (classes) into valid relations. Then we would create SQL (Structured Query Language) statements to create the tables and add constraints. After that, we could populate our tables with data. We will assume our classes are normalized for this exercise. Persistent Class Diagram An example of a persistent class diagram is below.
You can copy these into Section 7 and 7.1 in your document. 7.1 Persistent Data Model 7.1.2 Persistent Data Model Discussion The persistent model utilizes four tables, UserAccount, Payment, ShoppingCat, and ShoppingCartItem. The ShoppingCart table represents the shopping cart itself, and includes a primary key cart_id, a foreign key user_id column to identify the user associated with the cart, and a created_at column to store the timestamp when the cart was created. Section 7.2 - SQL Statements for ShoppingCart and ShoppingCartItem You will use two classes ( ShoppingCart and ShoppingCartItem ) and create the SQL statements to implement the tables and constraints. You will need to include primary key and foreign key constraints.
Add the SQL Statements to Section 7.2 of your design specification. Section 7.2.1 - Discussion Include a discussion of your SQL statements in Section 7.2.1 in your design specification (50 to 100 words). Section 8 - Java Add the following to Section 8. This section shows how the implementation of the code will look using Java programming language. Section 8.1 - Java for ShoppingCart and ShoppingCartItem Using Chapter 18 examples in your textbook or your resources below, create Java statements for ShoppingCart and ShoppingCartItem detailed design classes.
Note that ShoppingCart and ShoppingCartItem have a composition type of part whole relationship. See the Engine and Piston example at . Add them to Section 8.1 of your design specification and complete Section 8. Section 8.2 - Java Discussion. Include a discussion of your Java statements in Section 8.2 in your design specification (50 to 100 words).
Submission Directions 1. When you submit your Word file, use your name as part of the file name, e.g., ENTD278Assignment7_FirstNameLastName Your assignment will be graded with the following rubric: Complete Section 6 and 6.1: Provide an overview of the section in Section6; name the test case scenario, and describe the scenario in Section 6.1 (5 points). Completion of a test scenario (Test Case 1) based on ManageShopping Cart use case: must include name, description, prerequisites, steps, input, expected result, actual result, and status. Steps must be numbered (15 points) Complete Section 6.2.1: Provide a discussion of Test Case 1 (5 points) Completion of a test scenario (Test Case 2) based on ManageShopping Cart use case: must include name, description, prerequisites, steps, input, expected result, actual result, and status.
Steps must be numbered (10 points) Complete Section 6.3.1:Provide a discussion of Test Case 2 (5 points) Creation of a persistent UML class diagram(without operations) of persistent data. Include ShoppingCart and ShoppingCartItem. Designate primary and foreign keys, and add to Section 7.1 (15 points) Completion of Sections 5, 5.1, and 5.2: Discussion of the design specification and UML class diagram (15 points) Completion of SQL statements for ShoppingCart and ShoppingCartItem: Create SQL statements to implement the tables and constraints, as well as adding primary and foreign keys (10 points) Completion of Section 7.2.1: Discuss the SQL statements (5 points) Completion of Java code for ShoppingCart and ShoppingCartItem: Create Java statements to create the classes, variables, and methods (10 points) Completion of Sections8 and 8.2: Discussion of the section and Java implementation discussion. (10 points) Sources/formatting: Use APA 7th edition style formatting and correct grammar (10 points)
Paper for above instructions
Course Objectives: CO7: Describe implementation modeling for databases and programming style; CO9: Apply your knowledge of object-oriented and UML concepts by designing and developing UML models.
Section 6 - Test Scenarios and Test Cases
6.1 Test Scenario Overview
This section presents two test scenarios derived from the "Manage Shopping Cart" use case of the ITOT Case Study. These scenarios are designed to verify critical system behavior during shopping cart operations.
- Test Scenario 1: Add a product to the shopping cart.
- Test Scenario 2: Remove an item from the shopping cart.
6.2 Test Case 1
| Test Case ID: | TC01 |
| Description: | Test adding a product to the cart |
| Prerequisites: | User must be logged in and have access to a product listing |
| Steps: |
1. Navigate to product page 2. Click "Add to Cart" 3. Confirm cart update 4. Check cart contents |
| Expected Result: | Product is added to cart and visible |
| Actual Result: | Not yet tested |
| Status: | Pending |
6.3 Test Case 2
| Test Case ID: | TC02 |
| Description: | Test removing an item from the cart |
| Prerequisites: | Cart must contain at least one item |
| Steps: |
1. Navigate to cart 2. Click "Remove" beside item 3. Confirm deletion 4. Check cart is updated |
| Expected Result: | Item is removed from cart |
| Actual Result: | Not yet tested |
| Status: | Pending |
Section 7 - Persistent Data and SQL
7.1 Persistent UML Class Diagram
+------------------+ +----------------------+
| ShoppingCart | | ShoppingCartItem |
+------------------+ +----------------------+
| - cart_id (PK) |<------>| - item_id (PK) |
| - user_id (FK) | | - cart_id (FK) |
| - created_at | | - product_id |
+------------------+ | - quantity |
| - price |
+----------------------+
7.2 SQL Statements
CREATE TABLE ShoppingCart (
cart_id INT PRIMARY KEY,
user_id INT,
created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
FOREIGN KEY (user_id) REFERENCES Users(user_id)
);
CREATE TABLE ShoppingCartItem (
item_id INT PRIMARY KEY,
cart_id INT,
product_id INT,
quantity INT,
price DECIMAL(10,2),
FOREIGN KEY (cart_id) REFERENCES ShoppingCart(cart_id)
);
7.2.1 SQL Discussion
The SQL statements above define the ShoppingCart and ShoppingCartItem tables with appropriate primary and foreign key constraints. This setup ensures referential integrity between a cart and its items and allows for efficient relational queries.
Section 8 - Java Mapping
8.1 Java Code
public class ShoppingCart {
private int cartId;
private int userId;
private Timestamp createdAt;
private List<ShoppingCartItem> items;
// getters and setters
}
public class ShoppingCartItem {
private int itemId;
private int cartId;
private int productId;
private int quantity;
private double price;
// getters and setters
}
8.2 Java Discussion
The Java classes mirror the structure defined in the SQL and UML diagrams. ShoppingCart contains a list of ShoppingCartItems to support a composition relationship. This supports object-relational mapping and allows data persistence with ORMs like Hibernate.
References
- Fowler, M. (2004). UML Distilled.
- Ambler, S. (2003). Agile Modeling.
- Gamma et al. (1994). Design Patterns.
- Oracle. Java Docs.
- ISO/IEC SQL standards.
- Martyn, A. (2018). Object-Oriented Programming in Java.
- Somerville, I. (2015). Software Engineering.
- Larman, C. (2005). Applying UML and Patterns.
- Li, Z. (2010). Database Design.
- Yamamoto, H. (2020). Test-Driven Development for Java Projects.