ESC230 Lab 1: Using abstract data types and object persistence We have seen that it is...
Fantastic news! We've Found the answer you've been seeking!
Question:
Transcribed Image Text:
ESC230 Lab 1: Using abstract data types and object persistence We have seen that it is possible template a class using interface classes, generics and to create a persistent object or objects in Java by saving the object information to disc. In this Jab, you need to define the interface(s) for creating the necessary objects for a Media Library and to write a program to allow the user to enter in the information and to utilize a persistent data structure to store items in a media library. You can get the beginning project files by copying your files by downloading the project template. You will be writing code in a new Java file in this project. Here are some other requirements: 1. You should not use any System.out.println or any Scanner methods. 2. You will need to define the interfaces identified in the skeleton code to be used with the generic class Library And then create your classes and hierarchy based on those interfaces. 3. Store the library on disk and then retrieve the library from disk and retrieve a specific media object to display. Submit your lab by zipping up your Java project files and you lab report and uploading the zip file to Moodle. Submit the answers to these questions: 1. This lab utilizes a class hierarchy that models media in a library. Create a framework.diancam for thichiararrhi Submit your lab by zipping up your Java project files and you lab report and uploading the zip file to Moodle. Submit the answers to these questions: 1. This lab utilizes a class hierarchy that models media in a library. Create a framework diagram for this hierarchy. 2. Is this a good use of an interface? Why or why not? Give specific reasons 3. Does the use of a generic provide you with the required flexibility you need in a program like this? Why or why not? Give specific reasons. C: > Users > User 1 > AppData > Local > Temp > Tempfa7c0712-faf6-4c30-a package CSC110; class Library<T> { private List resources new ArrayList<T>(); 1 2 3 import java.util.List; 4 import java.util.ArrayList; S 6 7 8 9 10 11 } 12 13 14 int size resources.size(); 15 16 public void addMedia(Tx) { resources.add(x); public T retrieveLast() if (size > 0) { return (T) resources.get(size 1); return null; - interface Media { // Sample interface definition// abstract String checkOutStatus(); abstract void checkOutTo(String userName, String outDate, String dueDate); abstract void checkIn(); 17 18 19 20 } 21 22 23 24 25 26 27 28 @ 29 interface Book extends Media { 30 } 31 32 33 } 34 In 15, Col 2 Spaces: 4 UTF-8 CRLF 21 22 23 24 25 26 27 28 29 interface Media { // Sample interface definition// abstract String checkOutStatus(); abstract void checkOutTo(String userName, String outDate, String dueDate); abstract void checkIn(); 30 } interface Book extends Media { 31 32 33 } 34 35 36 37 38 39 interface Video extends Media { } interface Newspaper extends Media { } > Users > User 1 > AppData > Local > Temp > Temp4e87e132-1954-4bcb-b285-a1925fd85224 LibraryLabOne.zip > LibraryLabOne > src > CSC230> Lab > J Main.java package CSC110; 1 2 3 public class Main ( 4 5 public static void main(String[] args) ( 6 // write your code here. 8 9 } I ESC230 Lab 1: Using abstract data types and object persistence We have seen that it is possible template a class using interface classes, generics and to create a persistent object or objects in Java by saving the object information to disc. In this Jab, you need to define the interface(s) for creating the necessary objects for a Media Library and to write a program to allow the user to enter in the information and to utilize a persistent data structure to store items in a media library. You can get the beginning project files by copying your files by downloading the project template. You will be writing code in a new Java file in this project. Here are some other requirements: 1. You should not use any System.out.println or any Scanner methods. 2. You will need to define the interfaces identified in the skeleton code to be used with the generic class Library And then create your classes and hierarchy based on those interfaces. 3. Store the library on disk and then retrieve the library from disk and retrieve a specific media object to display. Submit your lab by zipping up your Java project files and you lab report and uploading the zip file to Moodle. Submit the answers to these questions: 1. This lab utilizes a class hierarchy that models media in a library. Create a framework.diancam for thichiararrhi Submit your lab by zipping up your Java project files and you lab report and uploading the zip file to Moodle. Submit the answers to these questions: 1. This lab utilizes a class hierarchy that models media in a library. Create a framework diagram for this hierarchy. 2. Is this a good use of an interface? Why or why not? Give specific reasons 3. Does the use of a generic provide you with the required flexibility you need in a program like this? Why or why not? Give specific reasons. C: > Users > User 1 > AppData > Local > Temp > Tempfa7c0712-faf6-4c30-a package CSC110; class Library<T> { private List resources new ArrayList<T>(); 1 2 3 import java.util.List; 4 import java.util.ArrayList; S 6 7 8 9 10 11 } 12 13 14 int size resources.size(); 15 16 public void addMedia(Tx) { resources.add(x); public T retrieveLast() if (size > 0) { return (T) resources.get(size 1); return null; - interface Media { // Sample interface definition// abstract String checkOutStatus(); abstract void checkOutTo(String userName, String outDate, String dueDate); abstract void checkIn(); 17 18 19 20 } 21 22 23 24 25 26 27 28 @ 29 interface Book extends Media { 30 } 31 32 33 } 34 In 15, Col 2 Spaces: 4 UTF-8 CRLF 21 22 23 24 25 26 27 28 29 interface Media { // Sample interface definition// abstract String checkOutStatus(); abstract void checkOutTo(String userName, String outDate, String dueDate); abstract void checkIn(); 30 } interface Book extends Media { 31 32 33 } 34 35 36 37 38 39 interface Video extends Media { } interface Newspaper extends Media { } > Users > User 1 > AppData > Local > Temp > Temp4e87e132-1954-4bcb-b285-a1925fd85224 LibraryLabOne.zip > LibraryLabOne > src > CSC230> Lab > J Main.java package CSC110; 1 2 3 public class Main ( 4 5 public static void main(String[] args) ( 6 // write your code here. 8 9 } I
Expert Answer:
Answer rating: 100% (QA)
Id be glad to provide the complete code with explanations incorporating the insights from the ratings Complete Code Java package CSC110 import javautilArrayListimport javautilList public class Library ... View the full answer
Related Book For
Statistics Unlocking The Power Of Data
ISBN: 9780470601877
1st Edition
Authors: Robin H. Lock, Patti Frazer Lock, Kari Lock Morgan, Eric F. Lock, Dennis F. Lock
Posted Date:
Students also viewed these programming questions
-
Case Study: Quick Fix Dental Practice Technology requirements Application must be built using Visual Studio 2019 or Visual Studio 2017, professional or enterprise. The community edition is not...
-
Planning is one of the most important management functions in any business. A front office managers first step in planning should involve determine the departments goals. Planning also includes...
-
Alpha corp reports the following results for the current year: net income per books (before federal income taxes ) 738,000 federal income tax expense per books (156,240) net income per books (after...
-
An iron boiler of mass 180 kg contains 730 kg of water at 18C. A heater supplies energy at the rate of 58,000kJ/h. How long does it take for the water (a) To reach the boiling point, (b) To all have...
-
For Exercises find the critical value from Table L for the rank correlation coefficient, given sample size n and a. Assume that the test is two-tailed. n = 10, = 0.05
-
If you were trying to examine this issue, how would you proceed? Any suggestions for me to take next steps? same. Is that what happened? You normally wouldnt borrow money from the company, would you?
-
For a recent year, McDonalds company- owned restaurants had the following sales and expenses (in millions): Sales ...................$16,233 Food and packaging .............$ 5,300 Payroll...
-
(a) Let3+ and 2 = a + bi be complex numbers. Suppose that 7 Argument = 12' find Argument(22). 7-2 (b) Let the map f: CC be defined by f(z) = Find f() if=1+2i. 1 (c) Solve the equation -12 i(9-2),...
-
What is the output of the C program shown below? #include int main(void) { int x = 2, y = 3, z = 5; x = x + y; y = y* x; z = x + y; printf("%d and %d and %d ", x, y, z); x = 7 / 2; y = 10 % 4; z = 5...
-
When the equation 5.06x^(2)-3.40x-1.92=0 is solved, the two values of the unknown x are Submit Answer
-
You are reviewing a corporation's financial statements and observe that the income tax expense has two components a current portion and a deferred portion. Explain which component appears on the...
-
What will be printed? def mystery (letters): r = [ ] for i in range (len (letters)): r.append(letters [len (letters) - i - 1]) return r if name == main ch['a', 'b', 'c'] print (mystery (ch))
-
The Humber Company uses a process costing system. During the current period, 2,600 units were started, and 1,800 units were completed and transferred out. Ending units were 70% complete for materials...
-
Thinking about various payment terms for Accounts Payable, do you feel it is always valuable for a company to offer early payment discounts? Should a change in the prime rate (up or down) impact the...
-
The weight of certain mushrooms are normally distributed with a mean of 12g and a variance of 5g 2 . The heaviest 10% of mushrooms are considered too large for use by a particular restaurant. What is...
-
You continue to work in the corporate office for a nationwide convenience store franchise that operates nearly 10,000 stores. The per- store daily customer count (i.e., the mean number of customers...
-
Use the probability function given in the table to calculate: (a) The mean of the random variable (b) The standard deviation of the random variable 2 3 0.5 p(x) 0.2 0.3
-
After exercise, massage is often used to relieve pain, and a recent study shows that it also may relieve inflammation and help muscles heal. In the study, 11 male participants who had just...
-
Students in the ACHANCHA survey were asked two questions about alcohol use, one about their own personal consumption of alcohol and one about their perception of other students consumption of...
-
Classify the following topics as primarily macroeconomic or microeconomic: 1. The impact of a tax increase on aggregate output. 2. The relationship between two competing firms pricing behavior. 3. A...
-
Use the high and low volatility scenarios that we used for the call option to show that put options also are worth more when stock price volatility is higher.
-
In light of this discussion, explain why the put-call parity relationship is valid only for European options on non-dividend-paying stocks. If the stock pays no dividends, what inequality for...
Study smarter with the SolutionInn App