Write a program that prompt the user to enter 2 items, if the user purchases bread and butter he will have 16 % discount. If the user purchases butter and flour he will get 20% discount. Otherwise, there is no discount. Your program should accept only 2 items and each item to be purchased only 1 time. Item Name Bread Flour 1 2 3 Price 24 35 Butter 40 Sample run1: Please enter your 2 items: 1 3 Your purchase is: bread butter You should pay: 53.76 Sample run2: Please enter your 2 items: 2 3 Your purchase is: flour butter You should pay: 60.0 Sample run3: Please enter your 2 items: 1 2 Your purchase is: bread flour You should pay: 59.0 Sample run4: Please enter your 2 items: 2 2 An item can be purchased only 1 time Sample run5: Please enter your 2 items: 3 1 Your purchase is: butter bread You should pay: 53.76

C++ Programming: From Problem Analysis to Program Design
8th Edition
ISBN:9781337102087
Author:D. S. Malik
Publisher:D. S. Malik
Chapter4: Control Structures I (selection)
Section: Chapter Questions
Problem 20PE: The cost of renting a room at a hotel is, say $100.00 per night. For special occasions, such as a...
icon
Related questions
Question
Hello! Please I want this problem written in Java programming language
Write a program that prompt the user to enter 2 items, if the user purchases bread and butter he will have
16 % discount. If the user purchases butter and flour he will get 20% discount. Otherwise, there is no
discount. Your program should accept only 2 items and each item to be purchased only 1 time.
Name
Bread
Flour
Item
Price
1
24
2
3
35
40
Butter
Sample run1:
Please enter your 2 items: 1 3
Your purchase is:
bread butter
You should pay: 53.76
Sample run2:
Please enter your 2 items: 2 3
Your purchase is:
flour butter
You should pay: 60.0
Sample run3:
Please enter your 2 items: 1 2
Your purchase is:
bread flour
You should pay: 59.0
Sample run4:
Please enter your 2 items: 2 2
An item can be purchased only 1 time
Sample run5:
Please enter your 2 items: 3 1
Your purchase is:
butter bread
You should pay: 53.76
Transcribed Image Text:Write a program that prompt the user to enter 2 items, if the user purchases bread and butter he will have 16 % discount. If the user purchases butter and flour he will get 20% discount. Otherwise, there is no discount. Your program should accept only 2 items and each item to be purchased only 1 time. Name Bread Flour Item Price 1 24 2 3 35 40 Butter Sample run1: Please enter your 2 items: 1 3 Your purchase is: bread butter You should pay: 53.76 Sample run2: Please enter your 2 items: 2 3 Your purchase is: flour butter You should pay: 60.0 Sample run3: Please enter your 2 items: 1 2 Your purchase is: bread flour You should pay: 59.0 Sample run4: Please enter your 2 items: 2 2 An item can be purchased only 1 time Sample run5: Please enter your 2 items: 3 1 Your purchase is: butter bread You should pay: 53.76
Expert Solution
steps

Step by step

Solved in 2 steps with 5 images

Blurred answer
Knowledge Booster
Random Class and its operations
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
  • SEE MORE QUESTIONS
Recommended textbooks for you
C++ Programming: From Problem Analysis to Program…
C++ Programming: From Problem Analysis to Program…
Computer Science
ISBN:
9781337102087
Author:
D. S. Malik
Publisher:
Cengage Learning
Microsoft Visual C#
Microsoft Visual C#
Computer Science
ISBN:
9781337102100
Author:
Joyce, Farrell.
Publisher:
Cengage Learning,