Now that we have one module, we are going to write the driver for this module: Y
ID: 3829892 • Letter: N
Question
Now that we have one module, we are going to write
the driver for this module: YourName-Hwrk06.py
• Initially, this driver will just run this first module.
However, after you’ve got the first module working, you
will be expanding this driver to include 4 additional
modules.
• Below is the essence of the driving program which will
run this File Management System to test and run the
module LastnameFirstInitial_coffee_records.py
# Your Name
# A Coffee File Management Program
import ValdezJ_coffee_records # Here’s where we import the module that we just made. But it should have your LastnameFirstInitial Not ValdezJ
ADD_COFFEE_CHOICE = 1 # Define Global constants for all your choices
QUIT_CHOICE = 6 # Which includes the choice to quit
def main():
choice = 0
while choice != QUIT_CHOICE:
display_menu()
choice = int(input('Enter your choice: '))
if choice == ADD_COFFEE_CHOICE:
ValdezJ_coffee_records.add_coffee() # We call the function add_coffee() contained in imported Module LastnameFirstInitial_coffee_records
elif choice == QUIT_CHOICE:
print('Exiting the program...')
else:
print('Error: invalid selection.')
def display_menu():
print(' JUAN VALDEZ COFFEE MANAGEMENT MENU')
print('1) Add more Coffee Choices to List')
print('6) Quit')
main()
Once you have the first module up and running, now you
will repeat what you did and add to the module, the second:
Program 6-16, which contains the function show_coffee().
• Then you will expand the driver program menu to include
this additional module
• You will also import this module
• You will change the menu to include this module
• Once the second function is working, repeat the preceding 3
more times to include: Program 6-17, Program 6-18 and
Program 6-19.
• From these three programs you will be adding the following
functions to your module: LastnameFirstInitial_coffee_records
• search_coffee()
• modify_coffee()
• delete_coffee()
• Modify your driver program to accommodate these
additions.
Explanation / Answer
import ValdezJ_coffee_records # Here’s where we import the module that we just made. But it should have your LastnameFirstInitial Not ValdezJ
ADD_COFFEE_CHOICE = 1 # Define Global constants for all your choices
SHOW_COFFEE_CHOICE = 2
SEARCH_COFFEE_CHOICE = 3
MODIY_COFFEE_CHOICE = 4
DELETE_COFFEE_CHOICE = 5
QUIT_CHOICE = 6 # Which includes the choice to quit
def main():
choice = 0
while choice != QUIT_CHOICE:
display_menu()
choice = int(input('Enter your choice: '))
if choice == ADD_COFFEE_CHOICE:
ValdezJ_coffee_records.add_coffee() # We call the function add_coffee() contained in imported Module LastnameFirstInitial_coffee_records
elif choice == SHOW_COFFEE_CHOICE:
ValdezJ_coffee_records.show_coffee()
elif choice == SEARCH_COFFEE_CHOICE:
ValdezJ_coffee_records.search_coffee()
elif choice == MODIY_COFFEE_CHOICE:
ValdezJ_coffee_records.modify_coffee()
elif choice == DELETE_COFFEE_CHOICE:
ValdezJ_coffee_records.delete_coffee()
elif choice == QUIT_CHOICE:
print('Exiting the program...')
else:
print('Error: invalid selection.')
def display_menu():
print(' JUAN VALDEZ COFFEE MANAGEMENT MENU')
print('1) Add more Coffee Choices to List')
print('2) Show Coffee')
print('3) Search Coffee')
print('4) Modify Coffee')
print('5) Delete Coffee')
print('6) Quit')
main()
# I have made changes to your priver program as that is only one provided.
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.