Write a java program that prompts the user to enter the weight of an item in...
Fantastic news! We've Found the answer you've been seeking!
Question:
Transcribed Image Text:
Write a java program that prompts the user to enter the weight of an item in ounces and the price per pound. Then ask user to enter his/her name (User can enter a string with any order of lower/upper case characters).The name will include their first and last name with a space between them. Note that the name will be saved in one string variable. Do not use two different variables for first name and last name. Your program should calculate the item's weight in pounds then calculate the cost of buying an item.. 1 Pound 16 Once Then generate a two-digit random number as a confirmation code. Your program should convert the user's name to all uppercase characters and replace the space between first and last names with a period (.). Your code should print a receipt that includes the cashier's name (all uppercase with a period for separating the first and last name) and the confirmation code. The output should also include the unit price, weight in pounds and the total price. You should use NumberFormat to print any currency and DecimalFormat with 2 decimal places for printing the weight. Note: Test your code for a variety of inputs. Remember, the code with the errors will not be graded. Make sure you use concepts and statements that we covered in chapters 1, 2, and 3. The projects that uses the concepts that we have not covered yet will receive zero. Sample Output: Enter your name: Nazli Mehrazar Enter the item's weight in ounces: 41 Enter the price per pound: 5.25 11 Welcome NAZLI.MEHRAZAR /// ***** Unit Price: Weight: ===== ==== Total: ‒‒‒‒‒‒‒ 5.25 per pound 2.56 pounds 13.44 Confirmation Code: 32 Write a java program that prompts the user to enter the weight of an item in ounces and the price per pound. Then ask user to enter his/her name (User can enter a string with any order of lower/upper case characters).The name will include their first and last name with a space between them. Note that the name will be saved in one string variable. Do not use two different variables for first name and last name. Your program should calculate the item's weight in pounds then calculate the cost of buying an item.. 1 Pound 16 Once Then generate a two-digit random number as a confirmation code. Your program should convert the user's name to all uppercase characters and replace the space between first and last names with a period (.). Your code should print a receipt that includes the cashier's name (all uppercase with a period for separating the first and last name) and the confirmation code. The output should also include the unit price, weight in pounds and the total price. You should use NumberFormat to print any currency and DecimalFormat with 2 decimal places for printing the weight. Note: Test your code for a variety of inputs. Remember, the code with the errors will not be graded. Make sure you use concepts and statements that we covered in chapters 1, 2, and 3. The projects that uses the concepts that we have not covered yet will receive zero. Sample Output: Enter your name: Nazli Mehrazar Enter the item's weight in ounces: 41 Enter the price per pound: 5.25 11 Welcome NAZLI.MEHRAZAR /// ***** Unit Price: Weight: ===== ==== Total: ‒‒‒‒‒‒‒ 5.25 per pound 2.56 pounds 13.44 Confirmation Code: 32
Expert Answer:
Answer rating: 100% (QA)
java import javautilScanner import javatextNumberFormat public class WeightPriceCalculator public st... 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 programming questions
-
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...
-
Does the EOQ increase or decrease if estimates of setup (order) costs include fixed, semi-variable, and pure variable costs while inventory-holding costs includes only pure variable costs? Vice...
-
Have you given consideration to family lifestyle issues?
-
Pepsi Cola Dew, Gatorade, Tropicana and Lipton, accounts >> develop new products of At present, Pepsi Philippines, which PEPSI manufactures Pepsi, Seven-Up, Mountain for 20 per cent of the...
-
Youre looking at some corporate bonds issued by Mazda, and you are trying to determine what the nominal interest rate should be on them. You have determined that the real risk-free interest rate is...
-
Marloweville, with 20,000 residents, is deciding how to finance the construction of a new municipal golf course that will enhance both recreation and tourism in the area. The construction cost of the...
-
6. If the tangent to the curve y = x at the point P(t, t) meets the curve again at Q, then the ordinate of the point which divides PQ internally in the ratio 1:2 is: (a) 0 7. (b)-t The system of...
-
The Beef-Up Ranch feeds cattle for Midwestern farmers and delivers them to processing plants in Topeka, Kansas, and Tulsa, Oklahoma. The ranch must determine the amounts of cattle feed to buy so that...
-
In Carrington's article, he tells us that "the term Anthropocene was coined only in 2000, by the Nobel prize-winning scientist Paul Crutzen, who believes the name change is overdue... Crutzen also...
-
5.00 kg of liquid water is heated to 100.0 C in a closed system. At this temperature, the density of liquid water is 958 kg/m 3 . The pressure is maintained at atmospheric pressure of 1.01 10 5 Pa....
-
a) Coulomb's law states that the electric field strength from a point charge in vacuum is q 4 2 pointing away radially away from the point charge. -3 nC -2 mm Calculate the magnitude of the electric...
-
You are designing a gas turbine engine that must provide 1.53 kW of output power. The efficiency of the engine is 0.46 times the efficiency of an ideal (Carnot) engine with the same high and low...
-
A block holding a ringing tuning fork is attached to a wall by a spring. The block oscillates back and forth on a horizontal, frictionless surface, with amplitude 17 cm. The mass of the tuning fork...
-
QUESTION 7 What is the centripetal accleration of a person standing 4 meters from the center of a merry-go-round if the merry-go-round has a linear velocity of 5 m/s? 6.25 m/s 1.25 m/s2 O 3.2 m/s O...
-
Rho Inc., a public company, is a software development company which has several products on the market, including the widely used Playmark animation software. The company has recorded development...
-
What are the 5 Cs of marketing channel structure?
-
Write a program that rotates a rectangle 15 degrees right when the Rotate button is clicked, as shown in Figure 15.24b. Rotate (b)
-
Create a new class named MyGraph as a subclass of UnweightedGraph that contains a method for finding all connected components in a graph with the following header:public?List>...
-
Write a program that prompts the user to enter three points (x1, y1), (x2, y2), (x3, y3) of a triangle and displays its area. The formula for computing the area of a triangle is Here is a sample run:...
-
What process do you follow to make decisions for these different circumstances, and are you satisfied with the results?
-
Two linear vectors of magnitudes 3 and 4 are added. The magnitude of the resultant vector is (a) 1, (b) 7, (c) between 1 and
-
The equation x = xo +vxot + axt 12 2 applies (a) to all kinematic problems, (b) only if you is zero, (c) to constant accelerations, (d) to negative times.
Study smarter with the SolutionInn App