Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <cstring>
- using namespace std;
- class Direktor{
- private:
- char ime;
- char prezime;
- float plata;
- int brOddeli;
- bool bonus;
- public:
- //default konstruktor - bez argumenti
- Direktor(){
- }
- //konstruktor so argumenti
- Direktor(char ime,char prezime,float plata,int brOddeli,bool bonus){
- ime = new char[strlen(ime)+1];
- strcpy(this->ime,ime);
- prezime=new char[strlen(prezime)+1];
- strcpy(this->prezime,prezime);
- this->plata=plata;
- this->brOddeli=brOddeli;
- this->bonus=bonus;
- }
- /*Direktor(float plata,int brOddeli,bool bonus){
- this->ime="";
- this->prezime="";
- this->plata=plata;
- this->brOddeli=brOddeli;
- this->bonus=bonus;
- }*/
- char get_ime()
- {
- return ime;
- }
- char set_ime(char ime)
- {
- ime = ime;
- }
- char get_prezime()
- {
- return prezime;
- }
- char set_prezime(char prezime)
- {
- prezime = prezime;
- }
- float set_plata(float plata)
- {
- plata = plata;
- }
- float get_plata()
- {
- return plata;
- }
- void set_brOddeli(int brOddeli)
- {
- brOddeli=brOddeli;
- }
- int get_brOddeli()
- {
- return brOddeli;
- }
- void set_bonus(bool bonus)
- {
- bonus = bonus;
- }
- bool get_bonus()
- {
- return bonus;
- }
- //copy konstruktor
- Direktor(const Direktor &d){
- ime = new char[strlen(d.ime)+1];
- strcpy(this->ime,d.ime);
- prezime=new char[strlen(d.prezime)+1];
- strcpy(this->prezime,d.prezime);
- this->plata=d.plata;
- this->brOddeli=d.brOddeli;
- this->bonus=d.bonus;
- }
- int presmetaj(){
- int result = 0;
- result=plata+10*brOddeli;
- if(bonus)==true){
- result+=1000;
- }
- return result;
- }
- void pecati(){
- cout << presmetaj(); << endl;
- }
- };
- int main()
- {
- Direktor d;
- cin>>d.ime>>d.prezime>>d.plata<<d.brOddeli<<d.bonus;
- d.pecati();
- // cout << "Hello world!" << endl;
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement