Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

In C++ please. DOLLAR class: #pragma once #include using namespace std; class Dollar // Dollar class { protected: int noteValue; int coinValue; string currencyName; public:

In C++ please.

DOLLAR class:

#pragma once #include

using namespace std;

class Dollar // Dollar class { protected: int noteValue; int coinValue; string currencyName; public: Dollar() {}; // default constructor

Dollar(int note, int coin) { // parameterized constructor noteValue = note; coinValue = coin; } ~Dollar() { // copy constructor

}; // setters and getters. int getNoteValue() { return noteValue; } void setNoteValue(int x) { noteValue = x; }

int getCoinValue() { return coinValue; } void setCoinValue(int x) { coinValue = x; }

Dollar operator +(Dollar obj) { Dollar obj2; obj2.noteValue = noteValue + obj.noteValue; obj2.coinValue = coinValue + obj.coinValue; return obj2; }

Dollar operator -(Dollar obj) { Dollar obj2; obj2.noteValue = this->noteValue - obj.noteValue; obj2.coinValue = this->coinValue - obj.coinValue; return obj2; } Dollar operator = (Dollar obj) { Dollar obj2; obj2.noteValue = obj.noteValue; obj2.coinValue = obj.coinValue; return obj2; } bool operator ==(Dollar obj) { if ((this->noteValue == obj.noteValue) && (this->coinValue == obj.coinValue)) return true; else return false; } bool operator noteValue coinValue (Dollar obj) { if ((this->noteValue > obj.noteValue) && (this->coinValue > obj.coinValue)) return true; else return false; } double dollarToCsdollar(int note, int coin) // converter from Dollar to CIS22CDollar { double amount = (note + coin * 0.01); return amount * 1.36; } double dollarAmount(int note, int coin) //Total calculator for Dollar { cout

int getCoinValue() { return coinValue; } void setCoinValue(int y) { coinValue = y; } double conversionToDollar(int note, int coin) { // converter to DOLLAR class double amount = (note + coin * 0.001); return amount * 0.74; } double cisDollarAmount(int note, int coin) { // total number of cents which is used later in code. (note + coin * 0.01); } };

image text in transcribed

For this assignment, you need to implement link-based List and derivative ADTs. To complete this, you will need the following: 1. 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 Link Node should be the USD class of Lab 1. 2. A Singly Linked List class which will be composed of three attributes - a count attribute, a LinkedNode pointer/reference attribute pointing to the start of the list and a LinkedNode pointer/reference attribute pointing to the end of the list. Since this is a class, make sure all these attributes are private. 3. The attribute names for the Node and Linked List are the words in bold in #1 and #2. 4. For the Linked List, implement the most common linked-list behaviors as explained in class - 1. getters/setters/constructors/destructors for the attributes of the class, 2. (a) create new list, (b) add data, (c) delete data, (d) find data, (e) count of data items in the list, (f) is list empty, (g) empty/destroy the list and (h) print all data items in a list. 3. Any other methods you think would be useful in your program. 5. A Stack class derived from the Linked List but with no additional attributes and the usual stack methods - (a) create stack, (b) push, (c) pop, (d) peek, and (e) destroy/empty the stack. Ensure that the Stack objects do not allow Linked List functions to be used on them. 6. A Queue class derived from the Linked List but with no additional attributes and the usual queue methods - (a) create queue, (b) enqueue, (c) dequeue, (d) peekFront, (e) peekRear, and (f) destroy/empty the queue. Ensure that the Queue objects do not allow Linked List functions to be used on them. 7. Ensure that all your classes are mimimal and cohesive with adequate walls around them. Try to reuse and not duplicate any code. Define interfaces as needed, so you can reuse them in your project. 8. Then write a main driver program that will demonstrate all the capabilities of your ADTs as follows - 1. Create seven (7) Node objects of USD class to be used in the program. 2. Demonstrate the use of your LinkedList with the seven USD Node objects inserted/deleted/searched in a random order. Remember, you will need to print the contents of the List several times to demonstrate the functionality. 3. Demonstrate the use of your Stack with the seven USD Node objects pushed/popped/peeked in a random order different from the one in LinkedList. 4. Demonstrate the use of your Queue with the seven USD Node objects enqueued/dequeued/peeked in a random order different from both the Linked List and Stack. 5. Demonstrate use of all the methods above by providing sufficient information to screen for actions being taken. 6. Restrict all your input/output to the main driver program only. 9. Remember to include the code file(s) for your USD class. Also, your 'main' which is the driver program should be in a separate file of its own. Remember to include pre/post documentation and comment blocks as necessary in your code files. In your submission, also include screenshots

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Essential Accounting For Managers

Authors: A.P. Robson

6th Edition

0826454712, 9780826454713

Students also viewed these Databases questions