首页
编程语言
数据库
网络开发
Algorithm算法
移动开发
系统相关
金融统计
人工智能
其他
首页
>
> 详细
CS 162-020辅导、program讲解、C++编程语言调试、c/c++讲解 辅导R语言编程|辅导留学生Prolog
CS 162-020 Assignment #2 The Pizza Portal
Design Document due: Sunday, 4/19/2020, 11:59 p.m. (Canvas)
Assignment due: Sunday, 4/26/2020, 11:59 p.m. (TEACH)
Demo due: 5/10/2020 (without penalties)
Goals:
• Practice good software engineering design principles:
o Design your solution before writing the program
o Develop test cases before writing the program
• Practice Object-Oriented Programming
• Implement “Has-a” relationship using class composition
• Use file I/O to read from and write to files
• Practice file separation and create Makefile
• Use functions to modularize code to increase readability and reduce repeated code
Problem Statement:
This program is going to simulate some of the common functionality of a pizza ordering site. The
program will allow customers and employees to interact with the site and will begin by prompting the user
to identify themselves (customer or employee).
If the user is an employee, they need to successfully log in to be able to change aspects of the site. Upon
successful log in, employees should be provided the option to change the restaurant hours, add or
remove items from the menu, or view or remove orders.
If the user is a customer, they should be provided with the option to search the menu by price or by
ingredients (case insensitive) or place an order. When placing an order, a customer may select off the
entire menu or from the last search result they examined.
Both kinds of users should have the option to view the menu, the restaurant hours, address or phone
number. Users may also log out at anytime which will return them to the welcome prompt. From the
welcome prompt they can end the program or log in as another user.
Requirements:
To save time on this assignment, the restaurant information, menu, and employees of the restaurant will
be read in from files. Changes to the menu, hours, and the orders will be written back out to their
respective files. The file formats can be found at the end of this document. You may assume that the
filenames are hardcoded as follows:
menu.txt
employee.txt
restaurant_info.txt
orders.txt
You will implement this program with the following classes and structs:
Classes: Restaurant, Menu, Pizza,
Structs: employee, hours.
Partial outlines of the classes and structs are provided at the end of this document to help get you
started. You will need to add more functions. You may add variables if they are useful and you can
defend their addition.
Your code must be written in a modular format with separate .h and .cpp files for each class.
Example Operation
The following snippet of text shows an example implementation of the Pizza Portal program. Note that
this example does not illustrate all required behavior. You must read this entire document to ensure
that you meet all of the program requirements. (User inputs are highlighted)
input files. Your implementation does not have to look exactly the same but it must support the required
functionality as described in the assignment.>
$ ./pizza_portal
Welcome to Bytes Pizza!
Are you a customer (C) or employee (E) or would you like to quit (Q)? E
Please enter your ID number: 1111
Please enter your password: Flam
Incorrect ID or password. Please try again.
Please enter your ID number: 1111
Please enter your password: Flamingo
Welcome C.J. Cregg!
What would you like to do?
1. Change hours
2. View orders
3. Remove order
4. Add Item to Menu
5. Remove Item from Menu
6. View Menu
7. View Hours
8. View Address
9. View Phone
10. Log out
Selection: 1
Which day would you like to change the hours for? Friday
What should the opening time be? 8am
What should the closing time be? 11pm
Here are the updated hours:
Sunday 12pm 8pm
Monday 10am 9pm
Tuesday 10am 9pm
Wednesday 10am 9pm
Thursday 10am 9pm
Friday 8am 11pm
Saturday 10am 11pm
What would you like to do?
1. Change hours
2. View orders
3. Remove order
4. Add Item to Menu
5. Remove Item from Menu
6. View Menu
7. View Hours
8. View Address
9. View Phone
10. Log out
Selection: 10
Welcome to Bytes Pizza!
Are you a customer (C) or employee (E) or would you like to quit (Q)? C
What would you like to do?
1. View Menu
2. Search by Cost
3. Search by Ingredients
4. Place Order
5. View Hours
6. View Address
7. View Phone
8. Log out
Selection: 3
Would you like to search for ingredients you want include (I) or
exclude (E)? I
What item would you like to include? pepperoni
Do you want to include another item (Yes/No)? Yes
What item would you like to include? mozzarella
Do you want to include another item? No
Here are the pizzas that match your criteria:
Corvegas 12 23 28 5 Pesto Pepperoni Mozzarella Roasted_Red_Peppers
Artichoke
Meat_Lovers 10 18 25 6 Pepperoni Sausage Smoked_Pork_Belly Mozzarella
Parm Marinara
Would you like to reduce your search by excluding some ingredients
(Yes/No)? No
Would you like to place an order off this search result (Yes/No)? No
What would you like to do?
1. View Menu
2. Search by Cost
3. Search by Ingredients
4. Place Order
5. View Hours
6. View Address
7. View Phone
8. Log out
Selection: 2
What is your maximum budget (in dollars)? 20
Here are the pizzas that match your criteria. Ineligible sizes are
marked as N/A:
Corvegas 12 N/A N/A 5 Pesto Pepperoni Mozzarella Roasted_Red_Peppers
Artichoke
Zorba 12 N/A N/A 5 Herb_Chicken Feta Artichoke Red_onion Mushroom
Meat_Lovers 10 18 N/A 6 Pepperoni Sausage Smoked_Pork_Belly Mozzarella
Parm Marinara
Southtown_Blues 9 17 20 7 Pear Apple Bleu_Cheese Mozzarella
Toasted_Almonds Sweet_Onion Garlic_Infused_Oil
Margherita 9 17 N/A 5 Tomato Mozzarella_Fresca Basil Marinara
Balsamic_Reduction
Would you like to place an order off this search result (Yes/No)? Yes
(1) Small Corvegas - $12
(2) Small Zorba - $12
(3) Small Meat_Lovers - $10
(4) Medium Meat_Lovers - $18
(5) Small Southtown_Blues - $9
(6) Medium Southtown_Blues - $17
(7) Large Southtown_Blues - $20
(8) Small Margherita - $9
(9) Medium Margherita - $17
Please select an option from the list above. You may also enter 0 to
cancel this order or press enter (blank line) to proceed to checkout.
Your selection: 5
How many Small Southtown_Blues? 2
Please select an option from the list above. You may also enter 0 to
cancel this order or press enter (blank line) to proceed to checkout.
Your selection: 4
How many Medium Meat_Lovers? 1
Please select an option from the list above. You may also enter 0 to
cancel this order or press enter (blank line) to proceed to checkout.
Your selection:
Please provide the following information:
Customer name: Roger
Credit card number: 1111222233334444
Phone number: 9998887777
Thank you! Your order number is 2.
< Note that the orders.txt file would now contain an additional entry
with the new order.
The format would follow the example shown in the "Required File
Formats" section.>
What would you like to do?
1. View Menu
2. Search by Cost
3. Search by Ingredients
4. Place Order
5. View Hours
6. View Address
7. View Phone
8. Log out
Selection: 1
Here is our menu:
The_Bent 21 25 30 6 Cheese Pepperoni American_Bacon Italian_Sausage
Black_Olives Mushroom
Corvegas 12 23 28 5 Pesto Pepperoni Mozzarella Roasted_Red_Peppers
Artichoke
Zorba 12 23 28 5 Herb_Chicken Feta Artichoke Red_onion Mushroom
Meat_Lovers 10 18 25 6 Pepperoni Sausage Smoked_Pork_Belly Mozzarella
Parm Marinara
Southtown_Blues 9 17 20 7 Pear Apple Bleu_Cheese Mozzarella
Toasted_Almonds Sweet_Onion Garlic_Infused_Oil
Margherita 9 17 24 5 Tomato Mozzarella_Fresca Basil Marinara
Balsamic_Reduction
What would you like to do?
1. View Menu
2. Search by Cost
3. Search by Ingredients
4. Place Order
5. View Hours
6. View Address
7. View Phone
8. Log out
Selection: 4
(1) Small The_Bent - $21
(2) Medium The_Bent - $25
(3) Large The_Bent - $30
(4) Small Corvegas - $12
(5) Medium Corvegas - $23
(6) Large Corvegas - $28
(7) Small Zorba - $12
(8) Medium Zorba – $23
(9) Large Zorba - $28
(10) Small Meat_Lovers - $10
(11) Medium Meat_Lovers - $18
(12) Large Meat_Lovers – $25
(13) Small Southtown_Blues - $9
(14) Medium Southtown_Blues - $17
(15) Large Southtown_Blues - $20
(16) Small Margherita - $9
(17) Medium Margherita - $17
(18) Large Margherita - $24
Please select an option from the list above. You may also enter 0 to
cancel this order or press enter (blank line) to proceed to checkout.
Your selection:
Error! Nothing is on your order list!!
Please select an option from the list above. You may also enter 0 to
cancel this order or press enter (blank line) to proceed to checkout.
Your selection: 0
What would you like to do?
1. View Menu
2. Search by Cost
3. Search by Ingredients
4. Place Order
5. View Hours
6. View Address
7. View Phone
8. Log out
Selection: 8
Welcome to Bytes Pizza!
Are you a customer (C) or employee (E) or would you like to quit (Q)? Q
Bye!
Implementation Requirements:
• This list is not exhaustive. Your program must satisfy all the requirements given in this document
• You are NOT expected to validate company information that is provided. There are many valid forms
of addresses, hours of operation, etc.
• Each class needs accessor functions, mutator functions, constructors, copy constructor, destructors,
assignment operator overload, and use of const where appropriate.
• The program needs to be compiled with a makefile
• Files must be separated into a .h and a .cpp for each class. Both structs may occur in the same .h
You should have one driver file.
• Text files will be provided for demos. You may use the examples ones provided in this document to
test your program.
• If an employee provides incorrect login information, the system should re-prompt until they get it right
or elect to quit.
• Users should be provided their menu of choices after each completed task.
• When text files are edited, they should be saved with their newest version. At the completion of your
program there should only be four .txt files.
• Users should have the option of refining their search when they search by ingredients. This means if
they first search for ingredients to include on the pizza, then they may further reduce these results by
providing a list of ingredients to exclude. Likewise, if start with ingredients to exclude, they may refine
the results by providing a list of ingredients to include. Users should then be able to place an order
after completing this search.
• Users should be able to place an order after completing the cost search. The program does not need
to refine the search after finding pizzas by cost.
Required Structs, Classes and File Formats
Please download the tar archive to start.
Command to download:
wget http://classes.engr.oregonstate.edu/eecs/spring2020/cs162-020/assignments/assign2.tar
Command to extract:
tar -xvf assign2.tar
The structs and classes in the tar archive above are required to be used in your implementation. Note
that you are allowed to add additional member functions as needed. You may add member variables if
you can justify their existence.
For each .h in the tar archive, you will have to create its corresponding .cpp file.
Besides, your program must accommodate the file formats as specified in this section. (Example .txt files
are also provided in the tar archive above)
The menu.txt file will have the following pattern:
Pizza_name Small_Cost Medium_Cost Large_Cost Num_Ingredients
Ingredients …
...
...
The employee.txt file will have the following pattern: (Updated)
ID Password First_Name Last_Name
...
...
The restaurant_info.txt file will have the following pattern: (Updated)
Name
Phone Number in format: (555) 543-8765
Address
Sunday Open_time Close_time
Monday Open_time Close_time
Tuesday Open_time Close_time
Wednesday Open_time Close_time
Thursday Open_time Close_time
Friday Open_time Close_time
Saturday Open_time Close_time
The orders.txt file must follow the pattern shown below. The "size" must be stored as S, M, or L,
representing small, medium, or large, respectively. The customer phone number must be stored without
spaces or hyphenation (e.g. 8009776368). (Updated)
Order_Num Customer_Name Customer_CC Customer_Phone Pizza_name size quantity
Order_Num Customer_Name Customer_CC Customer_Phone Pizza_name size quantity
...
...
Programming Style/Comments
In your implementation, make sure that you include a program header. Also ensure that you use proper
indentation/spacing and include comments! Below is an example header to include. Make sure you
review the style guidelines for this class , and begin trying to follow them, i.e. don’t align everything on
the left or put everything on one line!
/******************************************************
** Program: pizza_portal.cpp
** Author: Your Name
** Date: 04/20/2020
** Description:
** Input:
** Output:
******************************************************/
Extra Credit: Work with a different file format
In real practice, the .txt files will not contain a number at the top, indicating the number of entries within the
file. As a programmer, it is your job to figure out the number of entries in the file before reading information
in. With that being said, the txt files in this tar archive will not contain the number at front. You will earn
extra credits if your program is able to work with this type of files.
(*Note: you only need to choose one file format, either with or without the leading number in the files, not
both)
Design Document – Due Sunday 4/19/2020, 11:59pm on Canvas
Refer to the Example Design Document – Example_Design_Doc.pdf
Understanding the Problem/Problem Analysis:
• What are the user inputs, program outputs, etc.?
• What assumptions are you making?
• What are all the tasks and subtasks in this problem?
Program Design:
• What does the overall big picture of each function look like? (Flowchart or pseudocode)
o What member variables do you need to create for each class?
o What member functions do you need to create for each class?
o How do classes interact with each other? (How do you implement a “has-a” relationship?)
o How to read from a file, and store information into your program?
o How to write information from your program to a file?
o How would you modularize the program?
• What kind of bad input are you going to handle?
Based on your answers above, list the specific steps or provide a flowchart of what is needed to
create. Be very explicit!!!
Program Testing:
Create a test plan with the test cases (bad, good, and edge cases). What do you hope to be the
expected results?
• What are the good, bad, and edge cases for ALL input in the program? Make sure to
provide enough of each and for all different inputs you get from the user.
Electronically submit your Design Doc (.pdf file!!!) by the design due date, on Canvas.
Program Code – Due Sunday, 4/26/2020, 11:59pm on TEACH
Additional Implementation Requirements:
• Your user interface must provide clear instructions for the user and information about the data
being presented
• Your program must catch all required errors and recover from them.
• You are not allowed to use libraries that are not introduced in class, more specifically, you may
not use the
library in your program. Any searching or sorting functionality must be
implemented "manually" in your implementation.
• Your program should be properly decomposed into tasks and subtasks using functions.
To help you with this, use the following:
o Make each function do one thing and one thing only.
o No more than 15 lines inside the curly braces of any function, including main().
Whitespace, variable declarations, single curly braces, vertical spacing, comments, and
function headers do not count.
o Functions over 15 lines need justification in comments.
o Do not put multiple statements into one line.
• No global variables allowed (those declared outside of many or any other function, global
constants are allowed).
• No goto function allowed
• No vectors allowed
• You must not have any memory leaks
• You program should not have any runtime error, e.g. segmentation fault
• Make sure you follow the style guidelines, have a program header and function headers with
appropriate comments, and be consistent.
Compile and Submit your assignment
When you compile your code, it is acceptable to use C++11 functionality in your program. In order to
support this, change your Makefile to include the proper flag.
For example, consider the following approach (note the inclusion of -std=c++11):
g++ -std=c++11
In order to submit your homework assignment, you must create a tarred archive that contains
your .h, .cpp, and Makefile files. This tar file will be submitted to TEACH . In order to create the tar
file, use the following command:
tar –cvf assign2.tar
Makefile
You do not need to submit the txt files. The TA’s will have their own for grading.
Remember to sign up with a TA to demo your assignment. The deadline of demoing this
assignment without penalties is 5/10/2020.
联系我们
QQ:99515681
邮箱:99515681@qq.com
工作时间:8:00-21:00
微信:codinghelp
热点文章
更多
mgt202辅导 、讲解 java/pytho...
2025-06-28
讲解 pbt205—project-based l...
2025-06-28
辅导 comp3702 artificial int...
2025-06-28
辅导 cs3214 fall 2022 projec...
2025-06-28
辅导 turnitin assignment讲解...
2025-06-28
辅导 finite element modellin...
2025-06-28
讲解 stat3600 linear statist...
2025-06-28
辅导 problem set #3讲解 matl...
2025-06-28
讲解 elen90066 embedded syst...
2025-06-28
讲解 automatic counting of d...
2025-06-28
讲解 ct60a9602 functional pr...
2025-06-28
辅导 stat3600 linear statist...
2025-06-28
辅导 csci 1110: assignment 2...
2025-06-28
辅导 geography调试r语言
2025-06-28
辅导 introduction to informa...
2025-06-28
辅导 envir 100: introduction...
2025-06-28
辅导 assessment 3 - individu...
2025-06-28
讲解 laboratory 1讲解 留学生...
2025-06-28
辅导 ct60a9600 renewable ene...
2025-06-28
辅导 economics 140a homework...
2025-06-28
热点标签
mktg2509
csci 2600
38170
lng302
csse3010
phas3226
77938
arch1162
engn4536/engn6536
acx5903
comp151101
phl245
cse12
comp9312
stat3016/6016
phas0038
comp2140
6qqmb312
xjco3011
rest0005
ematm0051
5qqmn219
lubs5062m
eee8155
cege0100
eap033
artd1109
mat246
etc3430
ecmm462
mis102
inft6800
ddes9903
comp6521
comp9517
comp3331/9331
comp4337
comp6008
comp9414
bu.231.790.81
man00150m
csb352h
math1041
eengm4100
isys1002
08
6057cem
mktg3504
mthm036
mtrx1701
mth3241
eeee3086
cmp-7038b
cmp-7000a
ints4010
econ2151
infs5710
fins5516
fin3309
fins5510
gsoe9340
math2007
math2036
soee5010
mark3088
infs3605
elec9714
comp2271
ma214
comp2211
infs3604
600426
sit254
acct3091
bbt405
msin0116
com107/com113
mark5826
sit120
comp9021
eco2101
eeen40700
cs253
ece3114
ecmm447
chns3000
math377
itd102
comp9444
comp(2041|9044)
econ0060
econ7230
mgt001371
ecs-323
cs6250
mgdi60012
mdia2012
comm221001
comm5000
ma1008
engl642
econ241
com333
math367
mis201
nbs-7041x
meek16104
econ2003
comm1190
mbas902
comp-1027
dpst1091
comp7315
eppd1033
m06
ee3025
msci231
bb113/bbs1063
fc709
comp3425
comp9417
econ42915
cb9101
math1102e
chme0017
fc307
mkt60104
5522usst
litr1-uc6201.200
ee1102
cosc2803
math39512
omp9727
int2067/int5051
bsb151
mgt253
fc021
babs2202
mis2002s
phya21
18-213
cege0012
mdia1002
math38032
mech5125
07
cisc102
mgx3110
cs240
11175
fin3020s
eco3420
ictten622
comp9727
cpt111
de114102d
mgm320h5s
bafi1019
math21112
efim20036
mn-3503
fins5568
110.807
bcpm000028
info6030
bma0092
bcpm0054
math20212
ce335
cs365
cenv6141
ftec5580
math2010
ec3450
comm1170
ecmt1010
csci-ua.0480-003
econ12-200
ib3960
ectb60h3f
cs247—assignment
tk3163
ics3u
ib3j80
comp20008
comp9334
eppd1063
acct2343
cct109
isys1055/3412
math350-real
math2014
eec180
stat141b
econ2101
msinm014/msing014/msing014b
fit2004
comp643
bu1002
cm2030
联系我们
- QQ: 99515681 微信:codinghelp
© 2024
www.7daixie.com
站长地图
程序辅导网!