#include<iostream>
using namespace std;
#include<string>
#define INT_MAX 100000
#define INT_MIN 0
using namespace std;


class Automobile
{
public:
    Automobile();
    void read();

    bool is_cheaper_than(??????) const;
    bool better_mileage_than(???????) const;
    bool better_finanace_than(??????) const;

    void print() const;
private:
    string name;
    float price;
    float mileage;
    float finance;


};

Automobile::Automobile()
{
name=" ";
price=INT_MIN;
mileage=INT_MAX;

}

void Automobile::read()
{

cout<<"Model name:";
cin>>name;
cout<<"price";
cin>>price;
cout<<"miles per gallon:";
cin>>mileage;
cout<<"percent financing:";
cin>>finance;

}

bool Automobile::is_cheaper_than(?????) const
{
???????????

}
bool Automobile::better_mileage_than(?????) const

{

????????
}

bool Automobile::better_finance_than(?????) const
{
???????

}

void Automobile::print() const
{
cout<<"Model:" << name<<"\n"
    <<"price:" << price<<"\n"
    <<"Miles Per Gallon:" << finance<<"\n"
    <<"Financing:"<<"\n";
}




int main()

{
    Automobile best_in_price;
    Automobile best_in_mileage;Automobile best_in_fiance;   
    bool done = false;

while(!done)

    Automobile next;
next.read();

???????????????

    string answer;
cout<<"More Y/N";
cin>>answer;

if((answer) != "Y")
    done=true;
}


cout<<"\n\nnBest price:\n";
best_in_price.print();
cout<<"\n\nnBest mileage:\n";
best_in_mileage.print();
cout<<"\n\nnBest finanace:\n";
best_in_fiance.print();



}

Recommended Answers

All 7 Replies

i understand this program except im a little comfused about the bool

i need to finish this program

INT_MIN

poor code

i understand this program except im a little comfused about the bool

i need to finish this program

include<iostream>
using namespace std;
#include<string>
#define INT_MAX 100000
#define INT_MIN 0
using namespace std;


class Automobile
{
public:
    Automobile();
    void read();

    bool is_cheaper_than(??????) const;
    bool better_mileage_than(???????) const;
    bool better_finanace_than(??????) const;

    void print() const;
private:
    string name;
    float price;
    float mileage;
    float finance;


};

Automobile::Automobile()
{
name=" ";
price=INT_MAX;
mileage=INT_MIN;
finance=INT_MAX;

}

void Automobile::read()
{

cout<<"Model name:";
cin>>name;
cout<<"price";
cin>>price;
cout<<"miles per gallon:";
cin>>mileage;
cout<<"percent financing:";
cin>>finance;

}

bool Automobile::is_cheaper_than(?????) const
{
???????????

}
bool Automobile::better_mileage_than(?????) const

{

????????
}

bool Automobile::better_finance_than(?????) const
{
???????

}

void Automobile::print() const
{
cout<<"Model:" << name<<"\n"
    <<"price:" << price<<"\n"
    <<"Miles Per Gallon:" << finance<<"\n"
    <<"Financing:"<<"\n";
}




int main()

{
    Automobile best_in_price;
    Automobile best_in_mileage;Automobile best_in_fiance;   
    bool done = false;

while(!done)
{

    Automobile next;
next.read();

???????????????

    string answer;
cout<<"More Y/N";
cin>>answer;

if((answer) != "Y")
    done=true;
}


cout<<"\n\nnBest price:\n";
best_in_price.print();
cout<<"\n\nnBest mileage:\n";
best_in_mileage.print();
cout<<"\n\nnBest finanace:\n";
best_in_fiance.print();



}

i fixed the code i think i had to type it from a paper

Can you post your source code to see how this program works. since i am new to c++ i like to know.

If you still need help with this, please actually ask a question about it. I was left with a sense of .. huh? And attempted to find a question in the lines of code.

Also, repost the snippet of code that you are having the problem with and what problem you are having with it.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.