Question: Develop a Java program that: Reads input from the keyboard using a Scanner Object and its methods, Displays information to the user in various formats,
Develop a Java program that: Reads input from the keyboard using a Scanner Object and its methods, Displays information to the user in various formats, including formatting numbers and, manipulates String objects using various String methods. You need to use methods of Scanner and String class that will allow the user to enter information about two products sold at a Grocery Store and display information about the products. Products will consist of the following data: productName String, quantity integer, and unitPrice double. The program will need to prompt the user to enter the information for two products and store this information in the appropriately named variable. Assume product name is one word only and less than 10 characters. It will need to store the product name in proper case (first letter to upper case and the rest of the word to lower case. For example: apple becomes Apple, and ORANGE becomes Orange. It will need to calculate the total price of each product (quantity * unitPrice) and store this in an appropriately named variable. Assume both quantity and unitPrice are less than 1000. Please display the data for each product and the total price in a table with the follow requirements: Product name in Proper case, Numbered data (qty, price and total price) will be right justified, and i.the price and total price will be 2 decimal places. (Use printf format specifiers)
Please dont answer from a previous answer because I know this question has been asked. I havent seen It answered correctly and would like a fresh answer. The table should look like this and be in JAVA:
Enter Info for Product 1
Product Name: Apple
Quantity: 2
Unit Price: 3.5
Enter Info for Product 2
Product Name: Orange
Quantity: 21
Unit Price: 45.123
----------------------------------------------------------------------------------------------------------------------
| Product | Quantity | Price | Total |
----------------------------------------------------------------------------------------------------------------------
| Apple | 2 | 3.50 | 7.00 |
| Orange | 21 | 45.12 | 947.58 |
----------------------------------------------------------------------------------------------------------------------
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
