Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Decide which devices you would like to store in the list. (e.g. game consoles, radios, cameras, laptops, etc.) Create a new Java project 1410_DocComments_Review and

image text in transcribedimage text in transcribedimage text in transcribedimage text in transcribedimage text in transcribedimage text in transcribedimage text in transcribedimage text in transcribed

Decide which devices you would like to store in the list. (e.g. game consoles, radios, cameras, laptops, etc.) Create a new Java project 1410_DocComments_Review and add a new package called docComments.Create a class that represents the device you chose. Here are some requirements your class needs to fulfill: It needs to have at least three attributes you are keeping track of (dimension, resolution, etc.) It needs to have two additional fields: o a unique id that cannot be changed once created like a primary key in a database) o a static count that is used to initialize the id with a unique number Notice: At this point, we have a total of at least 5 attributes It needs a parameterized constructor. It allows the user to provide values for all the attributes you are keeping track of but not for the id nor for the count. The constructor creates a unique seven-digit id for each device based on the static field count. Such an id can be obtained by adding the incremented count to a seven-digit seed value. E.g. 1234567 + count++; In this example, the smallest id would be 1234567) It needs a getter for each of the fields except for the static count. The count is for internal use only and should remain hidden from the user. It needs to override the method toString. The returned string should include the id and the values of the fields it keeps track of. The static count should not be included. However, there should be labels whenever the value itself is not self-explanatory. (See sample output) At this point, you have one class that represents the electronic device of your choice. This class does not contain the list of devices nor should it include any print statements. You still need at least one more class for the list of devices, the menu, and the user communication (input/output) Create one or two additional classes to do the following: Declare an ArrayList of devices (each element in the list should be an instance/object of the new Java type you just wrote) Initialize the list with four different elements (hardcoded). Display a menu with the following options until the user chooses to exit: 1. Show all devices 2. Add a device 3. Find a device 4. Delete a device 5. Number of devices 6. Exit Enter your selection: Important: replace the word device with the actual type you store in the list. (e.g. Show all radios) Provide the functionality chosen by the user. Use private methods to print the menu and to display, find, add, or delete devices. This structures the code and it makes the program more clear and easier to read. Whenever the user wants to find or delete a device s/he should be prompted for the id number. If the user provides an id number that doesn't exist, an appropriate message should be displayed. E.g. The id ... could not be found. If the id number could be found, the device information should be displayed as part of the response. (see sample output) If the user enters an invalid choice from the menu an appropriate message should be printed. E.g. Enter a selection 1 - 6 If the user enters 6 a message should be displayed before terminating the program. E.g. Goodbye All classes, constructors, and public methods need a doc comment. Follow the guidelines e that were discussed in Practice - Doc Comments. Below you can find a sample output. It operates on a list of cars, yet cars are not electronic devices. This is intentional because I don't want you to duplicate the class from the output. Instead, use the sample output as a guideline on how to provide feedback to the user and how to structure the code using single empty lines before printing the menu and before printing the input/output based on the user selection. Once you tested your code, create a runnable JAR file that includes the source codec. Sample Output 1. Show all cars 2. Add a car 3. Find a car 4. Delete a car 5. Number of cars 6. Exit Enter your selection: 1 2011 Toyota Corolla id: 12345678 2015 Honda Accord id: 12345679 2008 Audi A4 id: 12345680 2017 Tesla Model 3 id: 12345681 1. Show all cars 2. Add a car 3. Find a car 4. Delete a car 5. Number of cars 6. Exit Enter your selection: 5 Number of cars: 4 Number of cars: 4 1. Show all cars 2. Add a car 3. Find a car 4. Delete a car 5. Number of cars 6. Exit Enter your selection: 3 Id: 12345680 2008 Audi A4 id: 12345680 1. Show all cars 2. Add a car 3. Find a car 4. Delete a car 5. Number of cars 6. Exit Enter your selection: 4 Id: 12345680 2008 Audi A4 has been deleted 1. Show all cars 2. Add a car 3. Find a car 4. Delete a car 5. Number of cars 6. Exit Enter your selection: 2 Enter your selection: 4 Id: 12345680 2008 Audi A4 has been deleted 1. Show all cars 2. Add a car 3. Find a car 4. Delete a car 5. Number of cars 6. Exit Enter your selection: 2 Year: 2013 Make: Ford Model: Mustang 1. Show all cars 2. Add a car 3. Find a car 4. Delete a car 5. Number of cars 6. Exit Enter your selection: 1 2011 Toyota Corolla id: 12345678 2015 Honda Accord id: 12345679 2017 Tesla Model 3 id: 12345681 2013 Ford Mustang id: 12345682 1. Show all cars 2. Add a car 3. Find a car 4. Delete a car 5. Number of cars 6. Exit Enter your selection: 4 Id: 12345680 The id 12345680 could not be found 1. Show all cars 2. Add a car 3. Find a car 4. Delete a car 5. Number of cars 6. Exit Enter your selection: 4 Id: 12345682 2013 Ford Mustang has been deleted 1. Show all cars 2. Add a car 3. Find a car 4. Delete a car 5. Number of cars 6. Exit Enter your selection: 5 Enter your selection: 4 Id: 12345682 2013 Ford Mustang has been deleted 1. Show all cars 2. Add a car 3. Find a car 4. Delete a car 5. Number of cars 6. Exit Enter your selection: 5 Number of cars: 3 1. Show all cars 2. Add a car 3. Find a car 4. Delete a car 5. Number of cars 6. Exit Enter your selection: 7 Enter a selection 1 - 6 1. Show all cars 2. Add a car 3. Find a car 4. Delete a car 5. Number of cars 6. Exit Enter your selection: 6 Goodbye

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 Systems For Advanced Applications 15th International Conference Dasfaa 2010 International Workshops Gdm Benchmarx Mcis Snsmw Diew Udm Tsukuba Japan April 2010 Revised Selected Papers Lncs 6193

Authors: Masatoshi Yoshikawa ,Xiaofeng Meng ,Takayuki Yumoto ,Qiang Ma ,Lifeng Sun ,Chiemi Watanabe

2010th Edition

3642145884, 978-3642145889

More Books

Students also viewed these Databases questions

Question

Approaches to Managing Organizations

Answered: 1 week ago

Question

Communicating Organizational Culture

Answered: 1 week ago