A C++ Program That Simulates A T-shirt Sales System
BACHELOR OF INFORMATION TECHNOLOGY (HONS)
BACHELOR OF COMPUTER SCIENCE (HONS) IN CYBERSECURITY
BACHELOR OF COMPUTER SCIENCE (HONS)
ASSIGNMENT
TCS3024 / TNS3033 / BCS1123 INTRODUCTORY PROGRAMMING
SEP - DEC 2023
DUE DATE: Friday, 1st December 2023 @ 6PM
TOTAL MARKS: 100 marks
INSTRUCTIONS TO CANDIDATE:
- This is an INDIVIDUAL assignment.
- This assignment contributes 30% to your final course mark.
- You are required to compile all your work into one folder (ZIP file) and upload the softcopy on Blackboard.
WARNING
-
Assignment Aim:
The primary objective of this assignment is to familiarize students with a range of structured programming concepts and user-defined methods. It aims to provide students with practical experience in creating comprehensive system development documentation and implementing a complete program using the C++ programming language. Through this assignment, students are expected to apply their knowledge, skills, creativity, and critical thinking to successfully complete the task. -
Assignment Instructions:
This is an individual assignment, accounting for 30% of your final course grade. Please submit your report and program (.cpp file) on Blackboard (BB) by the DUE DATE.
MS Word Formatting
- Font size: Use 14 points for titles/headings, 12 points for content, and 8-9 point for headers/footers.
- Font type: Arial
- Line spacing: Maintain a 1.5 spacing throught the document.
- Proper alignment: ensure proper paragraph alignment and necessary page setup.
- Page numbering: Sequentially number all pages.
- Figures and Tables: Number them sequentially and refer to each in the text.
Assignment Deliverables
Your submission should include the following components:
- Assignment Cover Page
- Table of contents
- Program Design (Flowchart)
- C++ Program Source Code
- Program Testing: Include screenshots and explanation for each screenshot.
- Assumptions and References (if applicable)
- A publishable working copy of a compiled version of your program (.cpp file) - to be submitted together with your report
File Naming Convention
-
Name the file(s) using your Student ID and Name.
(E.g., SUKD17022 – Michael James) -
This addition ensures that students provide files with clear and standardized names for easy identification and grading.
-
Case Study
You are tasked with developing a C++ program that simulates a T-shirt sales system. This program should allow users to select T-shirt sizes (ranging from XS – XL) and T-shirt colours (Red, Blue, and Black). Users can proceed to purchase T-shirts using the information provided in the table below, which specifies stock availability based on size, colour, quantity and price:
源码联系UP主 -> https://space.bilibili.com/329101171
SIZE COLOUR QUANTITY PRICE PER T-SHIRT
XS Red 30
RM25.00
Blue 30
Black 30
S Red 50
RM25.00
Blue 50
Black 50
M Red 50
RM30.00
Blue 50
Black 50
L Red 30
RM30.00
Blue 30
Black 30
XL Red 20
RM35.00
Blue 20
Black 20
To accomplish this task, you are required to implement the following functionalities using selection statements, looping, functions, and array:
a) Display Menu: This function serves as an introduction to the program’s purpose, provides instructions on data input, and allows users to choose their desired operation. Users also have the option to exit the program if they wish to do so. Example of your main screen:
b) Purchase order: This function allows the user to place orders for T-shirts, taking into account the availability of the selected size and colour.
c) Input Loop: Implement a loop that continuously prompts the user to specify a T-shirt size and colour, indicate the desired quantity, and proceed with the purchase until they decide to exit.
d) Availability Check: Ensure that the program checks whether there are enough T-shirts available in the chosen size and colour combination. If there are not enough T-shirts, display an error message.
e) Update T-Shirt Availability: After a successful purchase, the program should update the available quantity of T-shirts in the selected size and colour.
f) Display Purchase Details: Display relevant purchase information to the user, including the T-shirt size and colour, price per T-shirt, quantity purchased, sub price, and total price.
Assignment Requirements
- Implementation Techniques: The program should be implemented by using selection, looping, function, and array. This provides students with flexibility in choosing appropriate programming techniques.
- Validations: Validations must be implemented to handle invalid input and null values from users. Error messages should be displayed, and users should be prompted to re-enter correct input. This ensures robust error handling.
- Naming Conventions: Students are required to follow naming conventions for variables and functions. This promotes consistency and readability in the code.
- Design: The program should be designed neatly and efficiently. Students are encouraged to write code that is well-structured and maintainable.
- IDE Compatibility: The program should be compiled and executed using any IDE that can compile C++ program. This allows students to choose their preferred development environment.
- Comments: Students are required to insert comments alongside their code to explain its purpose. Comments should summarise when necessary, but not every line of code requires a comment. This encourages documentation and clarity.
Based on these requirements, students are expected to create:
- Flowchart: to visualize the program’s logic and flow.
- Complete and Eexecutable C++ Program: A working program that meets the specified requirements, including the use of appropriate programming techniques.
- Screenshots of the Program Testing: Provide screenshots of the testing procedure along with explanations for each screenshot. This helps to demonstrate the program’s functionality and testing process.
*Please refer to page 2 of this document for the assignment deliverables.
Grading Rubric
This assignment will be graded based on a 100-point rubric. The following details about the categories in the rubric are as follows:
• Program Specifications / Correctness: You program should work correctly on all inputs. Also, if there are any specifications about how the program should be written, or how the output should appear, those specifications should be followed.
• Code Readability: Variables and functions in your program should have meaningful names. Code should be organized into functions/methods where appropriate. There should be an appropriate amount of white space so that the code is readable, and indentation should be consistent.
• Code Documentation: Your code and functions/methods should be appropriately commented. However, not every line should be commented on because that makes your code overly busy. Think carefully about where comments are needed.
• Code Efficiency: There are many ways to write the same functionality into your code, and some of them are needlessly slow or complicated. For example, if you are repeating the same code, it should be inside a new method/function or for loop.
• Output: Your output should be user friendly in a way that it is easy for the user to understand what they need to do when they use the system. Instructions and error messages should be clear and precise. Add whitespace (blank lines, spaces) where it is appropriate to help separate distinct parts of your output. Try to avoid cluttering up the screen.
• Testing: You are required to include screenshots for the program testing in your report. Each screenshot should come with an explanation explaining the purpose of the testing. Screenshots for invalid inputs must also be shown.
• Flowchart: You need to create a flowchart to illustrate the logical steps in your program.
TCS3024 / TNS3033 / BCS1123 - Introductory Programming - Assignment Grading Rubric
Unsatisfactory
(0-40%) Satisfactory
(41-60%) Good
(61-80%) Excellent
(81-100%)
Program
Specifications /
Correctness
30% • Completed less than 70% of the requirements.
• Not delivered on time or not in correct format
• Program only functions correctly in very limited cases or not at all.
• User prompts are misleading or non-existent. • Completed between 70-80% of the requirements.
• Delivered on time, and in correct format
• Significant details of the specification are violated, program often exhibits incorrect behavior.
• User prompts contain little information, poor design. • Completed between 80-90% of the requirements.
• Delivered on time, and in correct format
• Minor details of the program specification are violated, program functions incorrectly for some inputs.
• User prompts are understandable, minimum use of symbols or spacing in output. • Completed between 90-100% of the requirements.
• Delivered on time, and in correct format
• No errors, program always works
correctly and produces desired output
• Excellent user prompts, good use of symbols, spacing in output.
Code Readability
10% • No name, date, or assignment title included
• Poor use of white space (indentation, blank lines).
• Disorganized and messy
• Poor use of variables (many global variables, ambiguous naming). • Includes name, date, and assignment title.
• White space makes the program fairly easy to read.
• Organized work.
• Good use of variables (few global variables, unambiguous naming). • Includes name, date, and assignment title.
• Good use of white space.
• Organized work.
• Good use of variables (no global variables, unambiguous naming) • Includes name, date, and assignment title.
• Excellent use of white space.
• Creatively organized work.
• Excellent use of variables (no global variables, unambiguous naming).
Code Documentation 5% • No documentation included. • Basic documentation has been completed including descriptions of all variables.
• Purpose is noted for each function. • Clearly documented including descriptions of all variables.
• Specific purpose is noted for each function and control structure. • Clearly and effectively documented including descriptions of all variables.
• Specific purpose is noted for each function, control structure, input requirements, and output results.
Code Efficiency 5% • A difficult and inefficient solution. • A logical solution that is easy to follow but it is not the most efficient. • Solution is efficient and easy to follow (i.e. no confusing tricks). • Solution is efficient, easy to understand, and maintain.
Unsatisfactory
(0-40%) Satisfactory
(41-60%) Good
(61-80%) Excellent
(81-100%)
Output
10% • Not user friendly. Some instructions
• Error messages are missing.
• Messy. • Quite user friendly. At least one major issue with instructions, error messages, and use of whitespaces. Quite messy. • User friendly. Minor issues with consistent use of whitespace. One or two instructions and error messages are not that clear. Quite clean. • Very user friendly. Instructions and error messages are clear and concise. Good use of white spaces. Free of clutter.
Testing
20% • No testing has been completed.
• Some testing has been completed. Some explanation is provided.
• Thorough testing has been completed. Explanation is acceptable.
• Thorough and organized testing has been completed. The explanation is detailed and precise.
Flowchart
20% • The flowchart is incomplete or non-understandable.
• Flowchart does not reflect the program at all. • The flowchart does not describe the process accurately.
• Most of the shapes in the flowchart are incorrectly labeled or shaped • The flowchart describes the process, but its components are not correctly labeled, shaped, or defined. • All the components are clearly defined, shaped, and labeled.
• The flowchart describes the process in an accurate manner.