Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

1.Create a folder named LastName_FirstName (ex.Reyes_Mark) in your local drive. 2. Create a project named Labexer2. Set the project location to your own folder. 3.

1.Create a folder named LastName_FirstName (ex.Reyes_Mark) in your local drive. 2. Create a project named Labexer2. Set the project location to your own folder. 3. Construct a simple purchasing program based on the UML Class Diagram below.

Labexer2 -itemName:String -itemPrice:double -itemQuantity:int -amountDue:double

+setItemName(Stribg newItemName):void +setTotalCost(int quantity,diuble price):void +getitemName():String +getTotalCost():double +readinput():void +writeOutput():void Note: the readinput () method will be used to accept user input through the Scanner class. This is done by: a.Writing import java.util.*; on top of the code before the line for the class name b.Instantiating an object of the scanner class, Scanner s = new Scanner(System.in); c.Storing the input to the variable name based on data type For string: s.nextLine() For int: s.nextInt() For double: s.nextDouble() the write output () method will be used to display an output similar to the sample below. Your are purchasing 3 bags (s) at 1,745.t each Sample output Enter the name of the item you are purchasing bag Enter the quantity and price separated by a space. 3 1475.50 You are purchasing 3 bag(s) at 1475.5 each Amount due is 4426.50

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

Practical Neo4j

Authors: Gregory Jordan

1st Edition

1484200225, 9781484200223

More Books

Students also viewed these Databases questions

Question

Explain how JIT/Lean impacts each of the seven wastes.

Answered: 1 week ago

Question

=+Are you married?

Answered: 1 week ago

Question

Provide examples of Dimensional Tables.

Answered: 1 week ago