more students will apply their (Python) programming skills to develop a few short programs that DBVac...
Fantastic news! We've Found the answer you've been seeking!
Question:
Transcribed Image Text:
more students will apply their (Python) programming skills to develop a few short programs that DBVac thinks will help the company so in some cases than in others. Specific programming skills will include data input and output, variables, Python lists and indexes, loops, and if-statements. Background DustBunny Vacuums, a company we've heard from before, needs you to code a suite of small applications for them to help with some of the common activities performed by their employees. Two of these applications will require you to connect to (your personal version of) the DBVac database. Remembering the structure of that database might be helpful for those two, so here's an ERD: Customer PK CustID FK CustState FName LName Gender HHI Marital Children HasPets USState PK StatelD FK RegionID StateName Population Region PK RegionID RegionName HQCity PK FK SalesOrder SOID CustID SODate Order Total Service PK SvcID FK CustID FK Product SvcDate SvcDays SvcRating PK FK FK OrderLine OLID SOID ModellD ModelPrice Qty Line Total Product PK ModelID ModelName MSRP Cost ProdType Part B Customer Lookup (25 points) Write a program called lookup.py that enables DBVac employees to look up a customer by name or CustID, then output the data regarding the matching customer(s). Your program should: ● ● Include a comment in the first line with your name. Include comments describing each major section of code. Connect to your personal version of the DBVac database. Ask the user if they would like to look up the customer by ID or by name. Validate that the user enters a valid selection. O If they want to look the customer up by ID, then: O Ask the user to input a customer ID number. O Validate that what is entered is an integer. If it's not, then ask the O user to try again. Run a SQL query to get the information about the customer whose ID matches what was entered. For the matching customer, output the customer's ID, first name, last name, gender, the name of the state that the customer is from, and the population of that state (show as an integer). Print the returned record all on one line. ■ I Provide labels for each (e.g., Last Name: Springfield, First Name: Jebediah, etc.). If they want to look the customer up by name, then: O Ask the user to input a first name (or leave blank). ● O O O Ask the user to input a last name. Validate that they have entered an actual value here. If they leave this null, keep asking the user for a last name until they enter something valid. Run a SQL query to get the information about the customer(s) whose name(s) match(es). If the user left the first name blank, then the query should return all customers whose last names match the last name entered. ■ For the matching customer, output the customer's ID, first name, last name, gender, the name of the state that the customer is from, and the population of that state (show as an integer). Print the returned record all on one line. ■ Provide labels for each (e.g., Last Name: Springfield, First Name: Jebediah, etc.). 1 Extra Credit Point: If no records are returned for a given query (of either type), tell the user that no records match the value(s) entered by the user. Ask the user if they want to look up another customer and, if so, go through this same process again. I Once the user's done entering records, say thank you and tell them, forcefully, to have a nice day. more students will apply their (Python) programming skills to develop a few short programs that DBVac thinks will help the company so in some cases than in others. Specific programming skills will include data input and output, variables, Python lists and indexes, loops, and if-statements. Background DustBunny Vacuums, a company we've heard from before, needs you to code a suite of small applications for them to help with some of the common activities performed by their employees. Two of these applications will require you to connect to (your personal version of) the DBVac database. Remembering the structure of that database might be helpful for those two, so here's an ERD: Customer PK CustID FK CustState FName LName Gender HHI Marital Children HasPets USState PK StatelD FK RegionID StateName Population Region PK RegionID RegionName HQCity PK FK SalesOrder SOID CustID SODate Order Total Service PK SvcID FK CustID FK Product SvcDate SvcDays SvcRating PK FK FK OrderLine OLID SOID ModellD ModelPrice Qty Line Total Product PK ModelID ModelName MSRP Cost ProdType Part B Customer Lookup (25 points) Write a program called lookup.py that enables DBVac employees to look up a customer by name or CustID, then output the data regarding the matching customer(s). Your program should: ● ● Include a comment in the first line with your name. Include comments describing each major section of code. Connect to your personal version of the DBVac database. Ask the user if they would like to look up the customer by ID or by name. Validate that the user enters a valid selection. O If they want to look the customer up by ID, then: O Ask the user to input a customer ID number. O Validate that what is entered is an integer. If it's not, then ask the O user to try again. Run a SQL query to get the information about the customer whose ID matches what was entered. For the matching customer, output the customer's ID, first name, last name, gender, the name of the state that the customer is from, and the population of that state (show as an integer). Print the returned record all on one line. ■ I Provide labels for each (e.g., Last Name: Springfield, First Name: Jebediah, etc.). If they want to look the customer up by name, then: O Ask the user to input a first name (or leave blank). ● O O O Ask the user to input a last name. Validate that they have entered an actual value here. If they leave this null, keep asking the user for a last name until they enter something valid. Run a SQL query to get the information about the customer(s) whose name(s) match(es). If the user left the first name blank, then the query should return all customers whose last names match the last name entered. ■ For the matching customer, output the customer's ID, first name, last name, gender, the name of the state that the customer is from, and the population of that state (show as an integer). Print the returned record all on one line. ■ Provide labels for each (e.g., Last Name: Springfield, First Name: Jebediah, etc.). 1 Extra Credit Point: If no records are returned for a given query (of either type), tell the user that no records match the value(s) entered by the user. Ask the user if they want to look up another customer and, if so, go through this same process again. I Once the user's done entering records, say thank you and tell them, forcefully, to have a nice day.
Expert Answer:
Answer rating: 100% (QA)
Solution import mysqlconnector def searchbyidcursor Ask user to input a customer ID number while Tru... View the full answer
Related Book For
Systems analysis and design
ISBN: 978-0136089162
8th Edition
Authors: kenneth e. kendall, julie e. kendall
Posted Date:
Students also viewed these programming questions
-
a. Northern Corporation's stock has a beta of 1.4. Short term government securities yield 5% and the market portfolio offers an expected return of 14%. Find the required return on Northern's stock....
-
The following interviews were conducted prior to the start of the project to explore specific aspects of Z Cheddr business processes. The interviews with employees provide information that is...
-
Planning is one of the most important management functions in any business. A front office managers first step in planning should involve determine the departments goals. Planning also includes...
-
What is the square root of 3 to the square root of 2 power times the square root of 3 to the negative square root of 2 power?
-
Perfect Image Ltd produces two types of computer printers, a laser model and an inkjet model, which pass through two production departments. Fabrication and Assembly. The following data relate to the...
-
A 100-g toy car is propelled by a compressed spring that starts it moving. The car follows the curved track in Figure 7.36. Show that the final speed of the toy car is 0.687 m/s if its initial speed...
-
How does Porters competitive forces model help companies develop competitive strategies using information systems? Define Porters competitive forces model and explain how it works. Describe what...
-
Static versus flexible budget variances Dan Ludwig is the manufacturing production supervisor for Atlantic Lighting Systems. Trying to explain why he did not get the year-end bonus that he had...
-
Please answer the following question: Luis wants to know how much he will have available to spend on his trip to Belize in three years if he deposits ?$2,600 today at an interest rate of 2?%.
-
You, CPA, work as the assistant controller for A-Plus Corp (A-Plus). You are currently working on a project with the mergers and acquisitions group, which is responsible for integrating the recent...
-
A $345,000.00 mortgage is repaid in 19 years by making monthly payments of $2,486.44. If the interest rate does not change, how much interest is paid during the first 5 years of the mortgage?
-
Describe at a high level the various cost categories and expenditures.Describe in detail the significant items in the budget, including how these expenses and revenues were determined and why they...
-
A company named ABC hired three employees in different years; each employee gets an increment of 5000 yearly. Also each employee gets bonus amount of 10k for each project he has done yearly. The...
-
You are scheduled to receive $9000 in 3 years. When you receive it, you will invest it for 12 years at a rate of 5.50%. How much will you have at the end of 15 years? Present value Discount rate (r)...
-
1. For each of the following scenarios, determine whether the mother's preferences are consistent with her being an expected utility maximiser and explain your answer in no more than 2 sentences. (a)...
-
Carey Enterprises sold equipment on January 1, 2018 for $10,000. The equipment had cost $48,000. The balance in Accumulated Depreciation at January 1 is $40,000. What entry would Carey make to record...
-
NPV. Grady Precision Measurement Tools has forecasted the following sales and costs for a new GPS system: annual sales of 44,000 units at $17 a unit, production costs at 39% of sales price, annual...
-
A spacecraft has left the earth and is moving toward Mars. An observer on the earth finds that, relative to measurements made when the spacecraft was at rest, its a. length is shorter b. KE is less...
-
Why is a labeling data flow diagram so important? What can effective labels on data flow diagrams accomplish for those unfamiliar with the system?
-
Divide your group into two subgroups. One subgroup should interview the members of the other subgroup about their experiences encountered in registering for a class. Questions should be designed to...
-
Define HCI.
-
Determine the conjugate of \(5+\sqrt{6}\).
-
Determine the conjugate of \(10-\sqrt{13}\).
-
\(\frac{20}{\sqrt{150}}\) Rationalize the denominators of the fractions, and then simplify.
Study smarter with the SolutionInn App