
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
please I need help
![Problem 3 (Using different payment methods)
Write a program called a2_p3.py where you will be adding options to the previously written code
so that users can pay by different methods. Copy your solution from the previous part into the
new file (a2_p3.py). Do not overwrite your previous solution, as the TAs will want to see them
both.
Modify your code from the previous part so that once the customer finishes selection from the
menu and sees the receipt, they are presented with one final menu. This menu should allow the
customer to select the pay options. Their choices should be:
(а) Cash
(b) One time pay card
Again, the user should make their selection by entering the corresponding character ´a' or 'b’, and
bad selections should cause the menu to repeat (see sample outputs below). If customer chooses
"Cash', your program should print that payment is completed and program should terminate. If the
choice is 'One time pay card' then your program asks for a 4-digit card number and displays the
invoice (see the sample output) and terminates. The card number should be exactly a 4-digit
positive integer. For bad input repeat the menu (see sample outputs below). You are not supposed
to use len() function to check the number of digits. Instead, you should use arithmetic operators –
you did this in tutorial.
Note: To find the last 2 digits '76' of the sample 4-digit number 9876, you must not use any
string processing functions. Instead, you should use arithmetic operators that we covered in class.
Sample output – 1:
it will first print similar content as shown in the previous part and then
How would you like to pay? Select one from the following menu.
(а) Cash
(b) One time pay card
> C
Sorry, c is not a valid choice! Please select from the menu.
How would you like to pay? Select one from the following menu.
(а) Cash
(b) One time pay card
> b
Enter 4 digit card number: 234567
It must be 4 a digit integer, please enter again.
Enter 4 digit card number: -4567
Try again, card number must be a positive integer.
Enter 4 digit card number: 9876
You have paid by a one time pay card [xx76]. Have a nice day!
Page 6 of 7](https://content.bartleby.com/qna-images/question/08b27964-f736-48a1-b0ab-3bda23629c3c/3713d2e2-bf18-4f2d-810f-d3b829f66e70/lowt9k8_thumbnail.png)
Transcribed Image Text:Problem 3 (Using different payment methods)
Write a program called a2_p3.py where you will be adding options to the previously written code
so that users can pay by different methods. Copy your solution from the previous part into the
new file (a2_p3.py). Do not overwrite your previous solution, as the TAs will want to see them
both.
Modify your code from the previous part so that once the customer finishes selection from the
menu and sees the receipt, they are presented with one final menu. This menu should allow the
customer to select the pay options. Their choices should be:
(а) Cash
(b) One time pay card
Again, the user should make their selection by entering the corresponding character ´a' or 'b’, and
bad selections should cause the menu to repeat (see sample outputs below). If customer chooses
"Cash', your program should print that payment is completed and program should terminate. If the
choice is 'One time pay card' then your program asks for a 4-digit card number and displays the
invoice (see the sample output) and terminates. The card number should be exactly a 4-digit
positive integer. For bad input repeat the menu (see sample outputs below). You are not supposed
to use len() function to check the number of digits. Instead, you should use arithmetic operators –
you did this in tutorial.
Note: To find the last 2 digits '76' of the sample 4-digit number 9876, you must not use any
string processing functions. Instead, you should use arithmetic operators that we covered in class.
Sample output – 1:
it will first print similar content as shown in the previous part and then
How would you like to pay? Select one from the following menu.
(а) Cash
(b) One time pay card
> C
Sorry, c is not a valid choice! Please select from the menu.
How would you like to pay? Select one from the following menu.
(а) Cash
(b) One time pay card
> b
Enter 4 digit card number: 234567
It must be 4 a digit integer, please enter again.
Enter 4 digit card number: -4567
Try again, card number must be a positive integer.
Enter 4 digit card number: 9876
You have paid by a one time pay card [xx76]. Have a nice day!
Page 6 of 7

Transcribed Image Text:Sample output – 2 (if 'a’ was selected):
How would you like to pay? Select one from the following menu.
(a) Cash
(b) One time pay card
> a
Thank you for your payment. Have a nice day!
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 2 steps with 2 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
- A number used once in a challenge response system is a A. key B. password C. timestamp D. noncearrow_forwardIs it safe for kids under 16 to use the internet now that there are protections in place? If this is not the case, what other options do governments have?arrow_forwardInstructions: Circle T if the statement is true, F if the statement is false, or write the best answer in the space provided. Performing financial transactions over the Internet is called___________.arrow_forward
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