Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

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 items 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 users 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 cashiers 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.

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Database Design For Mere Mortals

Authors: Michael J Hernandez

4th Edition

978-0136788041

More Books

Students also viewed these Databases questions