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 )....
-
What performance appraisal method do you believe would best apply to the evaluation of a college professor?
-
During 2017, the following selected events and transactions were recorded by Milos County Hospital. 1. Gross charges for hospital services, all charged to accounts and notes receivable, were as...
-
Why is knowledge management important in an organization?
-
1. Did GFI have a legitimate reason to expect that Egan would accept the fourth shipment? Why or why not? 2. Does the substitution of carriers in the third shipment constitute a breach of the...
-
What inputs are necessary to build a schedule? Briefly summarize the steps involved in creating a schedule. What is the difference between task effort and task duration? Why are milestones used in...
-
The Columbia River Crossing (CRC) project is in-tended to improve traffic flow in the I- 5 corridors in the greater Vancouver, Washington, and Portland, Oregon, region. The proposed project is...
-
1) What kinds of problems the style of Functional Practioner (Henry Ford) would be best at solving? 2) What are the strengths of the Functional Practioner (Henry Ford) problem-solving style? Explain...
-
Cost of Goods Sold Allyson Ashley makes jet skis. During the year, Allyson manufactured 94,000 jet skis. Finished goods inventory had the following units: January 1 December 31 Required: 6,800 7,200...
-
The value chain of Adidas has extended across the globe. Since the 1980s, the labor-intensive parts of shoe and clothing manufacturing have been moved to locations with low labor costsoften involving...
-
Rewrite P&G has a sophisticated supply chain management system, which likely incorporates simulation and modeling capabilities to analyze factors such as demand forecasting, inventory management,...
-
Understanding the significance of route optimization can help me streamline delivery schedules, reducing costs and improving delivery times. Additionally, insights into demand forecasting can aid in...
-
When would an Army leader accept an extremely high risk?
-
(5 points) What is the running time of the algorithm shown alongside as a function of the input n? (For each i show the number of repetitions of the while loop and then add all these values...
-
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.
-
The upper curve in the boiling point diagram is called (a) The saturated vapour curve (b) The dew point curve (c) The saturated liquid curve (d) Both (a) and (b).
-
A vertical cylinder containing helium gas is filled with a piston of \(50 \mathrm{~kg}\) mass and crosssectional area of \(0.025 \mathrm{~m}^{2}\). If the atmospheric pressure outside the cylinder is...
-
The Joule-Thomson coefficient for any gas at inversion point is (a) 1 (b) 0 (c) 2 (d) 3
Study smarter with the SolutionInn App