how i make list in a new class on c++

guys I need help in this exercise mainly after the letter d) in the creation of another class, here is the first class I did in a header file

Statement of the exercise:

1- Make a program for registration and consultation of new or used vehicles.
a) Define an Automovel class, which has the following information:
- brand - marca
- year - ano
- status (which can be sold or available)
- color - cor
- price - preco
- model - modelo
- state - estado


b) Define a constructor method for the Automovel class that initializes the values ​​of the attributes by passing defined arguments.
c) Define the get and set methods for all attributes and methods.
d) Elaborate another class (UsaAutomovel) to test the Automovel class where:
- A list of automobiles must be created by creating objects of the Automovel class.
- Define a method for filling in data about a car and add it to the list.
e) Make a method to search for vehicles by brand lookBrand - lists the car of a certain brand.
f) make a method that allows the sale of a vehicle.
g) Define in the main class (UsaAutomovel) the following options: List cars and total sales.

2- Create two classes that inherit the characteristics of the automobile class.


#ifndef AUTOMOVEL_H
#define AUTOMOVEL_H


class Automovel
{
int ano;
string marca, modelo, cor, estado, status;
float preco;

public:
Automovel(void){
}
//consulta
Automovel(string marca, int ano, string status, string cor, float preco, string modelo, string estado){
this->marca = marca;
this->ano = ano;
this->status = status;
this->cor = cor;
this->preco = preco;
this->modelo = modelo;
this->estado = estado;
}
string getMarca(void){
return this->marca;
}
int getAno(void){
return this->ano;
}
string getStatus(void){
return this->status;
}
string getCor(void){
return this->cor;
}
float getPreco(void){
return this->preco;
}
string getModelo(void){
return this->modelo;
}
string getEstado(void){
return this->estado;
}
void setMarca(string marca){
this->marca = marca;
}
void setAno(int ano){
this->ano = ano;
}
void setStatus(string status){
this->status = status;
}
void setCor(string cor){
this->cor = cor;
}
void setPreco(float preco){
this->preco;
}
void setModelo(string modelo){
this->modelo;
}
void setEstado(string estado){
this->estado;
}
void toString(){
cout << "Marca: " << this->getMarca() <<" Ano: " << this->getAno() << " Status: " << this->getStatus()<< " Cor: " << this->getCor()<< " Preco: " << this->getPreco() << " Modelo: " << this->getModelo() << " Estado: " << this->getEstado();
}
};
class UsaAutomovel
{

};
#endif // AUTOMOVEL_H





@BrennoPedroso,
PLEASE USE CODE TAGS (the <> formatting button to the right), when posting code.

Along with the proper indenting, it makes it easier to read your code, and thus also easier to respond to your post.

Tutorials on how to use code tags:

http://www.cplusplus.com/articles/jEywvCM9/
http://www.cplusplus.com/articles/z13hAqkS/

I found the second link to be the most help.

Hint: You can hit "edit post", highlight your code and then press the <> formatting button. This will not automatically indent your code. That part is up to you.

I've found it's easiest to copy and paste pre-indented code directly from the IDE, that way it is already properly formatted.

You can use the "preview" button at the bottom to see how it looks.

Thanks!
max
Topic archived. No new replies allowed.