Database System Concepts
7th Edition
ISBN: 9780078022159
Author: Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher: McGraw-Hill Education
expand_more
expand_more
format_list_bulleted
Question
Python help.
Write a menu-driven program for Food Court.
Display the food menu to a user (Just show the 5 options' names and prices - No need to show the details!)
Use numbers for the options and the number "6" to exit. If the user enters "6", your code should not ask any other questions, just show a message like "Thank you, hope to see you again!"
Ask the user what he/she wants and how many of them. (Check the user inputs)
Keep asking the user until he/she chooses the exit option.
Use a data structure to save the quantities of the orders. You should use ArrayLists/Array Bags, or LinkedLists/LinkedBags (one or more of them) to save data.
Calculate the price.
Ask the user whether he/she is a student or a staff. There is no tax for students and a 9% tax for staff. Add the tax price to the total price.
Display(print) the bill to the user. The bill includes:
The food items
The quantities
The cost of them
The total before tax
Tax
Total price after tax
You can have your own design. The names of functions are also up to your design but the names should show what the functions do.
Only display 2 decimal points when displaying all the numbers.
Create a class of orders or other needed classes.
Use at least one superclass and one or more subclasses and overridden methods. (For example, a Burger class can be a superclass and other types of burgers can be subclasses (the methods related to the price and the name can be overridden). The person class is also a good idea to be a superclass and Staff and Student can be the subclasses (the methods related to the tax can be overridden)
Important=> Put each part and class in different Python files and import them when you want to use them (use "from" and "import" keywords).
Create an object for the Order class to run the code.
Print the bill on the screen
Save the bill in a file.
**************************************************************************************************
Sample template:
(As I mentioned, these all are samples and you can have your own design and naming.)
# Creating an object of the class "Order"
class Order:
'''
The doc string for this class
'''
def __init__(self):
self._priceBtax = 0
self._priceAtax = 0
self._tax = 0
def displayMenu(self):
'''
The doc string for this method
'''
#This is a sample and you can have your own design
print("\n----------- Food Court -----------")
def getInputs(self):
'''
The doc string for this method
'''
#You need to fill it
# Calculate the price before and after tax
def calculate(self):
'''
The doc string for this method
'''
# Print the bill on the console
def printBill(self):
'''
The doc string for this method
'''
# Save the bill in a file
def saveToFile(self):
'''
The doc string for this method
'''
#You need to fill it
with open(orderTimeStamp,'w') as fileHandleToSaveTheBill :
#Save the bill in the file
#hint: it's like printBill but you need to use "write"
In a separate file create two objects and run the related methods:
from theFileYouSavedOrderClass import Order
if __name__ == "__main__":
flag = True
while flag:
order = Order()
order.displayMenu()
order.getInputs()
order.calculate()
order.printBill()
order.saveToFile()
userInputToContinue = input("Continue for another order(Any keys= Yes, n= No)?")
if userInputToContinue.lower() == 'n':
print("The system is shutting down!")
flag = Flase
You should use ArrayLists/Array Bags, or LinkedLists/LinkedBags (one or more of them) to save data.
Use at least one subclass and one superclass.
Don't forget Doc Strings for the class and all methods
Only display 2 decimal points when displaying all the numbers.
Put at least two outputs (results after you run your code) at the end of your code as a multi-line comment.
Don't forget to put your name and a short description of your code on top of your code.
Don't forget to test your code with Positive and Negative Testing! => Your code should show an error if you enter invalid inputs.
Do not forget to submit TWO output text files (their names should be based on the format mentioned above) with your Python file here.
Submit your Python code and TWO output text files here.
Expert Solution
This question has been solved!
Explore an expertly crafted, step-by-step solution for a thorough understanding of key concepts.
This is a popular solution
Trending nowThis is a popular solution!
Step by stepSolved in 5 steps with 7 images
Knowledge Booster
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.Similar questions
- PYTHON programming solotion Develop a program that allows the user to enter a start value of 1 to 4, a stop value of 5 to 12 and a multiplier of 2 to 8. The program must display a multiplication table with results using these values. For example, if the user enters a start value of 3, a stop value of 7 and a multiplier value of 3, the table should be displayed as follows: Multiplication Table 3 x 3 = 9 3 x 4 = 12 3 x 5 = 15 3 x 6 = 18 3 x 7 = 21 additionally Each multiplication problem must be displayed with a problem number. The program must prompt the user to enter an answer to each of the multiplication problems. The correct answer should be displayed after the user enters an answer. A message should be displayed informing the user that the answer entered was correct or incorrect followed by an appropriate motivating comment. A running record of the number of correct and incorrect responses must be kept. After all the problems have been presented the user must be informed of…arrow_forwardPlease Help Java Programming HospitalPlaylist also wants to rebuild their sales system. You are also tasked to create this program using Java programming language with following concepts: The following are the specifications for the program: First, the program will display main menu consists of: Add Song Rent Song Exit If the user chooses menu 1 (“Add Song”), the program will prompt the user to input: Song Name. The input must be between 5 and 10 characters. Song Genre. The input must be either “Pop”, “Classic” or “Jazz” (case sensitive). Song Rating. The input must be between 1 and 5 Song Type. The input must be either “Band” or “Solo” (case sensitive) After that, the program will generate the Server ID in the following format: If Song Type is “Band” then these is the following format : BDXX (X= random, number from 0 -- 9) If Song Type is “Solo” then these is the following format : SLXX (X= random, number from 0 -- 9) Then the program will insert the song data, show a success…arrow_forwardJason opened a coffee shop at the beach and sells coffee in three sizes: small (9 oz), medium (12 oz), and large (15 oz). The cost of one small cup is $1.75, one medium cup is $1.90, and one large cup is $2.00. Write a menu-driven (using structure) program that will make the coffee shop operational. Your program should allow the user to do the following: a. Buy coffee in any size and in any number of cups. b. At any time show the total number of cups of each size sold. c. At any time show the total amount of coffee sold. d. At any time show the total money made. Your program should consist of at least the following functions: a function to show the user how to use the program, a function to sell coffee, a function to show the number of cups of each size sold, a function to show the total amount of coffee sold, and a function to show the total money made. Your program should not use any global variables and special values such as coffee cup sizes and cost of a coffee cup must be…arrow_forward
- A small airline has purchased a computer for its new automated navigation system. Write a program to assign seats on each flight of airline only plane (capacity: 10 seats). Your program should display the following menu. “Please type 1 for first class 2 for economy class and 3 to reviews seats chart.” 1. If a person Type 1 your program should assign a seat in first class section 1 to 5. 2. If person type 2 your program should assign a seat in economy class section 6 to 10. 3. Your program should print boarding pass indicating the person seat number weather in first class or economic class of plane. 4. Use one dimensional array to represent seating chart indicate all seats are empty. As each seat is assigned the corresponding element set to 1, to indicate that no seat is available. Your program should of course never assign a seat that has been already assigned. 5. When all seats are filled then print the message “All seats are filled next flight leaves in 3 hours.”arrow_forwardTrue or False: Adding more control variables will always increase the R 2 value. True Falsearrow_forwardCreate starting menu using Pythonarrow_forward
- This is not opinion based question. Create a module in Excel -Use an input box to ask for a phrase of at least 10 characters For now, don’t worry about checking it if it has 10 characters -Display messages to user (not in immediate window): -number of characters in the-phrase-First 4 characters-Last 6 characters-Character number 5-All but the first and last charactersarrow_forwardThe condition that controls a Do While loop must be true for the loop to be executed. Checkboxes are used in designing the user interface for situations where the user may choose only one of a few choices. Boolean variables are often used to improve the readability / clarity of the program code. For Next loops can have both negative and positive step values. If no item has been selected in a listbox, the SelectedIndex property of the listbox will have a value of zero. A Boolean variable must be initialized after the If instruction in which it is used is executed. A post-test loop is a loop that is designed to be executed at least once. In coding a Select Case instruction, the only thing that may appear after the Select Case keywords is a variable. A Do loop begins with the keyword Do and ends with the keyword Loop. The condition that controls a Do Until loop must be true for the loop to be executed. Radio buttons are used in designing the user interface for situations where the user…arrow_forwardConvert the QuartsToGallons program to an interactive application. Instead of assigning a value to the number of quarts, accept the value from the user as input. An example of the program is shown below: Enter quarts needed >> 20 A job that needs 20 quarts requires 5 gallons plus 0 quarts.arrow_forward
- read carefully the question and answer properly subject software engineering language C++ Question Suppose a company wants to develop software for an alarm clock. The clock shows the time of day. Using buttons, the user can set the hours and minutes fields individually, and choose between 12 and 24-hour display. It is possible to set one or two alarms. When an alarm fires, it will sound some noise. The user can turn it off, or choose to ‘snooze’. If the user does not respond at all, the alarm will turn off itself after 2 minutes. ‘Snoozing’ means to turn off the sound, but the alarm will fire again after some minutes of delay. This ‘snoozing time’ is pre-adjustable. Draw state machine diagram for the above scenario. Draw State Chart diagram for the above scenario.arrow_forwardPython: Vowel: Display a vowel selected at random.arrow_forwardYou have been hired by a local smoothie shop to a program that will calculate the cost of a smoothie order. The shop sells four types of smoothies in three different sizes: Small (20 oz), Medium (32 oz) and Large (40 oz). Your program should use a menu for the type of smoothie and a second menu for the smoothie size. Calculate the total cost of the order including tax and display a bill for the smoothie. See the Sample Output. The sales tax rate is 4.5%. Use named constants to hold the cost per ounce of each of the products and the sales tax rate. Use the constants in your calculations and wherever else they are appropriate in your program. Product Cost per Ounce Banana $0.62Strawberry $0.60 Mango $0.48 Blueberry $0.57 Project 3 is a continuation of Projects 1 and 2. You will modify your code from Project 2 to make the program modular for this part of…arrow_forward
arrow_back_ios
SEE MORE QUESTIONS
arrow_forward_ios
Recommended textbooks for you
- Database System ConceptsComputer ScienceISBN:9780078022159Author:Abraham Silberschatz Professor, Henry F. Korth, S. SudarshanPublisher:McGraw-Hill EducationStarting Out with Python (4th Edition)Computer ScienceISBN:9780134444321Author:Tony GaddisPublisher:PEARSONDigital Fundamentals (11th Edition)Computer ScienceISBN:9780132737968Author:Thomas L. FloydPublisher:PEARSON
- C How to Program (8th Edition)Computer ScienceISBN:9780133976892Author:Paul J. Deitel, Harvey DeitelPublisher:PEARSONDatabase Systems: Design, Implementation, & Manag...Computer ScienceISBN:9781337627900Author:Carlos Coronel, Steven MorrisPublisher:Cengage LearningProgrammable Logic ControllersComputer ScienceISBN:9780073373843Author:Frank D. PetruzellaPublisher:McGraw-Hill Education
Database System Concepts
Computer Science
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:McGraw-Hill Education
Starting Out with Python (4th Edition)
Computer Science
ISBN:9780134444321
Author:Tony Gaddis
Publisher:PEARSON
Digital Fundamentals (11th Edition)
Computer Science
ISBN:9780132737968
Author:Thomas L. Floyd
Publisher:PEARSON
C How to Program (8th Edition)
Computer Science
ISBN:9780133976892
Author:Paul J. Deitel, Harvey Deitel
Publisher:PEARSON
Database Systems: Design, Implementation, & Manag...
Computer Science
ISBN:9781337627900
Author:Carlos Coronel, Steven Morris
Publisher:Cengage Learning
Programmable Logic Controllers
Computer Science
ISBN:9780073373843
Author:Frank D. Petruzella
Publisher:McGraw-Hill Education