NumberList

C NumberList program based on the files i’ve shared at the bottom.NumberList.cpp************************************************************************************************#include “NumberList.h”#include using namespace std;NumberList::NumberList(){length = 10;int i;for(i = 0; i < length; i)Numbers[i] = 0;}//outputs the numbers in the NumberList horizontally each separated by a comma//to the standard output screenNumberList::NumberList(int l, double n){int i;for(i = o < length-1; i)cout << Numbers[i] << ", ";cout << Numbers[i];}//assignment constructor, initializes length to l//and sets the first l values of the list to the value nNumberList::NumberList(int l, const double a[]){length = i;int i;for(i = 0; i < length; i)Numbers[i] = n;}NumberList::NumberList(const NumberList & nl){}/*void NumberList::print(){}int NumberList::getLength(){}double NumberList::sum(){}double NumberList::ave(){}double NumberList::max(){}double NumberList::min(){}bool NumberList::isIn(double n){}bool NumberList::push(double value){}bool NumberList::pop(){}void NumberList::read(istream & inStream){if(&inStream == &cin){}else{//file structure: first line contains the number of numbers in the list//remaining lines contain the numbers each separated by a whitespace}}bool NumberList::insert(double number, int position){}//SELECTION SORT algorithmvoid NumberList::sort(char type){}bool NumberList::operator==(const NumberList& rhs){}NumberList& NumberList::operator=(const NumberList& rhs){//avoid self-assignment, only do assignment if RHS is a different object from thisif(this != &rhs){}return *this;}NumberList& NumberList::operator=(const double& number){if(length == 100)cout << "Unable to perform =, list is filled to capacityn";else{}return *this;}NumberList& NumberList::operator=(const NumberList& rhs){if(length == 100)cout << "Unable to perform =, list is filled to capacityn";else if(length rhs.length > 100)cout << "Unable to perform =, list would be over capacityn";else{}return *this;}//**************************************//FOR 10% EXTRA CREDIT ON THIS PROJECT GRADE, OVERLOAD THE FOLLOWING OPERATORS//AS NON-MEMBER FUNCTIONSostream& operator<<(ostream& out, const NumberList& nl){}const NumberList operator(NumberList& lhs, const double& number){}const NumberList operator(NumberList& lhs, const NumberList& rhs){}*/************************************************************************************************************************NumberList.h*************************************************************************************************************************#ifndef NUMBERLIST_H_#define NUMBERLIST_H_#include using namespace std;//integer constant that determines the size (max capacity) of the arrayconst int MAX_CAPACITY = 100;//This class will be used to store an ordered list of real numbers. The size of the list is//determined by the integer constant MAX_CAPACITY, for this project it will be set to 100 class NumberList{ private://the number of valid numbers currently in the NumberList stored in sequential//position order. int length; //static array used to store the numbers double numbers[MAX_CAPACITY]; public://default constructor, initializes all values of the list to 0//and sets length to 10 NumberList(); //assignment constructor, initializes length to l //and sets the first l values of the list to the value n NumberList(int l, double n);//constructor that takes an array of size l as input and assigns the first //l values of the NumberList to the corresponding l values of the input array a NumberList(int l, const double a[]); //copy constructor, creates a copy of input NumberList nl to the calling//NumberList NumberList(const NumberList& nl); //outputs the numbers in the NumberList horizontally each separated by a comma//to the standard output screen void print(); int getLength(); //returns the length of the NumberListdouble sum();//returns the sum of the numbers in the NumberListdouble ave();//returns the average value of the numbers in the NumberListdouble max();//returns the largest number in the NumberList double min();//returns the smallest number in the NumberList//Uses a sequential/linear search algorithm to determine if a number is in the//list. Returns true if number n is in list, otherwise returns false bool isIn(double n); //stores a value at the end of the NumberList, returns true if successful, //otherwise returns false (THE NUMBERLIST IS FILLED TO CAPACITY) bool push(double value); //removes last element in the NumberList, returns //true if successful otherwise returns false (THE NUMBERLIST IS EMPTY) bool pop(); //reads numbers from an input stream. If a file stream is used then//the file structure is as follows: first line contains the number of numbers in //the list remaining lines contains a maximum of 10 numbers each separated by a //whitespace void read(istream & inStream); //inserts a number in an ordinal position and shifts each number to the right of //the ordinal position by one. Returns true if successful, otherwise//if THE NUMBERLIST IS FILLED TO CAPACITY returns false. EXAMPLE: If the list//contains the values < 2, 7, -9, 11 > after the call N.insert(8, 2) is made, the //list will then be < 2, 8, 7, -9, 11 >. If position is greater than the current//length of the list, then the insert will occur at the end. EXAMPLE: If the list//contains the values < 2, 7, -9, 11 > after the call N.insert(8, 13) is made, the //list will then be < 2, 7, -9, 11, 8 >. bool insert(double number, int position);//sorts the numbers in the list using the SELECTION SORT algorithm. //Type is either ‘A’,’a’ for ascending, or ‘D’,’d’ for descending void sort(char type); /********OVERLOADED OPERATORS**********///determines if two number lists are identical//identical implies the same numbers in the same positions bool operator==(const NumberList& list); //assign one NumberList to another NumberList NumberList& operator=(const NumberList& rhs);//add a number to the end of a NumberList using the compound addition operator NumberList& operator=(const double& number); //add two Numberlists using the compound addition operator NumberList& operator=(const NumberList& rhs); /******************************************************************************/ //FOR 10% EXTRA CREDIT ON THIS PROJECT GRADE, OVERLOAD THE FOLLOWING OPERATORS//AS NON-MEMBER FUNCTIONS //(1) << (insertion) friend ostream& operator<<(ostream&, const NumberList&);//(2) (addition) that adds one element to the end of a list friend const NumberList operator(NumberList& lhs, const double& number);//(3) (addition) that adds two lists (LIST CONCATENATION) friend const NumberList operator(NumberList& lhs, const NumberList& rhs);//HINT: to overload both addition operators as stated above, use the overloaded//functions = that presumably, you have already implemented/******************************************************************************/};#endif /* NUMBERLIST_H_ */************************************************************************************************************************************testNL.cpp************************************************************************************************************************************#include "NumberList.h"#include #include using namespace std;int main(){}
input.txt

Unformatted Attachment Preview

Don't use plagiarized sources. Get Your Custom Essay on
NumberList
Just from $13/Page
Order Essay

6
1 2 3 4 5 6

Purchase answer to see full
attachment

GradeAcers
Calculate your paper price
Pages (550 words)
Approximate price: -

Why Work with Us

Top Quality and Well-Researched Papers

We always make sure that writers follow all your instructions precisely. You can choose your academic level: high school, college/university or professional, and we will assign a writer who has a respective degree.

Professional and Experienced Academic Writers

We have a team of professional writers with experience in academic and business writing. Many are native speakers and able to perform any task for which you need help.

Free Unlimited Revisions

If you think we missed something, send your order for a free revision. You have 10 days to submit the order for review after you have received the final document. You can do this yourself after logging into your personal account or by contacting our support.

Prompt Delivery and 100% Money-Back-Guarantee

All papers are always delivered on time. In case we need more time to master your paper, we may contact you regarding the deadline extension. In case you cannot provide us with more time, a 100% refund is guaranteed.

Original & Confidential

We use several writing tools checks to ensure that all documents you receive are free from plagiarism. Our editors carefully review all quotations in the text. We also promise maximum confidentiality in all of our services.

24/7 Customer Support

Our support agents are available 24 hours a day 7 days a week and committed to providing you with the best customer experience. Get in touch whenever you need any assistance.

Try it now!

Calculate the price of your order

Total price:
$0.00

How it works?

Follow these simple steps to get your paper done

Place your order

Fill in the order form and provide all details of your assignment.

Proceed with the payment

Choose the payment system that suits you most.

Receive the final file

Once your paper is ready, we will email it to you.

Our Services

No need to work on your paper at night. Sleep tight, we will cover your back. We offer all kinds of writing services.

Essays

Essay Writing Service

No matter what kind of academic paper you need and how urgent you need it, you are welcome to choose your academic level and the type of your paper at an affordable price. We take care of all your paper needs and give a 24/7 customer care support system.

Admissions

Admission Essays & Business Writing Help

An admission essay is an essay or other written statement by a candidate, often a potential student enrolling in a college, university, or graduate school. You can be rest assurred that through our service we will write the best admission essay for you.

Reviews

Editing Support

Our academic writers and editors make the necessary changes to your paper so that it is polished. We also format your document by correctly quoting the sources and creating reference lists in the formats APA, Harvard, MLA, Chicago / Turabian.

Reviews

Revision Support

If you think your paper could be improved, you can request a review. In this case, your paper will be checked by the writer or assigned to an editor. You can use this option as many times as you see fit. This is free because we want you to be completely satisfied with the service offered.

Order your essay today and save 15% with the discount code DISCOUNT15