Write a program that reads from the user the item type (A, B or C) and...
Fantastic news! We've Found the answer you've been seeking!
Question:
Transcribed Image Text:
Write a program that reads from the user the item type (A, B or C) and the quantity bought. The price of each item is displayed in the below table. Type Price per one Item A 3000 B 4000 5000 If the user has bought more than 5 items of any type, he/she is notified that he/she will be charged double the amount; the user is given the choice to accept or to reduce the quantity bought to 5. The program displays the total amount. Your program should accept lowercase and uppercase alphabets for all character inputs. If the quantity is less than zero, the program should display an error message. Sample Run 1: Enter the type: A Enter the quantity: 3 Thanks, your total in L.L. is: 9000.0 Sample Run 2: Enter the type: A Enter the quantity: 7 You exceeded the limit. You will be charged double the price, Enter y to accept or n to reduce the quantity to 5: y Thanks, your total in L.L. is: 42000.0 Sample Run 3: Enter the type: B Enter the quantity: 6 You exceeded the limit. You will be charged double the price, Enter y to accept or n to reduce the quantity to 5: n Thanks, your total in L.L. is: 20000.0 Write a program that reads from the user the item type (A, B or C) and the quantity bought. The price of each item is displayed in the below table. Type Price per one Item A 3000 B 4000 5000 If the user has bought more than 5 items of any type, he/she is notified that he/she will be charged double the amount; the user is given the choice to accept or to reduce the quantity bought to 5. The program displays the total amount. Your program should accept lowercase and uppercase alphabets for all character inputs. If the quantity is less than zero, the program should display an error message. Sample Run 1: Enter the type: A Enter the quantity: 3 Thanks, your total in L.L. is: 9000.0 Sample Run 2: Enter the type: A Enter the quantity: 7 You exceeded the limit. You will be charged double the price, Enter y to accept or n to reduce the quantity to 5: y Thanks, your total in L.L. is: 42000.0 Sample Run 3: Enter the type: B Enter the quantity: 6 You exceeded the limit. You will be charged double the price, Enter y to accept or n to reduce the quantity to 5: n Thanks, your total in L.L. is: 20000.0
Expert Answer:
Answer rating: 100% (QA)
import javautil import the util capacities public class Main public static void mainString ar... View the full answer
Related Book For
Introduction to Java Programming, Comprehensive Version
ISBN: 978-0133761313
10th Edition
Authors: Y. Daniel Liang
Posted Date:
Students also viewed these finance questions
-
Write a program that reads from a text file "students.txt" student information of a given class and stores them into a list of dictionaries. Each line of the file contains a student id (integer), a...
-
Write a program that reads an unknown number (but no more than 100) of integer values from a file (ass5_Q4_input.txt), and displays distinct number. (i.e. if number appears multiple time, it is...
-
Write a program that simulates stable storage. Use two large fixed-length files on your disk to simulate the two disks.
-
If the firm's lowest average cost is $52 and the corresponding average variable cost is $26, what does it pay a perfectly competitive firm to do if? a. The market price is $51 b. The price is $36 c....
-
Perform a horizontal analysis for the MLC income statement (Table 4-7) for 2011 and 2012. Write an explanation of this analysis.
-
XYZ Pharma is a pharmaceutical company that traditionally has not used debt to finance its projects. Over the past 10 years, it has also reported high returns on its projects and growth and made...
-
Consider the $4 \mathrm{x} 4$ square matrix below. \[\left[\begin{array}{llll}A & B & C & D \\D & A & B & C \\C & D & A & B \\B & C & D & A\end{array} ight]\] Suppose the rows correspond to subjects...
-
Decide which class of shares of GLEF is best for the investor if he plans to liquidate his investment toward the end of a. Year 1 b. Year 3 c. Year 5 d. Year 15
-
Suppose you have $1,000.00 and face two alternatives: 1. Put the money in an interest-bearing account that pays 0.5% monthly. This account is secured against bank failure. 2. Hold the money in cash....
-
1. Based on what you read in this chapter, what would you have suggested Lisa and her team do first with respect to training, particularly in terms of the companys strategy? Why? 2. Have Lisa and the...
-
What are the environmental and lifestyle factors that influence hormone levels and hormone-dependent processes, including diet, exercise, circadian rhythms, and exposure to endocrine-disrupting...
-
Describe the primary types of geological and geophysical studies.
-
Explain the role of a landman in oil and gas operations.
-
Write down five types of transaction where you might expect to see an accrual of expense at the year-end. Against each transaction type write down the method you would use to estimate the amount of...
-
Explain the following terms: fracturing acidizing tripping in/out well casing
-
A class diagram can be used to model following things except (a) depicting the implementation detail of domain entities (b) depicting the interaction between domain entities (c) depicting state and...
-
The table below, shows a dataset collected in a Computer shop, showing the details of customers, and whether they can afford to buy a new laptop on special offer. This dataset has been used for...
-
Read the Forecasting Supply Chain Demand Starbucks Corporation case in your text Operations and Supply Chain Management on pages 484-485, then address the four questions associated with the...
-
The international standard letter/number mapping for telephones is shown in Programming Exercise 4.15. Write a method that returns a number, given an uppercase letter, as...
-
Write a program that uses a bar chart to display the percentages of the overall grade represented by projects, quizzes, midterm exams, and the final exam, as shown in Figure 14.46b. Suppose that...
-
Listing 28.14, NineTail.java, presents a solution for the nine tails problem. Revise this program for the 4 * 4 16 tails problem. Note that it is possible that a solution may not exist for a starting...
-
The terminal speed of a Styrofoam ball is 15 m/s. Suppose a Styrofoam ball is shot straight down with an initial speed of 30 m/s. Which velocity graph is correct? Vy (m/s) Vy (m/s) v, (m/s) vy (m/s)...
-
Boxes P and Q are sliding to the right across a frictionless table. The hand His slowing them down. The mass of P is larger than the mass of Q. Rank in order, from largest to smallest, the horizontal...
-
All three 50 kg blocks are at rest. Is the tension in rope 2 greater than, less than, or equal to the tension in rope 1? 50 kg 2 50 kg 2 50 kg
Study smarter with the SolutionInn App