Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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:

image text in transcribed

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 1

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

Step: 3

blur-text-image

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 And Relational Theory Normal Forms And All That Jazz

Authors: Chris Date

1st Edition

1449328016, 978-1449328016

More Books

Students also viewed these Databases questions