Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

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 Implementation

Authors: Edward Sciore

2nd Edition

3030338355, 978-3030338350

More Books

Students also viewed these Databases questions