SlideShare a Scribd company logo
1 of 9
hello. please dont just copy from other answers, the following is the code that is already have and
can u modified it for the following instructions.
instructions ----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 write 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) Krone objects in a Currency array to be used in the
program.
Kr 57.12
Kr 23.44
Kr 87.43
Kr 68.99
Kr 111.22
Kr 44.55
Kr 77.77
Kr 18.36
Kr 543.21
Kr 20.21
Kr 345.67
Kr 36.18
Kr 48.48
Kr 101.00
Kr 11.00
Kr 21.00
Kr 51.00
Kr 1.00
Kr 251.00
Kr 151.00
Then, create one each of SinglyLinkedList, Stack and Queue objects.
For the linked list, perform the following operations in order -
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.
Search for Kr 87.43 followed by Kr 44.56 - print the results of each.
Remove the node containing Kr 111.22 followed by the node at index 2.
Print the contents of the list.
Then add the next four (4) objects (#9 thru 12) such that their index in the linked list is calculated
as (index in array % 5).
Remove two (2) objects at indexes (countCurrency % 6) and (countCurrency / 7) in that order.
Print the contents of the list.
For the stack, perform the following operations in order -
Push seven (7) objects starting from the array index 13 onwards to the stack.
Peek the top of the stack - print the result.
Perform three (3) pops in succession.
Print the contents of the stack.
Push five (5) more objects from the start of the objects array to the stack.
Pop twice in succession.
Print the contents of the stack.
For the queue, perform the following operations in order -
Enqueue the seven (7) objects at odd indexes starting from index 5 in the array.
Peek the front and end of the queue - print the results.
Perform two (2) dequeues in succession.
Print the contents of the queue.
Enqueue five (5) more objects from the index 10 in the array.
Dequeue three times in succession.
Print the contents of the queue.
End the program with a leaving message of your choice. Remember to clean up before the
program ends.
Restrict all your input / output to the main driver program only, except for the existing screen
print inside the Currency print methods.
code that for currency class before this-
#include <iostream>
#include <cmath>
class Currency {
protected:
int whole;
int fraction;
virtual std::string get_name() = 0;
public:
Currency() {
whole = 0;
fraction = 0;
}
Currency(double value) {
if (value < 0)
throw "Invalid value";
whole = int(value);
fraction = std::round(100 * (value - whole));
}
Currency(const Currency& curr) {
whole = curr.whole;
fraction = curr.fraction;
}
int get_whole() { return whole; }
int get_fraction() { return fraction; }
void set_whole(int w) {
if (w >= 0)
whole = w;
}
void set_fraction(int f) {
if (f >= 0 && f < 100)
fraction = f;
}
void add(const Currency* curr) {
whole += curr->whole;
fraction += curr->fraction;
if (fraction > 100) {
whole++;
fraction %= 100;
}
}
void subtract(const Currency* curr) {
if (!isGreater(*curr))
throw "Invalid Subtraction";
whole -= curr->whole;
if (fraction < curr->fraction) {
fraction = fraction + 100 - curr->fraction;
whole--;
}
else {
fraction -= curr->fraction;
}
}
bool isEqual(const Currency& curr) {
return curr.whole == whole && curr.fraction == fraction;
}
bool isGreater(const Currency& curr) {
if (whole < curr.whole)
return false;
if (whole == curr.whole && fraction < curr.fraction)
return false;
return true;
}
void print() {
std::cout << whole << "." << fraction << " " << get_name() << std::endl;
}
};
class Krone : public Currency {
protected:
std::string name = "Krone";
std::string get_name() {
return name;
}
public:
Krone() : Currency() { }
Krone(double value) : Currency(value) { }
Krone(Krone& curr) : Currency(curr) { }
};
class Soum : public Currency {
protected:
std::string name = "Soum";
std::string get_name() {
return name;
}
public:
Soum() : Currency() { }
Soum(double value) : Currency(value) { }
Soum(Krone& curr) : Currency(curr) { }
};
int main() {
Currency* currencies[2] = { new Soum(), new Krone() };
while (true) {
currencies[0]->print();
currencies[1]->print();
char oprr;
char oprd;
double value;
char curr[10];
std::cin >> oprr;
if (oprr == 'q') {
return 0;
}
std::cin >> oprd >> value >> curr;
std::string currency(curr);
try {
switch (oprr) {
case 'a':
if (oprd == 's' && currency == "Soum")
currencies[0]->add(new Soum(value));
else if (oprd == 'k' && currency == "Krone")
currencies[1]->add(new Krone(value));
else
throw "Invalid Addition";
break;
case 's':
if (oprd == 's' && currency == "Soum")
currencies[0]->subtract(new Soum(value));
else if (oprd == 'k' && currency == "Krone")
currencies[1]->subtract(new Krone(value));
else
throw "Invalid Subtraction";
break;
default:
throw "Invalid Operator";
}
}
catch (const char e[]) {
std::cout << e << std::endl;
}
}
}
hello- please dont just copy from other answers- the following is the.docx

More Related Content

Similar to hello- please dont just copy from other answers- the following is the.docx

CP PPT_Unit IV computer programming in c.pdf
CP PPT_Unit IV computer programming in c.pdfCP PPT_Unit IV computer programming in c.pdf
CP PPT_Unit IV computer programming in c.pdfsaneshgamerz
 
Need to be done in C Please Sorted number list implementation with.pdf
Need to be done in C  Please   Sorted number list implementation with.pdfNeed to be done in C  Please   Sorted number list implementation with.pdf
Need to be done in C Please Sorted number list implementation with.pdfaathmaproducts
 
Need done for Date Structures please! 4-18 LAB- Sorted number list imp.pdf
Need done for Date Structures please! 4-18 LAB- Sorted number list imp.pdfNeed done for Date Structures please! 4-18 LAB- Sorted number list imp.pdf
Need done for Date Structures please! 4-18 LAB- Sorted number list imp.pdfinfo114
 
Need to be done in C++ Please Sorted number list implementation wit.pdf
Need to be done in C++  Please   Sorted number list implementation wit.pdfNeed to be done in C++  Please   Sorted number list implementation wit.pdf
Need to be done in C++ Please Sorted number list implementation wit.pdfaathiauto
 
I really need help with this Assignment Please in C programming not .pdf
I really need help with this Assignment Please in C programming not .pdfI really need help with this Assignment Please in C programming not .pdf
I really need help with this Assignment Please in C programming not .pdfpasqualealvarez467
 
maincpp Build and procees a sorted linked list of Patie.pdf
maincpp   Build and procees a sorted linked list of Patie.pdfmaincpp   Build and procees a sorted linked list of Patie.pdf
maincpp Build and procees a sorted linked list of Patie.pdfadityastores21
 
In C++ please, do not alter node.hStep 1 Inspect the Node.h file.pdf
In C++ please, do not alter node.hStep 1 Inspect the Node.h file.pdfIn C++ please, do not alter node.hStep 1 Inspect the Node.h file.pdf
In C++ please, do not alter node.hStep 1 Inspect the Node.h file.pdfstopgolook
 
you will implement some sorting algorithms for arrays and linked lis.pdf
you will implement some sorting algorithms for arrays and linked lis.pdfyou will implement some sorting algorithms for arrays and linked lis.pdf
you will implement some sorting algorithms for arrays and linked lis.pdfinfo335653
 
queuesArrays.ppt bbbbbbbbbbbbbbbbbbbbbbbbbb
queuesArrays.ppt bbbbbbbbbbbbbbbbbbbbbbbbbbqueuesArrays.ppt bbbbbbbbbbbbbbbbbbbbbbbbbb
queuesArrays.ppt bbbbbbbbbbbbbbbbbbbbbbbbbbRAtna29
 
Most Important C language program
Most Important C language programMost Important C language program
Most Important C language programTEJVEER SINGH
 
Cheat Sheet for Stata v15.00 PDF Complete
Cheat Sheet for Stata v15.00 PDF CompleteCheat Sheet for Stata v15.00 PDF Complete
Cheat Sheet for Stata v15.00 PDF CompleteTsamaraLuthfia1
 
Create a Queue class that implements a queue abstraction. A queue is.docx
Create a Queue class that implements a queue abstraction. A queue is.docxCreate a Queue class that implements a queue abstraction. A queue is.docx
Create a Queue class that implements a queue abstraction. A queue is.docxrajahchelsey
 
you will implement some sorting algorithms for arrays and linked lis.pdf
you will implement some sorting algorithms for arrays and linked lis.pdfyou will implement some sorting algorithms for arrays and linked lis.pdf
you will implement some sorting algorithms for arrays and linked lis.pdfclearvisioneyecareno
 

Similar to hello- please dont just copy from other answers- the following is the.docx (20)

Technical
TechnicalTechnical
Technical
 
C Exam Help
C Exam Help C Exam Help
C Exam Help
 
CP PPT_Unit IV computer programming in c.pdf
CP PPT_Unit IV computer programming in c.pdfCP PPT_Unit IV computer programming in c.pdf
CP PPT_Unit IV computer programming in c.pdf
 
Need to be done in C Please Sorted number list implementation with.pdf
Need to be done in C  Please   Sorted number list implementation with.pdfNeed to be done in C  Please   Sorted number list implementation with.pdf
Need to be done in C Please Sorted number list implementation with.pdf
 
Need done for Date Structures please! 4-18 LAB- Sorted number list imp.pdf
Need done for Date Structures please! 4-18 LAB- Sorted number list imp.pdfNeed done for Date Structures please! 4-18 LAB- Sorted number list imp.pdf
Need done for Date Structures please! 4-18 LAB- Sorted number list imp.pdf
 
Need to be done in C++ Please Sorted number list implementation wit.pdf
Need to be done in C++  Please   Sorted number list implementation wit.pdfNeed to be done in C++  Please   Sorted number list implementation wit.pdf
Need to be done in C++ Please Sorted number list implementation wit.pdf
 
I really need help with this Assignment Please in C programming not .pdf
I really need help with this Assignment Please in C programming not .pdfI really need help with this Assignment Please in C programming not .pdf
I really need help with this Assignment Please in C programming not .pdf
 
maincpp Build and procees a sorted linked list of Patie.pdf
maincpp   Build and procees a sorted linked list of Patie.pdfmaincpp   Build and procees a sorted linked list of Patie.pdf
maincpp Build and procees a sorted linked list of Patie.pdf
 
In C++ please, do not alter node.hStep 1 Inspect the Node.h file.pdf
In C++ please, do not alter node.hStep 1 Inspect the Node.h file.pdfIn C++ please, do not alter node.hStep 1 Inspect the Node.h file.pdf
In C++ please, do not alter node.hStep 1 Inspect the Node.h file.pdf
 
you will implement some sorting algorithms for arrays and linked lis.pdf
you will implement some sorting algorithms for arrays and linked lis.pdfyou will implement some sorting algorithms for arrays and linked lis.pdf
you will implement some sorting algorithms for arrays and linked lis.pdf
 
Perl
PerlPerl
Perl
 
Unit7 C
Unit7 CUnit7 C
Unit7 C
 
Python - Lecture 12
Python - Lecture 12Python - Lecture 12
Python - Lecture 12
 
queuesArrays.ppt bbbbbbbbbbbbbbbbbbbbbbbbbb
queuesArrays.ppt bbbbbbbbbbbbbbbbbbbbbbbbbbqueuesArrays.ppt bbbbbbbbbbbbbbbbbbbbbbbbbb
queuesArrays.ppt bbbbbbbbbbbbbbbbbbbbbbbbbb
 
Most Important C language program
Most Important C language programMost Important C language program
Most Important C language program
 
Bcsl 033 solve assignment
Bcsl 033 solve assignmentBcsl 033 solve assignment
Bcsl 033 solve assignment
 
Cheat Sheet for Stata v15.00 PDF Complete
Cheat Sheet for Stata v15.00 PDF CompleteCheat Sheet for Stata v15.00 PDF Complete
Cheat Sheet for Stata v15.00 PDF Complete
 
Create a Queue class that implements a queue abstraction. A queue is.docx
Create a Queue class that implements a queue abstraction. A queue is.docxCreate a Queue class that implements a queue abstraction. A queue is.docx
Create a Queue class that implements a queue abstraction. A queue is.docx
 
you will implement some sorting algorithms for arrays and linked lis.pdf
you will implement some sorting algorithms for arrays and linked lis.pdfyou will implement some sorting algorithms for arrays and linked lis.pdf
you will implement some sorting algorithms for arrays and linked lis.pdf
 
03. Week 03.pptx
03. Week 03.pptx03. Week 03.pptx
03. Week 03.pptx
 

More from Isaac9LjWelchq

help 4- A ray of light is sent in a random direction towards the x-axi.docx
help 4- A ray of light is sent in a random direction towards the x-axi.docxhelp 4- A ray of light is sent in a random direction towards the x-axi.docx
help 4- A ray of light is sent in a random direction towards the x-axi.docxIsaac9LjWelchq
 
Hello- I am working on writing a penetration test plan for a fictitiou.docx
Hello- I am working on writing a penetration test plan for a fictitiou.docxHello- I am working on writing a penetration test plan for a fictitiou.docx
Hello- I am working on writing a penetration test plan for a fictitiou.docxIsaac9LjWelchq
 
Hello- I am struggling with figuring out how to solve for this The hor.docx
Hello- I am struggling with figuring out how to solve for this The hor.docxHello- I am struggling with figuring out how to solve for this The hor.docx
Hello- I am struggling with figuring out how to solve for this The hor.docxIsaac9LjWelchq
 
Hello! I need help with below project-Thank You- Please name and expla.docx
Hello! I need help with below project-Thank You- Please name and expla.docxHello! I need help with below project-Thank You- Please name and expla.docx
Hello! I need help with below project-Thank You- Please name and expla.docxIsaac9LjWelchq
 
Hello I wanted to know if I can get help with my medical information c.docx
Hello I wanted to know if I can get help with my medical information c.docxHello I wanted to know if I can get help with my medical information c.docx
Hello I wanted to know if I can get help with my medical information c.docxIsaac9LjWelchq
 
Hector loved visiting and playing with his grandson- David- Today was.docx
Hector loved visiting and playing with his grandson- David- Today was.docxHector loved visiting and playing with his grandson- David- Today was.docx
Hector loved visiting and playing with his grandson- David- Today was.docxIsaac9LjWelchq
 
Health psychology is a(n) - based science because practitioners are tr.docx
Health psychology is a(n) - based science because practitioners are tr.docxHealth psychology is a(n) - based science because practitioners are tr.docx
Health psychology is a(n) - based science because practitioners are tr.docxIsaac9LjWelchq
 
Healthcare Operations Analysis Utilizing Information Technology Explai.docx
Healthcare Operations Analysis Utilizing Information Technology Explai.docxHealthcare Operations Analysis Utilizing Information Technology Explai.docx
Healthcare Operations Analysis Utilizing Information Technology Explai.docxIsaac9LjWelchq
 
Hearing 10- What is the function of each of the following anatomical f.docx
Hearing 10- What is the function of each of the following anatomical f.docxHearing 10- What is the function of each of the following anatomical f.docx
Hearing 10- What is the function of each of the following anatomical f.docxIsaac9LjWelchq
 
Health information is important to public health authorities during an.docx
Health information is important to public health authorities during an.docxHealth information is important to public health authorities during an.docx
Health information is important to public health authorities during an.docxIsaac9LjWelchq
 
he reflex and reaction lab helped us understand how different factors.docx
he reflex and reaction lab helped us understand how different factors.docxhe reflex and reaction lab helped us understand how different factors.docx
he reflex and reaction lab helped us understand how different factors.docxIsaac9LjWelchq
 
having trouble with my code I'm using VScode to code a javascript code.docx
having trouble with my code I'm using VScode to code a javascript code.docxhaving trouble with my code I'm using VScode to code a javascript code.docx
having trouble with my code I'm using VScode to code a javascript code.docxIsaac9LjWelchq
 
How they can live a more Eco-friendly- Sustainable and Community Engag.docx
How they can live a more Eco-friendly- Sustainable and Community Engag.docxHow they can live a more Eco-friendly- Sustainable and Community Engag.docx
How they can live a more Eco-friendly- Sustainable and Community Engag.docxIsaac9LjWelchq
 
How to determine whether a language is regular or not using Myhill-Ner.docx
How to determine whether a language is regular or not using Myhill-Ner.docxHow to determine whether a language is regular or not using Myhill-Ner.docx
How to determine whether a language is regular or not using Myhill-Ner.docxIsaac9LjWelchq
 
How many references are there to the list that refers to after the fol.docx
How many references are there to the list that refers to after the fol.docxHow many references are there to the list that refers to after the fol.docx
How many references are there to the list that refers to after the fol.docxIsaac9LjWelchq
 
How is the protective group removed to allow the addition of nucleotid.docx
How is the protective group removed to allow the addition of nucleotid.docxHow is the protective group removed to allow the addition of nucleotid.docx
How is the protective group removed to allow the addition of nucleotid.docxIsaac9LjWelchq
 
Has it been shown in the lab that simple organic compounds have formed.docx
Has it been shown in the lab that simple organic compounds have formed.docxHas it been shown in the lab that simple organic compounds have formed.docx
Has it been shown in the lab that simple organic compounds have formed.docxIsaac9LjWelchq
 
How many possible ways can you roll a seven- What is the probability o.docx
How many possible ways can you roll a seven- What is the probability o.docxHow many possible ways can you roll a seven- What is the probability o.docx
How many possible ways can you roll a seven- What is the probability o.docxIsaac9LjWelchq
 
have type O blood- (Round your answers to four decimal places-).docx
have type O blood- (Round your answers to four decimal places-).docxhave type O blood- (Round your answers to four decimal places-).docx
have type O blood- (Round your answers to four decimal places-).docxIsaac9LjWelchq
 
How many ways can Marie choose 2 pizza toppings from a menu of 8 toppi.docx
How many ways can Marie choose 2 pizza toppings from a menu of 8 toppi.docxHow many ways can Marie choose 2 pizza toppings from a menu of 8 toppi.docx
How many ways can Marie choose 2 pizza toppings from a menu of 8 toppi.docxIsaac9LjWelchq
 

More from Isaac9LjWelchq (20)

help 4- A ray of light is sent in a random direction towards the x-axi.docx
help 4- A ray of light is sent in a random direction towards the x-axi.docxhelp 4- A ray of light is sent in a random direction towards the x-axi.docx
help 4- A ray of light is sent in a random direction towards the x-axi.docx
 
Hello- I am working on writing a penetration test plan for a fictitiou.docx
Hello- I am working on writing a penetration test plan for a fictitiou.docxHello- I am working on writing a penetration test plan for a fictitiou.docx
Hello- I am working on writing a penetration test plan for a fictitiou.docx
 
Hello- I am struggling with figuring out how to solve for this The hor.docx
Hello- I am struggling with figuring out how to solve for this The hor.docxHello- I am struggling with figuring out how to solve for this The hor.docx
Hello- I am struggling with figuring out how to solve for this The hor.docx
 
Hello! I need help with below project-Thank You- Please name and expla.docx
Hello! I need help with below project-Thank You- Please name and expla.docxHello! I need help with below project-Thank You- Please name and expla.docx
Hello! I need help with below project-Thank You- Please name and expla.docx
 
Hello I wanted to know if I can get help with my medical information c.docx
Hello I wanted to know if I can get help with my medical information c.docxHello I wanted to know if I can get help with my medical information c.docx
Hello I wanted to know if I can get help with my medical information c.docx
 
Hector loved visiting and playing with his grandson- David- Today was.docx
Hector loved visiting and playing with his grandson- David- Today was.docxHector loved visiting and playing with his grandson- David- Today was.docx
Hector loved visiting and playing with his grandson- David- Today was.docx
 
Health psychology is a(n) - based science because practitioners are tr.docx
Health psychology is a(n) - based science because practitioners are tr.docxHealth psychology is a(n) - based science because practitioners are tr.docx
Health psychology is a(n) - based science because practitioners are tr.docx
 
Healthcare Operations Analysis Utilizing Information Technology Explai.docx
Healthcare Operations Analysis Utilizing Information Technology Explai.docxHealthcare Operations Analysis Utilizing Information Technology Explai.docx
Healthcare Operations Analysis Utilizing Information Technology Explai.docx
 
Hearing 10- What is the function of each of the following anatomical f.docx
Hearing 10- What is the function of each of the following anatomical f.docxHearing 10- What is the function of each of the following anatomical f.docx
Hearing 10- What is the function of each of the following anatomical f.docx
 
Health information is important to public health authorities during an.docx
Health information is important to public health authorities during an.docxHealth information is important to public health authorities during an.docx
Health information is important to public health authorities during an.docx
 
he reflex and reaction lab helped us understand how different factors.docx
he reflex and reaction lab helped us understand how different factors.docxhe reflex and reaction lab helped us understand how different factors.docx
he reflex and reaction lab helped us understand how different factors.docx
 
having trouble with my code I'm using VScode to code a javascript code.docx
having trouble with my code I'm using VScode to code a javascript code.docxhaving trouble with my code I'm using VScode to code a javascript code.docx
having trouble with my code I'm using VScode to code a javascript code.docx
 
How they can live a more Eco-friendly- Sustainable and Community Engag.docx
How they can live a more Eco-friendly- Sustainable and Community Engag.docxHow they can live a more Eco-friendly- Sustainable and Community Engag.docx
How they can live a more Eco-friendly- Sustainable and Community Engag.docx
 
How to determine whether a language is regular or not using Myhill-Ner.docx
How to determine whether a language is regular or not using Myhill-Ner.docxHow to determine whether a language is regular or not using Myhill-Ner.docx
How to determine whether a language is regular or not using Myhill-Ner.docx
 
How many references are there to the list that refers to after the fol.docx
How many references are there to the list that refers to after the fol.docxHow many references are there to the list that refers to after the fol.docx
How many references are there to the list that refers to after the fol.docx
 
How is the protective group removed to allow the addition of nucleotid.docx
How is the protective group removed to allow the addition of nucleotid.docxHow is the protective group removed to allow the addition of nucleotid.docx
How is the protective group removed to allow the addition of nucleotid.docx
 
Has it been shown in the lab that simple organic compounds have formed.docx
Has it been shown in the lab that simple organic compounds have formed.docxHas it been shown in the lab that simple organic compounds have formed.docx
Has it been shown in the lab that simple organic compounds have formed.docx
 
How many possible ways can you roll a seven- What is the probability o.docx
How many possible ways can you roll a seven- What is the probability o.docxHow many possible ways can you roll a seven- What is the probability o.docx
How many possible ways can you roll a seven- What is the probability o.docx
 
have type O blood- (Round your answers to four decimal places-).docx
have type O blood- (Round your answers to four decimal places-).docxhave type O blood- (Round your answers to four decimal places-).docx
have type O blood- (Round your answers to four decimal places-).docx
 
How many ways can Marie choose 2 pizza toppings from a menu of 8 toppi.docx
How many ways can Marie choose 2 pizza toppings from a menu of 8 toppi.docxHow many ways can Marie choose 2 pizza toppings from a menu of 8 toppi.docx
How many ways can Marie choose 2 pizza toppings from a menu of 8 toppi.docx
 

Recently uploaded

Sensory_Experience_and_Emotional_Resonance_in_Gabriel_Okaras_The_Piano_and_Th...
Sensory_Experience_and_Emotional_Resonance_in_Gabriel_Okaras_The_Piano_and_Th...Sensory_Experience_and_Emotional_Resonance_in_Gabriel_Okaras_The_Piano_and_Th...
Sensory_Experience_and_Emotional_Resonance_in_Gabriel_Okaras_The_Piano_and_Th...Pooja Bhuva
 
HMCS Vancouver Pre-Deployment Brief - May 2024 (Web Version).pptx
HMCS Vancouver Pre-Deployment Brief - May 2024 (Web Version).pptxHMCS Vancouver Pre-Deployment Brief - May 2024 (Web Version).pptx
HMCS Vancouver Pre-Deployment Brief - May 2024 (Web Version).pptxmarlenawright1
 
Fostering Friendships - Enhancing Social Bonds in the Classroom
Fostering Friendships - Enhancing Social Bonds  in the ClassroomFostering Friendships - Enhancing Social Bonds  in the Classroom
Fostering Friendships - Enhancing Social Bonds in the ClassroomPooky Knightsmith
 
Application orientated numerical on hev.ppt
Application orientated numerical on hev.pptApplication orientated numerical on hev.ppt
Application orientated numerical on hev.pptRamjanShidvankar
 
On National Teacher Day, meet the 2024-25 Kenan Fellows
On National Teacher Day, meet the 2024-25 Kenan FellowsOn National Teacher Day, meet the 2024-25 Kenan Fellows
On National Teacher Day, meet the 2024-25 Kenan FellowsMebane Rash
 
Unit 3 Emotional Intelligence and Spiritual Intelligence.pdf
Unit 3 Emotional Intelligence and Spiritual Intelligence.pdfUnit 3 Emotional Intelligence and Spiritual Intelligence.pdf
Unit 3 Emotional Intelligence and Spiritual Intelligence.pdfDr Vijay Vishwakarma
 
How to setup Pycharm environment for Odoo 17.pptx
How to setup Pycharm environment for Odoo 17.pptxHow to setup Pycharm environment for Odoo 17.pptx
How to setup Pycharm environment for Odoo 17.pptxCeline George
 
ICT Role in 21st Century Education & its Challenges.pptx
ICT Role in 21st Century Education & its Challenges.pptxICT Role in 21st Century Education & its Challenges.pptx
ICT Role in 21st Century Education & its Challenges.pptxAreebaZafar22
 
ICT role in 21st century education and it's challenges.
ICT role in 21st century education and it's challenges.ICT role in 21st century education and it's challenges.
ICT role in 21st century education and it's challenges.MaryamAhmad92
 
Wellbeing inclusion and digital dystopias.pptx
Wellbeing inclusion and digital dystopias.pptxWellbeing inclusion and digital dystopias.pptx
Wellbeing inclusion and digital dystopias.pptxJisc
 
How to Give a Domain for a Field in Odoo 17
How to Give a Domain for a Field in Odoo 17How to Give a Domain for a Field in Odoo 17
How to Give a Domain for a Field in Odoo 17Celine George
 
HMCS Max Bernays Pre-Deployment Brief (May 2024).pptx
HMCS Max Bernays Pre-Deployment Brief (May 2024).pptxHMCS Max Bernays Pre-Deployment Brief (May 2024).pptx
HMCS Max Bernays Pre-Deployment Brief (May 2024).pptxEsquimalt MFRC
 
Graduate Outcomes Presentation Slides - English
Graduate Outcomes Presentation Slides - EnglishGraduate Outcomes Presentation Slides - English
Graduate Outcomes Presentation Slides - Englishneillewis46
 
UGC NET Paper 1 Mathematical Reasoning & Aptitude.pdf
UGC NET Paper 1 Mathematical Reasoning & Aptitude.pdfUGC NET Paper 1 Mathematical Reasoning & Aptitude.pdf
UGC NET Paper 1 Mathematical Reasoning & Aptitude.pdfNirmal Dwivedi
 
Google Gemini An AI Revolution in Education.pptx
Google Gemini An AI Revolution in Education.pptxGoogle Gemini An AI Revolution in Education.pptx
Google Gemini An AI Revolution in Education.pptxDr. Sarita Anand
 
Key note speaker Neum_Admir Softic_ENG.pdf
Key note speaker Neum_Admir Softic_ENG.pdfKey note speaker Neum_Admir Softic_ENG.pdf
Key note speaker Neum_Admir Softic_ENG.pdfAdmir Softic
 
Accessible Digital Futures project (20/03/2024)
Accessible Digital Futures project (20/03/2024)Accessible Digital Futures project (20/03/2024)
Accessible Digital Futures project (20/03/2024)Jisc
 
Making communications land - Are they received and understood as intended? we...
Making communications land - Are they received and understood as intended? we...Making communications land - Are they received and understood as intended? we...
Making communications land - Are they received and understood as intended? we...Association for Project Management
 
Micro-Scholarship, What it is, How can it help me.pdf
Micro-Scholarship, What it is, How can it help me.pdfMicro-Scholarship, What it is, How can it help me.pdf
Micro-Scholarship, What it is, How can it help me.pdfPoh-Sun Goh
 

Recently uploaded (20)

Mehran University Newsletter Vol-X, Issue-I, 2024
Mehran University Newsletter Vol-X, Issue-I, 2024Mehran University Newsletter Vol-X, Issue-I, 2024
Mehran University Newsletter Vol-X, Issue-I, 2024
 
Sensory_Experience_and_Emotional_Resonance_in_Gabriel_Okaras_The_Piano_and_Th...
Sensory_Experience_and_Emotional_Resonance_in_Gabriel_Okaras_The_Piano_and_Th...Sensory_Experience_and_Emotional_Resonance_in_Gabriel_Okaras_The_Piano_and_Th...
Sensory_Experience_and_Emotional_Resonance_in_Gabriel_Okaras_The_Piano_and_Th...
 
HMCS Vancouver Pre-Deployment Brief - May 2024 (Web Version).pptx
HMCS Vancouver Pre-Deployment Brief - May 2024 (Web Version).pptxHMCS Vancouver Pre-Deployment Brief - May 2024 (Web Version).pptx
HMCS Vancouver Pre-Deployment Brief - May 2024 (Web Version).pptx
 
Fostering Friendships - Enhancing Social Bonds in the Classroom
Fostering Friendships - Enhancing Social Bonds  in the ClassroomFostering Friendships - Enhancing Social Bonds  in the Classroom
Fostering Friendships - Enhancing Social Bonds in the Classroom
 
Application orientated numerical on hev.ppt
Application orientated numerical on hev.pptApplication orientated numerical on hev.ppt
Application orientated numerical on hev.ppt
 
On National Teacher Day, meet the 2024-25 Kenan Fellows
On National Teacher Day, meet the 2024-25 Kenan FellowsOn National Teacher Day, meet the 2024-25 Kenan Fellows
On National Teacher Day, meet the 2024-25 Kenan Fellows
 
Unit 3 Emotional Intelligence and Spiritual Intelligence.pdf
Unit 3 Emotional Intelligence and Spiritual Intelligence.pdfUnit 3 Emotional Intelligence and Spiritual Intelligence.pdf
Unit 3 Emotional Intelligence and Spiritual Intelligence.pdf
 
How to setup Pycharm environment for Odoo 17.pptx
How to setup Pycharm environment for Odoo 17.pptxHow to setup Pycharm environment for Odoo 17.pptx
How to setup Pycharm environment for Odoo 17.pptx
 
ICT Role in 21st Century Education & its Challenges.pptx
ICT Role in 21st Century Education & its Challenges.pptxICT Role in 21st Century Education & its Challenges.pptx
ICT Role in 21st Century Education & its Challenges.pptx
 
ICT role in 21st century education and it's challenges.
ICT role in 21st century education and it's challenges.ICT role in 21st century education and it's challenges.
ICT role in 21st century education and it's challenges.
 
Wellbeing inclusion and digital dystopias.pptx
Wellbeing inclusion and digital dystopias.pptxWellbeing inclusion and digital dystopias.pptx
Wellbeing inclusion and digital dystopias.pptx
 
How to Give a Domain for a Field in Odoo 17
How to Give a Domain for a Field in Odoo 17How to Give a Domain for a Field in Odoo 17
How to Give a Domain for a Field in Odoo 17
 
HMCS Max Bernays Pre-Deployment Brief (May 2024).pptx
HMCS Max Bernays Pre-Deployment Brief (May 2024).pptxHMCS Max Bernays Pre-Deployment Brief (May 2024).pptx
HMCS Max Bernays Pre-Deployment Brief (May 2024).pptx
 
Graduate Outcomes Presentation Slides - English
Graduate Outcomes Presentation Slides - EnglishGraduate Outcomes Presentation Slides - English
Graduate Outcomes Presentation Slides - English
 
UGC NET Paper 1 Mathematical Reasoning & Aptitude.pdf
UGC NET Paper 1 Mathematical Reasoning & Aptitude.pdfUGC NET Paper 1 Mathematical Reasoning & Aptitude.pdf
UGC NET Paper 1 Mathematical Reasoning & Aptitude.pdf
 
Google Gemini An AI Revolution in Education.pptx
Google Gemini An AI Revolution in Education.pptxGoogle Gemini An AI Revolution in Education.pptx
Google Gemini An AI Revolution in Education.pptx
 
Key note speaker Neum_Admir Softic_ENG.pdf
Key note speaker Neum_Admir Softic_ENG.pdfKey note speaker Neum_Admir Softic_ENG.pdf
Key note speaker Neum_Admir Softic_ENG.pdf
 
Accessible Digital Futures project (20/03/2024)
Accessible Digital Futures project (20/03/2024)Accessible Digital Futures project (20/03/2024)
Accessible Digital Futures project (20/03/2024)
 
Making communications land - Are they received and understood as intended? we...
Making communications land - Are they received and understood as intended? we...Making communications land - Are they received and understood as intended? we...
Making communications land - Are they received and understood as intended? we...
 
Micro-Scholarship, What it is, How can it help me.pdf
Micro-Scholarship, What it is, How can it help me.pdfMicro-Scholarship, What it is, How can it help me.pdf
Micro-Scholarship, What it is, How can it help me.pdf
 

hello- please dont just copy from other answers- the following is the.docx

  • 1. hello. please dont just copy from other answers, the following is the code that is already have and can u modified it for the following instructions. instructions ----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.
  • 2. 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.
  • 3. 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 write 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) Krone objects in a Currency array to be used in the program. Kr 57.12 Kr 23.44 Kr 87.43 Kr 68.99 Kr 111.22 Kr 44.55 Kr 77.77 Kr 18.36 Kr 543.21 Kr 20.21 Kr 345.67 Kr 36.18 Kr 48.48 Kr 101.00
  • 4. Kr 11.00 Kr 21.00 Kr 51.00 Kr 1.00 Kr 251.00 Kr 151.00 Then, create one each of SinglyLinkedList, Stack and Queue objects. For the linked list, perform the following operations in order - 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. Search for Kr 87.43 followed by Kr 44.56 - print the results of each. Remove the node containing Kr 111.22 followed by the node at index 2. Print the contents of the list. Then add the next four (4) objects (#9 thru 12) such that their index in the linked list is calculated as (index in array % 5). Remove two (2) objects at indexes (countCurrency % 6) and (countCurrency / 7) in that order. Print the contents of the list. For the stack, perform the following operations in order - Push seven (7) objects starting from the array index 13 onwards to the stack. Peek the top of the stack - print the result. Perform three (3) pops in succession. Print the contents of the stack. Push five (5) more objects from the start of the objects array to the stack. Pop twice in succession.
  • 5. Print the contents of the stack. For the queue, perform the following operations in order - Enqueue the seven (7) objects at odd indexes starting from index 5 in the array. Peek the front and end of the queue - print the results. Perform two (2) dequeues in succession. Print the contents of the queue. Enqueue five (5) more objects from the index 10 in the array. Dequeue three times in succession. Print the contents of the queue. End the program with a leaving message of your choice. Remember to clean up before the program ends. Restrict all your input / output to the main driver program only, except for the existing screen print inside the Currency print methods. code that for currency class before this- #include <iostream> #include <cmath> class Currency { protected: int whole; int fraction; virtual std::string get_name() = 0; public: Currency() { whole = 0; fraction = 0; } Currency(double value) { if (value < 0) throw "Invalid value"; whole = int(value); fraction = std::round(100 * (value - whole)); }
  • 6. Currency(const Currency& curr) { whole = curr.whole; fraction = curr.fraction; } int get_whole() { return whole; } int get_fraction() { return fraction; } void set_whole(int w) { if (w >= 0) whole = w; } void set_fraction(int f) { if (f >= 0 && f < 100) fraction = f; } void add(const Currency* curr) { whole += curr->whole; fraction += curr->fraction; if (fraction > 100) { whole++; fraction %= 100; } } void subtract(const Currency* curr) { if (!isGreater(*curr)) throw "Invalid Subtraction"; whole -= curr->whole; if (fraction < curr->fraction) { fraction = fraction + 100 - curr->fraction; whole--; } else { fraction -= curr->fraction; } } bool isEqual(const Currency& curr) { return curr.whole == whole && curr.fraction == fraction; } bool isGreater(const Currency& curr) { if (whole < curr.whole)
  • 7. return false; if (whole == curr.whole && fraction < curr.fraction) return false; return true; } void print() { std::cout << whole << "." << fraction << " " << get_name() << std::endl; } }; class Krone : public Currency { protected: std::string name = "Krone"; std::string get_name() { return name; } public: Krone() : Currency() { } Krone(double value) : Currency(value) { } Krone(Krone& curr) : Currency(curr) { } }; class Soum : public Currency { protected: std::string name = "Soum"; std::string get_name() { return name; } public: Soum() : Currency() { } Soum(double value) : Currency(value) { } Soum(Krone& curr) : Currency(curr) { } }; int main() { Currency* currencies[2] = { new Soum(), new Krone() }; while (true) { currencies[0]->print(); currencies[1]->print(); char oprr; char oprd; double value; char curr[10];
  • 8. std::cin >> oprr; if (oprr == 'q') { return 0; } std::cin >> oprd >> value >> curr; std::string currency(curr); try { switch (oprr) { case 'a': if (oprd == 's' && currency == "Soum") currencies[0]->add(new Soum(value)); else if (oprd == 'k' && currency == "Krone") currencies[1]->add(new Krone(value)); else throw "Invalid Addition"; break; case 's': if (oprd == 's' && currency == "Soum") currencies[0]->subtract(new Soum(value)); else if (oprd == 'k' && currency == "Krone") currencies[1]->subtract(new Krone(value)); else throw "Invalid Subtraction"; break; default: throw "Invalid Operator"; } } catch (const char e[]) { std::cout << e << std::endl; } } }