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 > с 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!

Database System Concepts
7th Edition
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Chapter1: Introduction
Section: Chapter Questions
Problem 1PE
icon
Related questions
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
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
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!
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
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 2 steps with 2 images

Blurred answer
Knowledge Booster
Troubleshooting
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.
Recommended textbooks for you
Database System Concepts
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)
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
C How to Program (8th Edition)
C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON
Database Systems: Design, Implementation, & Manag…
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
Programmable Logic Controllers
Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education