#include <iostream>
#include <string>
using namespace std;

class car {
private:
	string  brand;
	int speed = 0;
	int maxSpeed;

public:
	car(string b, int mx) :brand(b), maxSpeed(mx) {};

	void accelerate(int amount);
	
	void brake(int amount);

	int getSpeed() const {
		return speed;
	}
	string getname() const {   //add by me cause i need the brand in final task, or i could build its own fuction that print status
		return brand;
	}
	bool isMoving() const {
		return speed > 0;
	}
	void showStatus() const {
		cout << brand << ": " << speed << "/" << maxSpeed << " km/h\n";     
	}
	~car() {
		cout << brand << " parked\n";
	}
};
void car::accelerate(int amount) {
	if (amount <= 0) return;
	(speed + amount < maxSpeed ? speed += amount : speed = maxSpeed);
}
void car::brake(int amount) {
	if (amount <= 0)return;
	(speed - amount > 0 ? speed -= amount : speed = 0);
}

int main() {
	car a("Toyota", 120), b("BMW", 200);
	a.accelerate(70);
	a.accelerate(70);
	b.accelerate(90);
	b.brake(30);
	b.brake(100);
	a.showStatus();
	b.showStatus();
	if (a.isMoving())
		cout << a.getname() << " is moving\n";
	else
		cout << a.getname() << " is stopped\n";

	if (b.isMoving())
		cout << b.getname() << " is moving\n";
	else
		cout << b.getname() << " is stopped\n";

	return 0;
}

