(In java please) ( NO TOY CLASS PLEASE READ INSTRUCTION OR DOWN VOTE PLEASE LOOK AT TWO IMAGES BELOW FIRST ONE IS CURRENCY CLASS NEED THE SECOND IS INSTRUCTIONS ON HOW TO MAKE TEST CLASS. PLEASE NO TOY CLASS OR DOWN VOTE USE CURRENCY CLASS INSTEAD AND UPDATE IT) THIS A LinkNode structure or class which will have two attributes - a data attribute, and a pointer attribute to the next node. The data attribute of the LinkNode should be a reference/pointer of the Currency class of Lab 2. Do not make it an inner class or member structure to the SinglyLinkedList class of #2 below. A SinglyLinkedList class which will be composed of three attributes - a count attribute, a LinkNode pointer/reference attribute named as and pointing to the start of the list and a LinkNode pointer/reference attribute named as and pointing to the end of the list. Since this is a class, make sure

Database System Concepts
7th Edition
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Chapter1: Introduction
Section: Chapter Questions
Problem 1PE
icon
Related questions
Question

(In java please) ( NO TOY CLASS PLEASE READ INSTRUCTION OR DOWN VOTE PLEASE LOOK AT TWO IMAGES BELOW FIRST ONE IS CURRENCY CLASS NEED THE SECOND IS INSTRUCTIONS ON HOW TO MAKE TEST CLASS. PLEASE NO TOY CLASS OR DOWN VOTE USE CURRENCY CLASS INSTEAD AND UPDATE IT) THIS A LinkNode structure or class which will have two attributes - a data attribute, and a pointer attribute to the next node. The data attribute of the LinkNode should be a reference/pointer of the Currency class of Lab 2. Do not make it an inner class or member structure to the SinglyLinkedList class of #2 below. A SinglyLinkedList class which will be composed of three attributes - a count attribute, a LinkNode pointer/reference attribute named as and pointing to the start of the list and a LinkNode pointer/reference attribute named as and pointing to the end of the list. Since this is a class, make sure all these attributes are private. The class and attribute names for the node and linked list are the words in bold in #1 and #2. For the Linked List, implement the following linked-list behaviors as explained in class - getters/setters/constructors/destructors, as needed, for the attributes of the class. createList method in addition to the constructor - this is optional for overloading purposes. destroyList method in place of or in addition to the destructor - this is optional for overloading purposes, addCurrency method which takes a Currency object and a node index value as parameters to add the Currency to the list at that index. removeCurrency method which takes a Currency object as parameter and removes that Currency object from the list and may return a copy of the Currency. removeCurrency overload method which takes a node index as parameter and removes the Currency object at that index and may return a copy of the Currency. findCurrency method which takes a Currency object as parameter and returns the node index at which the Currency is found in the list. getCurrency method which takes an index values as a parameter and returns the Currency object. printList method which returns a string of all the Currency objects in the list in the order of index, tab spaced. isListEmpty method which returns if a list is empty or not. countCurrency method which returns a count of Currency nodes in the list. Any other methods you think would be useful in your program. A Stack class derived from the SinglyLinkedList but with no additional attributes and the usual stack methods - constructor and createStack (optional) methods, push which takes a Currency object as parameter and adds it to the top of the stack. pop which takes no parameter and removes and returns the Currency object from the top of the stack. peek which takes no parameter and returns a copy of the Currency object at the top of the stack. printStack method which returns a string signifying the contents of the stack from the top to bottom, tab spaced. destructor and/or destroyStack (optional) methods. Ensure that the Stack objects do not allow Linked List functions to be used on them. A Queue class derived from the SinglyLinkedList but with no additional attributes and the usual queue methods - constructor and createQueue (optional) methods, enqueue which takes a Currency object as parameter and adds it to the end of the queue. dequeue which takes no parameter and removes and returns the Currency object from the front of the queue. peekFront which takes no parameter and returns a copy of the Currency object at the front of the queue. peekRear which takes no parameter and returns a copy of the Currency object at the end of the queue. printQueue method which returns a string signifying the contents of the queue from front to end, tab spaced. destructor and/or destroyQueue (optional) methods. Ensure that the Queue objects do not allow Linked List functions to be used on them. Ensure that all your classes are mimimal and cohesive with adequate walls around them. Make sure to reuse and not duplicate any code. Then a main driver program that will demonstrate all the capabilities of your ADTs as follows - First, print a Welcome message for the demonstration of your ADTs - you can decide what the message says but it should include your full name(s). Second, create the following twenty (20) Dollar objects in a Currency array to be used in the program. $57.12 $23.44 $87.43 $68.99 $111.22 $44.55 $77.77 $18.36 $543.21 $20.21 $345.67 $36.18 $48.48 $101.00 $11.00 $21.00 $51.00 $1.00 $251.00 $151.00 

5
6
8
9
10
11
12
13
14
15
16
17
18
ខានជនីផងននននគិតគឺមិត២គន្ធក៏មាន១៩៩៩៨មទិវខជននីនិងខPP
19
20
220
23
24
}
21 //constructor
25
27
28
29
30
31
32
33
26 //getters/setters
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
class Currency {
0
0
private int wp, fp;
public Currency(int i, int j) {}
public Currency (double amount) {
if(amount < 0)
{
System.out.println("Invalid Input");
//non
}
}
public Currency (Currency currency) {
return;
}
else {
this.wp = (int) amount;
this.fp = (int) (amount*100) - this.wp*100;
}
this.wp = currency.wp;
this.fp = currency.wp;
public int getwp() {
return wp;
}
public void setwp(int wp) {
this.wp = wp;
}
public int getfp() {
return fp;
}
public void setfp(int fp) {
this.fp = fp;
}
public void print() {
DecimalFormat d1= new DecimalFormat("00");
System.out.print(this.wp + "." + d1.format(this.fp));
}
}
public void add(Currency currency) {
this.fp+= currency.fp;
this.wp + this.fp/100 + currency.wp;
this.fp = 100;
}
public void subtract (Currency currency) {
if(!this.isGreater (currency) && !this.is Equal (currency)) {
System.out.println("Invalid subtraction");
}
}
return;
this.fp = currency.fp;
this.wp = currency.wp;
if(this.fp < 0) this.fp += 100;
public boolean isGreater (Currency currency) {
double ca = (double) this.wp + (double) this.fp/100;
double ta = (double) currency.wp + (double) currency.fp/100;
return ca > ta;
}
public boolean is Equal(Currency currency) {
double ca = (double) this.wp + (double) this.fp/100;
double ta = (double) currency.wp + (double) currency.fp/100;
return ca == ta;
Transcribed Image Text:5 6 8 9 10 11 12 13 14 15 16 17 18 ខានជនីផងននននគិតគឺមិត២គន្ធក៏មាន១៩៩៩៨មទិវខជននីនិងខPP 19 20 220 23 24 } 21 //constructor 25 27 28 29 30 31 32 33 26 //getters/setters 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 class Currency { 0 0 private int wp, fp; public Currency(int i, int j) {} public Currency (double amount) { if(amount < 0) { System.out.println("Invalid Input"); //non } } public Currency (Currency currency) { return; } else { this.wp = (int) amount; this.fp = (int) (amount*100) - this.wp*100; } this.wp = currency.wp; this.fp = currency.wp; public int getwp() { return wp; } public void setwp(int wp) { this.wp = wp; } public int getfp() { return fp; } public void setfp(int fp) { this.fp = fp; } public void print() { DecimalFormat d1= new DecimalFormat("00"); System.out.print(this.wp + "." + d1.format(this.fp)); } } public void add(Currency currency) { this.fp+= currency.fp; this.wp + this.fp/100 + currency.wp; this.fp = 100; } public void subtract (Currency currency) { if(!this.isGreater (currency) && !this.is Equal (currency)) { System.out.println("Invalid subtraction"); } } return; this.fp = currency.fp; this.wp = currency.wp; if(this.fp < 0) this.fp += 100; public boolean isGreater (Currency currency) { double ca = (double) this.wp + (double) this.fp/100; double ta = (double) currency.wp + (double) currency.fp/100; return ca > ta; } public boolean is Equal(Currency currency) { double ca = (double) this.wp + (double) this.fp/100; double ta = (double) currency.wp + (double) currency.fp/100; return ca == ta;
o Then, create one each of SinglyLinkedList, Stack and Queue objects.
o For the linked list, perform the following operations in order -
A. Add the first seven (7) objects from the array into the linked list in order such that they end up in the reverse order in the linked list, i.e. the
seventh element as first node and first element as seventh node. If it is easier, you are allowed to insert copies of the objects.
B. Search for $87.43 followed by $44.56 - print the results of each.
C. Remove the node containing $111.22 followed by the node at index 2.
D. Print the contents of the list.
E. Then add the next five (5) four (4) objects (#9 thru 12) such that their index in the linked list is calculated as (index in array % 5).
F. Remove two (2) objects at indexes (countCurrency % 6) and (countCurrency / 7) in that order.
G. Print the contents of the list.
o For the stack, perform the following operations in order -
A. Push seven (7) objects starting from the array index 13 onwards to the stack.
B. Peek the top of the stack - print the result.
C. Perform three (3) pops in succession.
D. Print the contents of the stack.
E. Push five (5) more objects from the start of the objects array to the stack.
F. Pop twice in succession.
G. Print the contents of the stack.
o For the queue, perform the following operations in order -
A. Enqueue the seven (7) objects at odd indexes starting from index 5 in the array.
B. Peek the front and end of the queue - print the results.
C. Perform two (2) dequeues in succession.
D. Print the contents of the queue.
E. Enqueue five (5) more objects from the index 10 in the array.
F. Dequeue three times in succession.
G. Print the contents of the queue.
Transcribed Image Text:o Then, create one each of SinglyLinkedList, Stack and Queue objects. o For the linked list, perform the following operations in order - A. Add the first seven (7) objects from the array into the linked list in order such that they end up in the reverse order in the linked list, i.e. the seventh element as first node and first element as seventh node. If it is easier, you are allowed to insert copies of the objects. B. Search for $87.43 followed by $44.56 - print the results of each. C. Remove the node containing $111.22 followed by the node at index 2. D. Print the contents of the list. E. Then add the next five (5) four (4) objects (#9 thru 12) such that their index in the linked list is calculated as (index in array % 5). F. Remove two (2) objects at indexes (countCurrency % 6) and (countCurrency / 7) in that order. G. Print the contents of the list. o For the stack, perform the following operations in order - A. Push seven (7) objects starting from the array index 13 onwards to the stack. B. Peek the top of the stack - print the result. C. Perform three (3) pops in succession. D. Print the contents of the stack. E. Push five (5) more objects from the start of the objects array to the stack. F. Pop twice in succession. G. Print the contents of the stack. o For the queue, perform the following operations in order - A. Enqueue the seven (7) objects at odd indexes starting from index 5 in the array. B. Peek the front and end of the queue - print the results. C. Perform two (2) dequeues in succession. D. Print the contents of the queue. E. Enqueue five (5) more objects from the index 10 in the array. F. Dequeue three times in succession. G. Print the contents of the queue.
Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 2 steps

Blurred answer
Knowledge Booster
Concept of pointer parameter
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
Database System Concepts
Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
Starting Out with Python (4th Edition)
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
C How to Program (8th Edition)
C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON
Database Systems: Design, Implementation, & Manag…
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
Programmable Logic Controllers
Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education