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?
-
What changes are made in the franchisors recording of the initial franchise fee when the franchise agreement: (a) Contains an option allowing the franchisor to purchase the franchised outlet, and it...
-
In problems, first find the domain of the given function f and then find where it is increasing and decreasing, and also where it is concave upward and downward. Identify all extreme values and...
-
Jackson and Richard formed a partnership on 1 July 2025, agreeing to share profits and losses in the ratio of 2:1. Jackson contributed \($30\) 000 in cash and land with a fair value of \($180\) 000....
-
1. Your notebook computers hard drive recently crashed, and you decide to take it to a local repair technician to have it fixed. In this relationship, a. you are the agent. b. the technician is the...
-
(a) Explain four reasons why multinational corporations (MNCs) forecast exchange rates. (b) (4 marks) SPL Limited, a company based in Kenya expects to receive 2 million Euros in one year's time. The...
-
Kate Collins has opened Fontina and Stuff, a wholesale grocery and cheese company. The following transactions occurred in February: Required 1. Journalize the transactions. Beginning balances of...
-
Create two sample budget reports for medical clothing store business (Cash Budget and Selling and Administrative Expense Budget) selling scrubs, shoes and lab coats. Use Excel and justify your budget...
-
What is the output of the Plant program? class Bush extends Plant { String type="bush"; } public class Plant { } String type = "plant"; public static void main(String[] args) { Plant w1= new Bush();...
-
What is the output of the following code snippet? A. 1 B. 55 C. 56 D. It does not compile. String tree = "pine"; int count = 0; if (tree.equals("pine")) { } int height 55; count count + 1;...
-
Suppose Panther and Cub are interfaces and neither contains any default methods. Which statements are true? (Choose two.) A. If Panther has a single abstract method, Cub is guaranteed to be a...
-
Which of the following statements are correct? (Choose two.) A. Java allows multiple inheritance using two abstract classes. B. Java allows multiple inheritance using two interfaces. C. Java does not...
-
Which is the first line containing a compiler error? A. x1 B. x2 C. x3 D. None of the above var title="Weather"; // line x1 var hot 100, var cold = 20; // line x2 = var f = 32, int c = 0; // line x3
-
The Memphis Redbirds , a AAA Minor League baseball team,are deciding how to price tickets for their upcoming (2022) seasonand trying to predict ticket demand. They hire you to helpthem. You find that...
-
Proposals have been made to ?sail? spacecraft to the outer solar system using the pressure of sunlight, or even to propel interstellar spacecraft with high-powered, Earth-based lasers. Sailing...
-
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.
-
Why do you and your business need to be able to communicate well?
-
What are the basic criteria for effective messages?
-
What are the questions for analyzing a business communication situation?
Study smarter with the SolutionInn App