Question
1. In this project, you need to use methods of Scanner and String class that will allow the user to enter information about two products
1. In this project, 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)
4. Include javadoc class comment following Project Comment Template on the content page.
5. Sample run below:
Enter info for Product 1 Product name aPpLe Quantity Unit Price3.5 2 Enter info for Product 2 Product name: OrAnGe Quantity Unit Price45.123 : 21 Product Oty Price Total Apple Orange 3.50 45.12 7.00 947.58 2 1Step 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