Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Problem #1: [35 pts] Write a program that prompt the user to enter 2 items, if the user purchases bread and butter he will
Problem #1: [35 pts] Write a program that prompt the user to enter 2 items, if the user purchases bread and butter he will have 10% discount. If the user purchases butter and flour he will get 15% discount. Otherwise, there is no discount. Your program should accept only 2 items and each item to be purchased only 1 time. Sample run1: Name Bread Item 1 Price 20 Flour 2 25 Butter 3 30 Please enter your 2 items: 13 Your purchase is: bread butter You should pay: 45.0 Sample run2: Please enter your 2 items: 23 Your purchase is: flour butter You should pay: 46.75 Sample run3: Please enter your 2 items: 1 2 Your purchase is: bread flour You should pay: 45.0. Sample run4: Please enter your 2 items: 22 An item can be purchased only 1 time Sample run5: Please enter your 2 items: 31 Your purchase is: butter bread You should pay: 45.0 Page 3 / + Sample Run 1: Enter a 2 digits: 1 6 Wrong, 9 tries left Enter 2 digits: 3 5 Wrong, 8 tries left Enter 2 digits: 1 6 Wrong, 7 tries left Enter 2 digits: 9 1 Congratulations, You win the tombola, the random number is 91 ! Sample Run 2: Enter 2 digits: 1 9 Wrong, 9 tries left. Enter 2 digits: 1 2 Wrong, 8 tries left Enter 2 digits: 26 Wrong, 7 tries left Enter 2 digits: 1 6 Wrong, 6 tries left Enter 2 digits: 19 Wrong, 5 tries left Enter 2 digits: 1 2 Wrong, 4 tries left Enter 2 digits: 1 9 Wrong, 3 tries left Enter 2 digits: 1 3 Wrong, 2 tries left Enter 2 digits: 90 Wrong, 1 tries left Enter 2 digits: 9 8 Wrong, 0 tries left. You lost, the random number is 45 ! Page 4 / 4 - Q + Page 4 of 4
Step by Step Solution
★★★★★
3.52 Rating (152 Votes )
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started