Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

kage midterm; ort java. util. Scanner; simulator to add items, print inventory and to search item's price. gauthor Ali Hassan author Paul Bonenfant Feb 2021

image text in transcribed
image text in transcribed
kage midterm; ort java. util. Scanner; simulator to add items, print inventory and to search item's price. gauthor Ali Hassan author Paul Bonenfant Feb 2021 Lic class InventorySystem \{ public static void main(String[] args) \{ Item item1 = new Item(0, null, 0);// No ID, defriptn or price assigned. I/ Add a new item to the inventory. Program asks the user to enter name I/ and quantity of the item. For new item's ID, program simply 1/ increments the ID of the last item rdded. Scanner input = new Scanner(System. in); d System,out, Rrintln("Enter description of the item to add:"); String description = input. nextLine(); System.out. Rrintln("Enter the price:"); double price = input. nextDouble(); Item item 2= new Item(++item1. id, description, price); item1. add Item (item2); 1/ Add two more items. Item item 3 = new Item (++item1. id, "Sony Headphones", 199.99); item1. addItem (item3); Item item4 = new Item (++i tem1. Id, "JBL Speaker", 99.99); item1. add Item (item4); // Print the list item1. printlist (); /I Search for a specific price System, out, Rrintin( "Enter ID of the item whose price you want to find:"); int id = input. nextInt (); 3 System,out. Rrinthn("Item's price is: " + item1. getItemPrice(id)); Part B - Short Questions / UML The following two questions relate to the code available for download in the first question as a zip file. Please import from zip into NetBeans. Question 1 (12 points) Create UML Class Diagram for the given code using Visual Paradigm. Download the code here: Use this code. Also, add an operation (method) to the Item class of this UML diagram with a name that is your first name and last name in camel case (e.g. bugsBunny). The return value should be and String and it takes a double argument. Export the resulting diagram as an image (or take a screen shot) and upload it to the response box below; call it LastNameFirstNamePartB. Then in the response box, just write the word 'DONE

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

Beginning VB.NET Databases

Authors: Thearon Willis

1st Edition

1594864217, 978-1594864216

More Books

Students also viewed these Databases questions