Computers and Technology
28.01.2022 02:10
168
254
6
Solved by an expert

Write a program that will sort an array of data using the following guidelines -

Write a program that will sort an array of data using the following guidelines - DO NOT USE VECTORS, COLLECTIONS, SETS or any other data structures from your programming language. C++
Ask the user for the number of elements, not to exceed SORT_MAX_SIZE = 16 (put appropriate input validation)
Ask the user for the type of data they will enter - Dollar or CIS22C_Dollar objects from Lab 1.
Use your Dollar and CIS22C_Dollar classes from Lab 1 as-is without making any changes. If you do make changes to be able to complete this lab, then there will be a small penalty.
Based on the input, create an appropriate array for the data to be entered.
Write a helper function called RecurMergeSort such that: It is a standalone function not part of any class of Lab 1, Takes in the same type of parameters as any standard MergeSort with recursion behavior, i.e. void MergeSort(Dollar arr[], int size) Prints out how the array looks every time a recursive step returns back to its caller You might need to pass in a third parameter which identifies the array to be printed - this is language dependent.
In your main, allow the user to enter data of their own choosing up to their chosen array size. There is no sample output - you are allowed to provide user interactivity as you see fit but programs will be graded for clarity of interaction.
Then sort the array using your sort function of step 5.
Take screenshots to be uploaded with the project. In your main, make sure that the output is being written to console as well as an output file at the same time.
Do not copy and paste text from your console to create the output file.
Ensure input and any other data validations as needed and provide descriptive prompts with emphasis on usability. Upload your classes from Lab 1 and new code files for Lab 3, output file and the screenshots in one zip file.
The Dollar and CISDOLLAR class are as follows:
class Dollar // Dollar class
{
private:
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;
}
bool operator ==(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 << "Dollars:" << (note + coin * 0.01);
return (note + coin * 0.01);
}
};
class CIS22CDollar :public Dollar { // CIS22CDollar class, derived from Dollar Class;
private:
int noteValue;
int coinValue;
double conversionFactor;
double convertTo22C()
{
conversionFactor = 1.36;
return conversionFactor;
}
double convertToDollar() {
conversionFactor = 0.74;
return conversionFactor;
}
public:
CIS22CDollar() {}; //default constructor
CIS22CDollar(int note, int coin) { // parameterized constructor
noteValue = note;
coinValue = coin;
};
~CIS22CDollar() {}; // copy constructor
// Setters and getters.
int getNoteValue() {
return noteValue;
}
void setNoteValue(int x) {
noteValue = x;
}

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);
}
};
Show Answers
jboii11
jboii11
4,9(28 marks)

It allows you to see the interpreter’s algorithm.

Explanation:

REPL stands for Read-Evaluate-Print-Loop, and it is an interactive CLI Interpreter Shell. It works in the way as it is stated. The first task it does is to read through the expression which is provided as input on the Scala command line and after that it evaluates the expression and final print the expression outcome on to the screen, and after that it again becomes good enough to read and this happens in loop. And in the current scope, the previous outcomes are imported automatically. It reads through the expression in interactive mode at the prompt, and then it wraps all into a template which is executable, and then it does the compiling and finally it executes the result. Hence, the third option is correct but the rest of the options are not correct.

Popular Questions about the subject: Computers and Technology

Email, instant messaging and most web traffic go across the internet...
Computers and Technology
03.04.2020 18:48
Adatabase stores a large amount data in vertical a.) records b) fields...
Computers and Technology
03.05.2020 04:35
Which memory device should peter use in his digital camera and media...
Computers and Technology
08.06.2021 12:21
What happens when you sort and filter data in microsoft word?...
Computers and Technology
11.07.2020 22:46
The law that says you must submit to a test for the presence of alcohol...
Computers and Technology
20.04.2021 19:50
Is the command for opening a spreadsheet object in a separate spreadsheet...
Computers and Technology
04.09.2021 11:20

New questions by subject

What is the average velocity of wind within a storm?...
Social Studies
18.02.2020 06:19
Fred buys a car for £3,000. he sells it 2 years later for £2,200. does...
Mathematics
07.04.2023 21:10
Multiply. 43√⋅1012−−√⋅6√⋅2√ enter your answer, in simplest radical...
Mathematics
05.06.2022 12:16
To change the tone of the sentence from joy for a neutral which word...
English
11.02.2021 10:45
Why doesn t a ball roll on forever after being kicked at a soccer game...
Biology
02.05.2020 19:12
When trying to find out if a triangle is a right, acute or obtuse and...
Mathematics
19.05.2020 19:06
Rain that tends to fall in bands on earth is caused by which of the...
Chemistry
21.11.2020 16:32
What should you do if you need to determine the odor of a chemical...
Chemistry
21.04.2022 06:22
#
#
#
#
# #

We expand our knowledge with many expert answers