Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <string>
- using namespace std;
- class Samochod
- {
- private:
- double cena;
- int moc, maksPredkosc;
- public:
- Samochod()
- {
- cena = 0;
- moc = 0;
- maksPredkosc = 0;
- }
- Samochod(double cena, int moc, int maksPredkosc)
- {
- this -> cena = cena;
- this -> moc = moc;
- this -> maksPredkosc = maksPredkosc;
- }
- void getValues()
- {
- cout << "Cena: " << cena << " Moc: " << moc << " Maks. predkosc: " << maksPredkosc << endl;
- }
- };
- class Uczen
- {
- private:
- string imie, nazwisko;
- int klasa, ocenaKoncowa;
- public:
- Uczen(string imie, string nazwisko, int klasa, int ocenaKoncowa) {
- this->imie = imie;
- this->nazwisko = nazwisko;
- this->klasa = klasa;
- this->ocenaKoncowa = ocenaKoncowa;
- }
- void getValues()
- {
- cout << imie << " " << nazwisko << " Klasa: " << klasa << " Ocena koncowa: " << ocenaKoncowa << endl;
- }
- };
- class PPP
- {
- private:
- double a, b, c, wynik;
- public:
- PPP(int a, int b, int c)
- {
- this->a =a;
- this->b=b;
- this->c=c;
- this->wynik = Pp();
- }
- double Pp()
- {
- return 2*a*b+2*a*c+2*b*c;
- }
- void getValues()
- {
- cout<< "Pole powierzchni prostopadloscianu (a:"<<a<<",b:"<< b << ",c:"<<c<<" wynosi: " << wynik << ")" << endl;
- }
- };
- class Rachunek
- {
- private:
- string data;
- double wartoscNetto, wartoscBrutto, podatek;
- public:
- double brutto()
- {
- return wartoscNetto - wartoscNetto*0.23;
- }
- double podatekVat()
- {
- return wartoscNetto*0.23;
- }
- Rachunek(string data, double wartoscNetto)
- {
- this->data = data;
- this->wartoscNetto = wartoscNetto;
- this->wartoscBrutto = brutto();
- this->podatek = podatekVat();
- }
- void getValues()
- {
- cout << "Data:" << data << endl;
- cout << "Wartosc stawki netto:" << wartoscNetto << endl;
- cout << "Wartosc stawki brutto: " << wartoscBrutto << endl;
- cout << "Podatek: " << podatek;
- }
- };
- class MyWater
- {
- private:
- int large, medium, small;
- public:
- double largeCapacity = 2, mediumCapacity = 1, smallCapacity = 0.5;
- void setLarge(int i) { large = i; }
- int getLarge() { return large; }
- void setMedium(int i) { medium = i; }
- int getMedium() { return medium; }
- void setSmall(int i) { small = i; }
- int getSmall() { return small; }
- void addLarge(int i) { large += i; }
- void addMedium(int i) { medium += i; }
- void addSmall(int i) { small += i; }
- double iloscWody()
- {
- return getLarge()*largeCapacity + getMedium()*mediumCapacity+getSmall()*smallCapacity;
- }
- void getValues()
- {
- cout << "Mamy teraz " << iloscWody() << " litrow wody." << endl;
- cout << "Duzych butelek: " << getLarge() << endl;
- cout << "Srednich butelek: " << getMedium() << endl;
- cout << "Malych butelek: " << getSmall() << endl;
- }
- };
- int main()
- {
- Samochod samochod(500,50,50);
- samochod.getValues();
- cout<<endl;
- Uczen uczen("Hakuna", "Matata", 3, 4);
- uczen.getValues();
- cout<<endl;
- PPP ppp(4,5,6);
- ppp.getValues();
- cout<<endl;
- Rachunek rachunek("15.05.2019", 2137);
- rachunek.getValues();
- cout << endl;
- cout << endl;
- MyWater myWater;
- myWater.setLarge(5);
- myWater.setMedium(10);
- myWater.setSmall(13);
- myWater.getValues();
- cout << endl;
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement