Specification The project must implement the following specification exactly, which includes identifier names, method signatures, etc....
Fantastic news! We've Found the answer you've been seeking!
Question:
Transcribed Image Text:
Specification The project must implement the following specification exactly, which includes identifier names, method signatures, etc. For this project, you will be writing one interface and three java classes, they are as follows: 1. Design a java interface called IDedObject that has following abstract function. int getID() //Returns the ID of the object String printID() //Prints the details of the ID 2. Design a java class Myltem that implements IDedObject interface and has the following class variables and one function named getID() int itemID int itemPrice List<int> itemDescription int getID() String printID() Implement suitable constructors, getID() function that returns the itemID. printID should print the details of the item in one line. Add any access and other functions necessary. {Note all your data should be private and methods public inside the class) 3. Design a generic singly linked list java class IDedLinkedList to hold objects of the generic type <AnyType>. This AnyType should extend IDedObject. You have to design your own class that does not use any other Java collection API. The linked list class must implement following member functions: void makeEmpty(); AnyType findID(int ID); //empties the linked list // Get the generic type to get the particular id and returns AnyType. Don't remove the object from the list. returns null if the list is empty or ID not found. boolean insertAtFront (AnyType x); AnyType deleteFromFront(); AnyType delete(int ID); int printTotal(); i. FindID // insert at front of list or return false if that ID already exists // delete and return the record at the front of the list or return null if the list is empty In addition to the above methods, you must have a constructor and may have other private methods. // find and delete the record with the given ID or returns null if it isn't found 4. Write a java class called P2Driver.java (the file with few lines of code given in elearning) with the main function. This class will take two command line arguments. The first argument will be the input file name and second will be output file name. The input file will be given to the program and the program will generate the output file. This main class will create an instance of IDedLinkedList that holds Myltem objects. The main class can handle the following operations by calling the appropriate methods of IDedLinkedList. v. PrintTotal // return the sum of ids of all elements currently in the list. if list is empty return -1. vi. End ii. Insert /// Get the magazine details from the input file and add it to the front of the list iii. Delete ///Print the details of the first item on the list and then delete it. If list is empty, print Null. /// print all details of the item with given ID in a single line, if it is in the list, if not print Null iv. DeletelD /// Print the details of the particular IDed item and then delete it.. If list is empty or item not found, print Null. /// Print sum of all item ids in the list, the linkedlist should handle this method. ///Quit the program. This will be the last command executed from the file The input file contains a sequence of lines. Lines starting with "#" are comments. Other lines have one operation per line: name of the operation, followed by parameters needed for that operation (separated by spaces). Lines with Insert operation will have a "0" at the end that is not part of the description. Sample Input File Insert 22 19 475 1238 9742 0 # New item with id-22, price="$19", description="475 1238 9742" #Return: True # Insert 12 96 44 109 0 # Second item with id=12, price="96", description="44 109" # Return: True # Insert 37 47 109 475 694 88 0 # Another item with id=37, price="47", description="109 475 694 88" #Return: True # DeleteID 37 # Return: 37 47 109 475 694 88 (in a single line) # FindID 22 #Return 22 19 475 1238 9742 # PrintTotal # Return: 22+12 = 34 # Insert 22 100 75 128 742 0 # Same item with id=22, not included in the list #Return: False # Insert 45 100 75 128 742 0 # New item with id=45, price="$100", description="75 128 742" # Return: True # PrintTotal # Return: 22+12+45 = 79 # DeleteID 111 #Id=111 is not in the list so print Null # Sadsad #This is an error in line print error message in the output file Insert 9 #This is an error in line print error message in the output file End {Even if there are line after this the program will not read them.} The corresponding out file the above input file True True True 37 47 109 475 694 88 22 19 475 1238 9742 34 False True 79 Null Error Error in Insert ALL JAVA FILES SHOULD BE IN DEFAULT PACKAGE. 1. README.txt This should identify who you are (name, NetID, etc.), which project you are submitting, what files comprise your project, how you developed and compiled your project (e.g. what IDE or text editor, which version of Java, what compiler options, etc.), and any other information you believe the grader should know or you want the grader to know. Please include sample commands that corresponding output. If some methods do not work completely please indicate. 2. Myltem.java 3. IDedObject.java 4. IDedLinked List.java 5. P2Driver.java Specification The project must implement the following specification exactly, which includes identifier names, method signatures, etc. For this project, you will be writing one interface and three java classes, they are as follows: 1. Design a java interface called IDedObject that has following abstract function. int getID() //Returns the ID of the object String printID() //Prints the details of the ID 2. Design a java class Myltem that implements IDedObject interface and has the following class variables and one function named getID() int itemID int itemPrice List<int> itemDescription int getID() String printID() Implement suitable constructors, getID() function that returns the itemID. printID should print the details of the item in one line. Add any access and other functions necessary. {Note all your data should be private and methods public inside the class) 3. Design a generic singly linked list java class IDedLinkedList to hold objects of the generic type <AnyType>. This AnyType should extend IDedObject. You have to design your own class that does not use any other Java collection API. The linked list class must implement following member functions: void makeEmpty(); AnyType findID(int ID); //empties the linked list // Get the generic type to get the particular id and returns AnyType. Don't remove the object from the list. returns null if the list is empty or ID not found. boolean insertAtFront (AnyType x); AnyType deleteFromFront(); AnyType delete(int ID); int printTotal(); i. FindID // insert at front of list or return false if that ID already exists // delete and return the record at the front of the list or return null if the list is empty In addition to the above methods, you must have a constructor and may have other private methods. // find and delete the record with the given ID or returns null if it isn't found 4. Write a java class called P2Driver.java (the file with few lines of code given in elearning) with the main function. This class will take two command line arguments. The first argument will be the input file name and second will be output file name. The input file will be given to the program and the program will generate the output file. This main class will create an instance of IDedLinkedList that holds Myltem objects. The main class can handle the following operations by calling the appropriate methods of IDedLinkedList. v. PrintTotal // return the sum of ids of all elements currently in the list. if list is empty return -1. vi. End ii. Insert /// Get the magazine details from the input file and add it to the front of the list iii. Delete ///Print the details of the first item on the list and then delete it. If list is empty, print Null. /// print all details of the item with given ID in a single line, if it is in the list, if not print Null iv. DeletelD /// Print the details of the particular IDed item and then delete it.. If list is empty or item not found, print Null. /// Print sum of all item ids in the list, the linkedlist should handle this method. ///Quit the program. This will be the last command executed from the file The input file contains a sequence of lines. Lines starting with "#" are comments. Other lines have one operation per line: name of the operation, followed by parameters needed for that operation (separated by spaces). Lines with Insert operation will have a "0" at the end that is not part of the description. Sample Input File Insert 22 19 475 1238 9742 0 # New item with id-22, price="$19", description="475 1238 9742" #Return: True # Insert 12 96 44 109 0 # Second item with id=12, price="96", description="44 109" # Return: True # Insert 37 47 109 475 694 88 0 # Another item with id=37, price="47", description="109 475 694 88" #Return: True # DeleteID 37 # Return: 37 47 109 475 694 88 (in a single line) # FindID 22 #Return 22 19 475 1238 9742 # PrintTotal # Return: 22+12 = 34 # Insert 22 100 75 128 742 0 # Same item with id=22, not included in the list #Return: False # Insert 45 100 75 128 742 0 # New item with id=45, price="$100", description="75 128 742" # Return: True # PrintTotal # Return: 22+12+45 = 79 # DeleteID 111 #Id=111 is not in the list so print Null # Sadsad #This is an error in line print error message in the output file Insert 9 #This is an error in line print error message in the output file End {Even if there are line after this the program will not read them.} The corresponding out file the above input file True True True 37 47 109 475 694 88 22 19 475 1238 9742 34 False True 79 Null Error Error in Insert ALL JAVA FILES SHOULD BE IN DEFAULT PACKAGE. 1. README.txt This should identify who you are (name, NetID, etc.), which project you are submitting, what files comprise your project, how you developed and compiled your project (e.g. what IDE or text editor, which version of Java, what compiler options, etc.), and any other information you believe the grader should know or you want the grader to know. Please include sample commands that corresponding output. If some methods do not work completely please indicate. 2. Myltem.java 3. IDedObject.java 4. IDedLinked List.java 5. P2Driver.java
Expert Answer:
Answer rating: 100% (QA)
Below is the code for the above problem IDedLinkedListjava import javautilLinkedList IdedLinkedList contains generic type of elements public class IDedLinkedList private LinkedList list default constr... View the full answer
Related Book For
Elementary Statistics
ISBN: 978-0538733502
11th edition
Authors: Robert R. Johnson, Patricia J. Kuby
Posted Date:
Students also viewed these mechanical engineering questions
-
A 2.05-m-tall basketball player takes a shot when he is 6.02 m from the basket (at the three-point line). If the launch angle is 25o and the ball was launched at the level of the players head, what...
-
When a sports team hires an expensive new player or builds a new stadium, you often hear claims that ticket prices have to rise to cover the new, higher cost. Lets see what monopoly theory says about...
-
A handball player throws a ball from A with a horizontal velocity v0. Knowing that d = 15 ft, determine(a) The value of v0 for which the ball will strike the corner C,(b) The range of values of v0...
-
Consider the case of J polluters and with abatement cost functions C j (e j ) and one pollution victim. Abatement costs are ordered from highest to lowest such that C 1 (e 1 )>C 2 (e 2 )>>C J (e J )....
-
At the beginning of its 2015 tax year, Hiram owned the following business assets: On July 8, Hiram sold its equipment. On August 18, it purchased and placed in ser-vice new tools costing $89,000;...
-
In a small apartment in Santa Monica, California, Gautam Gupta and Ken Chen found themselves at a crossroads. Do we pursue this business idea or call it quits? They had just finished running a simple...
-
Dearborn Manufacturing Co. completed the following transactions during 2009 . Requirement Record the transactions in Dearborn's general journal. Jan. 16 Declared a cash dividend on the 4%, $100 par...
-
Michelle Gutierrez, manager of the Components Division of FX Corporation, is considering a new investment for her division. The division has an investment base of $4,000,000 and operating income of...
-
Project is worth a total of 50 points within the course and will also be assessed using the Integrative Business Knowledge rubric from the syllabus. The budget performance report will consist of two...
-
How would the right squares on the board be painted the color of the tetromino and the tetromino gets hidden? Java Language and located in the gray-out comment section in the image. /** * Starts...
-
Calculate the value of the definite integral using either the course Riemann Sum Calculator or geometry. (Round to the nearest integer. Use symbolic notation and fractions where needed.) 4 [^...
-
Use the implicit finite difference method to solve the heat conduction problem on the unit square: \[\begin{aligned}& \frac{\partial^{2} u}{\partial x^{2}}=\frac{\partial u}{\partial t} \\& u(x, 0)=x...
-
Explain the difference between multiple and simple inheritance and provide one example of each.
-
Consider a continuous-time environment, with \(e\) as a variable outside of the market. (a) Suppose the final payoff is \(V\left(x_{e}, T ight)=x_{e}(T)\). Find \(V\left(x_{e}, t ight)\). (b) Find a...
-
XYZ University is a medium-sized tertiary education provider in the state of Queensland, Australia. In undertaking its normal business of teaching, learning, and research, the university collects,...
-
Show that the two braids are mutual inverses under braid multiplication. XX XX
-
You've been called in to a job interview, but you don't know what the company is paying. You should ask detailed questions about salary and benefits throughout the interview ask briefly about salary,...
-
The bookkeeper for Riley, Inc., made the following errors: a. A cash purchase of supplies of $357 was recorded as a debit to Supplies for $375 and a credit to Cash of $375. b. A cash sale of $3,154...
-
Randomness incorporates many different concepts. Referring to Applied Example 14. 12: a. What aspect of randomness will be tested using the chi-square test mentioned in part (i) of rule (c)? Describe...
-
a. Find the area under the standard normal curve to the left of z = 0 P(z < 0) b. Find the area under the standard normal curve to the right of z = 0 P(z> 0)
-
For the hypothesis test involving Ha: m B = m A 0, with df = 18 and t = 1.3: a. Find the p-value. b. Find the critical values given a = 0.05.
-
Why would you expect retailers to have lower current ratios than manufacturers?
-
If a companys gross profit ratio has increased, what does that tell us about the volume of sales and selling prices?
-
You are given the following statement of financial position information about the Nikkigra Company. You are required to comment on the financial position and performance of the company, making use of...
Study smarter with the SolutionInn App