Problem #1: [35 pts] Write a program that prompt the user to enter 2 items, if...
Fantastic news! We've Found the answer you've been seeking!
Question:
Transcribed Image Text:
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 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
Expert Answer:
Related Book For
Java How To Program Late Objects Version
ISBN: 9780136123712
8th Edition
Authors: Paul Deitel, Deitel & Associates
Posted Date:
Students also viewed these programming questions
-
You are required to write a Python program that will manage character (heroes and villain) information. Character (hero and villain) information will be stored in a text file that will be read in...
-
can someone solve this Modern workstations typically have memory systems that incorporate two or three levels of caching. Explain why they are designed like this. [4 marks] In order to investigate...
-
For students in the United States, compare Medicaid coverage in your state with coverage afforded to recipients in a neighboring state. Are they the same? If not, why do you think that they differ?
-
Selected information (in U.S. $ millions) for Google Inc. and Microsoft Corp. for 2015 and 2016, respectively, follows: ________________________________________________Google............Microsoft Net...
-
Problem 11.3-2 describes how the owner of a chain of three grocery stores needs to determine how many crates of fresh strawberries should be allocated to each of the stores. Formulate a compact...
-
Epic Systems is a Wisconsin health care software company. In 2014, Epic introduced a company policy that required employees to use individual arbitration in any disputes. Jacob Lewis, an Epic...
-
Quay Co. had the following transactions during the current period. Mar. 2 Issued 5,000 shares of $5 par value common stock to attorneys in payment of a bill for $30,000 for services performed in...
-
2. A plain concrete cylinder with dimensions of 12" height and 6" diameter is tested using spilt tension test. The failure load was measured to be 70 kN. What is the indirect tensile strength of...
-
On January 1, 2024, Palmero Company purchased an 80% interest in Santos Company for $2,800,000, at which time Santos Company had retained earnings of $1,000,000 and capital stock of $500,000. On the...
-
(5) The table below shows results of Dr. Rodriguez's study, specifically the mean memory performance of each age group at each time of measurement. Use the data in the table to draw a graph of memory...
-
X Company has four inventory items at year end. Inventory information (based on FIFO) is as follows: Determine X Companys ending inventory using the lower-of-cost-or-market method. Item 1 2 3 Cost...
-
Emily Eagels owned stock with a basis of $50,000 which she sold to her sister, Janet, for $42,000. Three months later, Janet sold the stock through a broker for $52,000. What is the gain or loss to...
-
On September 16, 2019, Donald Dunn sold for $80,000 property with an adjusted basis of $20,000. The buyer paid $20,000 down with the remaining $60,000 to be paid in four equal annual installments of...
-
Sheryl Sugarman owned 60 percent of the outstanding stock of Octavian Corp. The corporation sold stock (cost $5,000) to her for $2,500. Sheryl sold the stock for $7,000. What is the corporation's...
-
During 2019, Peter Patel sold a piece of land he had purchased for $40,000. The buyer paid cash of $50,000 and transferred to Peter a piece of farm equipment having a fair market value of $30,000....
-
Mainfreight New Zealand is a publicly listed company that offers freight transport and warehousing services locally and abroad through international alliances. Suppose the company owns a piece of...
-
The activities listed in lines 2125 serve primarily as examples of A) Underappreciated dangers B) Intolerable risks C) Medical priorities D) Policy failures
-
Obesity in America is increasing at an alarming rate. Check the map from the Centers for Disease Control and Prevention (CDC) at http://www.cdc.gov/obesity/data/adult.html, which shows obesity trends...
-
Create an app that displays a rectangle with a shadow and allows the user to control the shadow using Sliders. Investigate class DropShadow (package javafx.scene.effect). Use Node method setEffect to...
-
What does the following code print? System.out.printf(" ****%n ******%n*******%n ******%n ****%n");
-
What is the purpose of environmental impact assessment review?
-
Why are horizontal mergers more likely to affect competition than other types of mergers?
-
What is the origin of the word tort, and what does it mean?
Study smarter with the SolutionInn App