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!
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!
C++ Programming: From Problem Analysis to Program Design
8th Edition
ISBN:9781337102087
Author:D. S. Malik
Publisher:D. S. Malik
Chapter3: Input/output
Section: Chapter Questions
Problem 11SA: 11. What is the purpose of the manipulator setw? Which header file must be included to use the...
Related questions
Question
please I need help
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 now
This is a popular solution!
Step by step
Solved 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.Recommended textbooks for you
C++ Programming: From Problem Analysis to Program…
Computer Science
ISBN:
9781337102087
Author:
D. S. Malik
Publisher:
Cengage Learning
C++ Programming: From Problem Analysis to Program…
Computer Science
ISBN:
9781337102087
Author:
D. S. Malik
Publisher:
Cengage Learning