Great Deal! Get Instant $10 FREE in Account on First Order + 10% Cashback on Every Order Order Now

Start with this code and fill in the functions ############################################################################################################################## #include #include #include...

1 answer below »
Start with this code and fill in the functions
##############################################################################################################################
#include #include #include #include using namespace std;
class River {
string name;
double kmLength;
public:
River() :
River("", -1) {
}
River(string name, double kmLength) {
this->name = name;
this->kmLength = kmLength;
}
double getKMLength() const {
eturn kmLength;
}
void setKMLength(double kmLength) {
this->kmLength = kmLength;
}
const string& getName() const {
eturn name;
}
void setName(const string &name) {
this->name = name;
}
};
void write(River a
Write[], int size) {
}
void read(River a
Read[], int size) {
}
int main() {
River a
Write[] = { River("Missouri", 2341), River("Mississippi", 2202), River("Yukon", 1979), River("Rio", 1759), River("Colorado", 2330) };
write(a
Write, 5);
River a
Read[5];
ead(a
Read, 5);
cout
left
setw(12)
"Name"
setw(3)
" "
setw(5)
"Length"
endl;
cout
setfill('=')
setw(22)
""
setfill(' ')
endl;
for (int i = 0; i < 5; ++i) {
cout
setw(12)
a
Read[i].getName();
cout
setw(3)
" ";
cout
setw(5)
a
Read[i].getKMLength();
cout
endl;
}
eturn 0;
}
Answered Same Day May 14, 2021

Solution

Aditya answered on May 14 2021
151 Votes
#include #include #include #include using namespace std;
class Rive
{
string name;
double kmLength;
public:
River() :
River("", -1) {
}
River(string name, double kmLength) {
this->name = name;
this->kmLength = kmLength;
}
double getKMLength() const {
eturn kmLength;
}
void setKMLength(double kmLength) {
this->kmLength = kmLength;
}
const string& getName() const {
eturn name;
}
void setName(const string &name) {
this->name =...
SOLUTION.PDF

Answer To This Question Is Available To Download

Related Questions & Answers

More Questions »

Submit New Assignment

Copy and Paste Your Assignment Here