Question
1. you need to use methods of Scanner and String class that will allow the user to enter information about two products sold at a
1. 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.
2. Products will consist of the following data:
a. productName String
b. quantity integer
c. unitPrice double
3. The program will
a. 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.
b. 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.
c. 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.
d. display the data for each product and the total price in a table (see below) with the follow requirements
i. Product name in Proper case
ii. Product name will be left justified.
iii. Numbered data (qty, price and total price) will be right justified.
iv. The price and total price will be 2 decimal places. (Use printf format specifiers)
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started