首页 > > 详细

DPST1091 23T1 Assignment 2 CS Pizzeria

 DPST1091 23T1

Forum
Submissions
Assignment 2
CS Pizzeria
Pantea wants to start a pizza shop (pizzeria), but she has no way to manage it. How will they keep track of their orders? How will they keep track of their finances? DPST1091 is requesting you to build a program which will help them manage their pizzeria.
 
Overview
What is CS Pizzeria?
For this assignment, you will be implementing a program which helps to manage a pizzeria. You do not need any prior knowledge regarding managing a restaurant or cooking pizzas to complete this assignment.
 
In Stage 1, you are required to manage a linked list of orders in the pizzeria. The following diagram provides a visual representation of what you are implementing
 
 
In Stage 2, these orders will now have a linked list of required ingredients. You do not need to understand the following diagram until you complete Stage 1.
 
 
In Stage 3, the pizzeria will now have a linked list of stocked ingredients. You do not need to understand the following diagram until you complete Stage 2.
 
 
In Stage 4, the pizzeria will be structured the same but orders can now be completed and ingredients can be saved/loaded to/from files.
 
Provided Structs
This section details what is currently in the starter code. The images above are what your assignment's struct pizzeria at the end of each stage.
 
You have been provided with the skeleton of three existing struct data types to help you with your implementation of this simulation.
 
The structs and their purposes are shown below.
 
struct pizzeria
Purpose: To store the state of the pizzeria.
Contains:
struct order *orders - points to the head of the orders list or NULL.
struct order
Purpose: To store information about a single order.
Contains:
struct order *next - points to the next order in the linked list or NULL.
struct ingredient
Purpose: To store information about a single ingredient.
Contains:
struct ingredient *next - points to the next ingredient in the linked list or NULL.
Hint: You should not use this struct until Stage 2.
Remember that these are skeletons, so add to the contents of each struct to suit your implementation of the assignment.
 
Allowed C Features
In this assignment, you cannot use arrays, other than char arrays, and cannot use the features explicitly banned in the Style Guide.
 
The only C features you will need to get full marks in the assignment are:
 
int, char and double variables.
Structs.
If statements.
While loops.
Your own functions.
Pointers.
char arrays/strings (you are not allowed to use arrays which are not char arrays).
Linked lists.
Standard libraries: stdio.h, stdlib.h and string.h.
Style: Header comments, function comments, constants (#define's), and whitespace and indentation.
Using any other features will not increase your marks (and will make it more likely you make style mistakes that cost you marks).
 
If you choose to disregard this advice, you must still follow the Style Guide. You also may be unable to get help from course staff if you use features not taught in DPST1091.
 
Features that the Style Guide strongly discourages or bans will be penalised during marking.
 
Reference Implementation
To help you understand the proper behaviour of CS Pizzeria, we have provided a reference implementation. If you have any questions about the behaviour of CS Pizzeria, you can check them against this reference implementation.
 
To access the reference implementation, use the following command.
 
1091 cs_pizzeria
Starter Code
Stubs are functions which compile, but are incomplete. In your starter code pizzeria.c, most functions only have one line in them, which is their return. This return is just so the code will compile, and you will need to update these as you work on your code.
 
This zip file contains the files that you need to get started with the assignment. It contains the following files:
 
pizzeria.h
Do not change this file.
Contains declarations for all the functions that you need to implement for this assignment.
Contains extensive documentation for each function that you need to implement, including examples of invalid input, any assumptions and the purpose of each function.
pizzeria.c
This is the only file you will be submitting. All of your code will be in this file.
Contains stubs for each function in pizzeria.h.
The function create_pizzeria has been completed for the current definition of struct pizzeria.
When you change the contents of struct pizzeria, you will need to update the function to match.
Contains the helper functions print_order and print_ingredient, which you should use to print the orders and ingredients. These functions will print the orders and ingredients in the expected format.
main.c
Do not change this file.
Contains a main and other functions, which allow you to interact and test the functions you implement in pizzeria.c.
How To Get Started
Create a new folder for your assignment work and move into it.
mkdir ass2
cd ass2
Download the starter code above or use the commands below to copy the file into your current directory on your CSE account.
 
cp -n /web/dp1091/23T1/activities/cs_pizzeria/pizzeria.c .
ln -s /web/dp1091/23T1/activities/cs_pizzeria/main.c .
ln -s /web/dp1091/23T1/activities/cs_pizzeria/pizzeria.h .
The ln commands create symbolic links to a file in class account, so you are always using the latest version.
 
Run 1091 autotest for the first stage to make sure you have correctly downloaded the files.
 
1091 autotest-stage 01 cs_pizzeria
If the tests do not run, you have not downloaded the correct files. If it says you have passed 1 test and failed 13 tests, you have downloaded the correct files.
 
Spend a few minutes playing with the reference solution -- get a feel for how the assignment works.
1091 cs_pizzeria
Read through Stage 1 on the webpage, then read through Stage 1 in pizzeria.h.
Think about your solution and draw diagrams to supplement your understanding of the required functions.
Start coding in pizzeria.c, using pizzeria.h to check the details of any specific assumptions or edge cases. As you code, it is recommended to have pizzeria.h open and easily accessible. Also, if there is anything you're unsure of, run the reference implementation!
Repeat steps 5-8 with each following stage you want to complete.
How To Compile
To compile a multi-file project, you will want to compile the .c files together. For this assignment, you will want to use the following command.
 
dcc -o cs_pizzeria pizzeria.c main.c
Your Tasks
This assignment consists of four stages. Each stage builds on the work of the previous stage, and each stage has a higher complexity than its predecessor. You should complete the stages in order.
 
Stage 1 ●??
Stage 2 ●??
Stage 3 ●●?
Stage 4 ●●●
Stage 1
You can run the autotests for Stage 1 by running the following command:
 
1091 autotest-stage 01 cs_pizzeria
Why does this stage exist?
 
This stage tests you on creating, inserting and iterating through a linked list. This is one of the key learning outcomes of DPST1091, and it will be tested in your Lab Exercises, and during the final exam. We teach this skill because it is one of the fundamental ways that data can be stored and manipulated, and forms a basis for most algorithms.
 
Who do we expect to complete this stage?
 
While some students may struggle with it, we hope every student will complete this stage.
 
What help will tutors provide to students?
 
Tutors can give you a detailed theoretical explanation, and give lots of help with the lab exercises that lead to this assignment. Tutors will be happy to help you debug any issues with your code.
 
How many marks will I get?
 
Completing this stage, with good style, is worth around a 30% mark.
 
In this stage, you will implement:
 
add_order()
print_all_orders()
next_deadline()
1.1 Add Order
Your first task is to implement the function: add_order(). The details of the function can be found in pizzeria.h.
 
An order is a customer's request to the pizzeria and needs to be stored. This will include:
 
The customer's name,
The pizza's name,
The price they will pay for the pizza and
The time allowed to cook the pizza in.
A new order should be added to the end of the pizzeria's linked list of orders, emulating the first come, first serve way of thinking.
 
You should fill in the members of struct order to ones that make the most sense to you.
 
Some fields you may want to add to struct order include a character array for the customer name and a double for the price. The character array should be of length MAX_STR_LENGTH as found in pizzeria.h.
 
For example, if you wanted to add a customer name string to your struct, you could define it like this:
 
char customer[MAX_STR_LENGTH];
For this assignment, the exact specifics of how the function should operate will be in pizzeria.h. Since this is the first function required to be implemented, the description in pizzeria.h is displayed in the following toggle list. However, for future functions, we expect you to refer to pizzeria.h.
 
The following toggle lists contain diagrams which will help supplement your understanding of how the function affects the pizzeria.
 
1.2 Print All Orders
Your second task is to implement the function: print_all_orders(). The details of the function can be found in pizzeria.h.
 
The owner of the pizzeria would like to have an overview of all the current orders in their restaurant. In this function, you will be printing all the orders in the desired format.
 
For this function, you should use the provided helper function print_order() to print the orders in the expected format.
 
In print_all_orders(), there is a function call to a function named print_selected_order(). This function call should be at the very end of the function and should not be removed. print_selected_order() is a function to be implemented in Stage 2.
 
1.3 Next Deadline
Your third task is to implement the function: next_deadline(). The details of the function can be found in pizzeria.h.
 
The chefs in the pizzeria would like to know how much time is left until their next deadline. You will need to tell the chefs what is the shortest time allowed among all orders in the pizzeria.
 
The following toggle list contains a diagram which will help supplement your understanding of how the function interprets the pizzeria.
 
Assessment
Assignment Conditions
Joint work is not permitted on this assignment.
 
This is an individual assignment.
 
The work you submit must be entirely your own work. Submission of any work even partly written by any other person is not permitted.
 
The only exception being if you use small amounts (< 10 lines) of general purpose code (not specific to the assignment) obtained from a site such as Stack Overflow or other publicly available resources. You should attribute the source of this code clearly in an accompanying comment.
 
Assignment submissions will be examined, both automatically and manually for work written by others.
 
Do not request help from anyone other than the teaching staff of DPST1091.
 
Do not post your assignment code to the course forum - the teaching staff can view assignment code you have recently autotested or submitted with give.
 
Rationale: this assignment is an individual piece of work. It is designed to develop the skills needed to produce an entire working program. Using code written by or taken from other people will stop you learning these skills.
 
The use of code-synthesis tools, such as GitHub Copilot, is not permitted on this assignment.
 
Rationale: this assignment is intended to develop your understanding of basic concepts. Using synthesis tools will stop you learning these fundamental concepts.
 
Sharing, publishing, distributing your assignment work is not permitted.
 
Do not provide or show your assignment work to any other person, other than the teaching staff of DPST1091. For example, do not share your work with friends.
 
Do not publish your assignment code via the internet. For example, do not place your assignment in a public GitHub repository.
 
Rationale: by publishing or sharing your work you are facilitating other students to use your work, which is not permitted. If they submit your work, you may become involved in an academic integrity investigation.
 
Sharing, publishing, distributing your assignment work after the completion of DPST1091 is not permitted.
 
For example, do not place your assignment in a public GitHub repository after DPST1091 is over.
 
Rationale:DPST1091 sometimes reuses assignment themes, using similar concepts and content. If students in future terms can find your code and use it, which is not permitted, you may become involved in an academic integrity investigation.
 
Violation of the above conditions may result in an academic integrity investigation with possible penalties, up to and including a mark of 0 in DPST1091 and exclusion from UNSW.
 
Relevant scholarship authorities will be informed if students holding scholarships are involved in an incident of plagiarism or other misconduct. If you knowingly provide or show your assignment work to another person for any reason, and work derived from it is submitted - you may be penalised, even if the work was submitted without your knowledge or consent. This may apply even if your work is submitted by a third party unknown to you.
 
If you have not shared your assignment, you will not be penalised if your work is taken without your consent or knowledge.
 
For more information, read the UNSW Student Code , or contact the course account.
 
Submission of Work
You must rename pizzeria.c to cs_pizzeria.c . You can do this by this command:
 
  mv pizzeria.c cs_pizzeria.c
You should submit intermediate versions of your assignment. Every time you autotest or submit, a copy will be saved as a backup. You can find those backups here , by logging in, and choosing the yellow button next to ass2_cs_pizzeria.
 
Every time you work on the assignment and make some progress, you should copy your work to your CSE account and submit it using the give command below.
 
It is fine if intermediate versions do not compile or otherwise fail submission tests.
 
Only the final submitted version of your assignment will be marked.
 
You submit your work like this:
 
  give dp1091 ass2_cs_pizzeria cs_pizzeria.c
The only files you should modify is cs_pizzeria.c. It is not possible to add new files, or modify the other files we have given you. If you believe you need to modify those files, you have misunderstood the specification. You should not modify your copies of those files in any way.
 
Assessment Scheme
This assignment will contribute 25% to your final mark.
 
80% of the marks for this assignment will be based on the performance of the code you write in cs_pizzeria.c.
 
20% of the marks for this assignment will come from manually marking of the readability of the code you have written in C. These marks will be awarded on the basis of clarity, commenting, elegance and style. In other words, your tutor will assess how easy it is for a human to read and understand your program.
 
Marks for your performance will be allocated according to the below scheme:
 
Marks for your performance will be allocated roughly according to the below scheme.
 
100% for Performance Completely working implementation, which exactly follows the spec (stage 1, 2, 3, 4).
90% for Performance Completely working implementation of Stage 1, 2, and 3.
65% for Performance Completely working implementation of Stage 1 and 2.
50% for Performance Partially working implementation of Stage 1 and Stage 2's functions: Select Next, Select Previous and Print Selected Order.
30% for Performance Completely working implementation of Stage 1
20% for Performance Completely working implementation of Stage 1 functions: Add Order and Print All Orders.
Marks for your style will be allocated roughly according to the scheme below.
 
Style Marking Rubric
Header Comment - Should include Name; zid or email; and a description of the program. 0/1 - No header comment. 0.5/1 - 2 out of 3 parts of header comment are present. 1/1 - Includes all three
Whitespace - Should use consistent whitespace (for example, 3 + 3 not 3+ 3). 0/2 - Many whitespace errors. 1/2 - A few whitespace errors. 2/2 - No whitespace errors.
Line Length - Lines should be max. 80 characters long. 0/2 - Many lines more than 80 characters long. 1/2 - A few lines more than 80 characters long. 2/2 - No lines more than 80 characters long.
Constant Usage - all magic numbers are defined, and well named. 0/2 - No constants used throughout the program are defined. 1/2 - At least one constant is defined and well named. 2/2 - Constants are defined and well named.
Indentation - Should use a consistent indentation scheme. 0/2 - Multiple instances throughout code of inconsistent/bad indentation 0.5/2 - More than one instance of incorrect indentation throughout the code 1/2 - Code is mostly correctly indented 2/2 - Code is consistently indented throughout the program, with all functions etc indented
Variable names - Variables should be descriptively named. 0/2 - No variables are named descriptively 0.5/2 - Many difficult to understand variable names 1/2 - Some variable names are hard to understand (the use of i and j is fine), or snake_case and camelCase are used inconsistently throughout 2/2 - All variable names are descriptive, with the use of snake_case consistent
Function Usage - Code has been decomposed into appropriately named functions. 0/2 - No functions are present, code is one main function 0.5/2 - Each stage from Stage 2 onwards has at least ONE function, but some functions are longer than 50 lines 1/2 - Each stage from Stage 2 onwards completed has at least ONE function of at most ~50 lines 1.5/2 - Each stage completed from Stage 2 onwards has more than TWO functions, but they are mostly longer than 50 lines 2/2 - Each stage completed from Stage 2 onwards has more than TWO functions of at most 50 lines each, OR Student has only completed Stage 1 and has not used functions for the first stage.
Overdeep Nesting - Variables should be descriptively named. 0/2 - Many instances of overdeep nesting. 1/2 - 3 or less blocks of overdeep nesting. 2/2 - No overdeep neseting.
Comments - All functions have a short comment explaining their behaviour. It's best if this is above the function's implementation. Other commenting is used throughout code as needed. 0/2 - No function comments are present, comments decribe functions incorrectly. No other comments present in the code 0.5/2 - Less than half of the functions used have comments for them. If no functions are used, there are small amounts of commenting throughout other code 1/2 - There is some commenting throughout the code that is used as needed 1.5/2 - More than half of the functions used have comments for them 2/2 - All functions used have comments clearly describing the purpose of the function. If no functions are used (Stage 1 only), then code is well commented throughout as needed
Illegal Elements - No features that are forbidden by the style guide. Note: Out of 3, not out of 2 0/3 - Uses multiple pieces of content forbidden by the style guide. 1.5/3 - Makes small (single) use of content not allowed in the style guide. 3/3 - No illegal elements used.
Note that the following penalties apply to your total mark for plagiarism:
 
0 for the assignment Knowingly providing your work to anyone and it is subsequently submitted (by anyone).
0 for the assignment Submitting any other person's work. This includes joint work.
0 FL for DPST1091 Paying another person to complete work. Submitting another person's work without their consent.
Allowed C Features
In this assignment, there are no restrictions on C Features, except for those in the style guide. We strongly encourage you to complete the assessment using only features taught in lectures. The only C features you will need to get full marks in the assignment are:
 
int variables - char variables
pointers
if statements, including all relational and logical operators
while loops
printf, and fgets
strings and functions you have seen from the string.h library
structs
arrays
#define'd constants
enums
malloc() and free()
Helper functions we have provided - Your own helper functions too!
Using any other features will not increase your marks (and will make it more likely you make style mistakes that cost you marks). If you choose to disregard this advice, you **must** still follow the style guide.
You also may be unable to get help from course staff if you use features not taught in DPST1091. Features that the Style Guide strongly discourages or bans will be penalised during marking. You can find the style marking rubric above.
 
Due Date
This assignment is due 7 April 2023 20:00:00. For each day after that time, the maximum mark it can achieve will be reduced by 5% (off the ceiling).
For instance, at 1 day past the due date, the maximum mark you can get is 95%.
For instance, at 3 days past the due date, the maximum mark you can get is 85%.
For instance, at 5 days past the due date, the maximum mark you can get is 75%.
No submissions will be accepted after 5 days late, unless you have special provisions in place.
联系我们
  • QQ:99515681
  • 邮箱:99515681@qq.com
  • 工作时间:8:00-21:00
  • 微信:codinghelp
热点标签

联系我们 - QQ: 99515681 微信:codinghelp
程序辅导网!