Swd003-L1 Ibragimova Fariza 6-variant 1-laboratoriya ishi
Download 177.54 Kb.
|
1 laboratoriya
using namespace std; class Fan{ string subject; public: Fan(string subject, int mark){ this->subject = subject; this->mark = mark; } int getMark(){ return mark; } }; class Talaba{ string FIO, fakultet, sessiya; list public:
Talaba(string fio, string facul, string ses, int ku, list FIO = fio; fakultet = facul; sessiya = ses; kurs = ku; fan = f; } virtual void NextTerm(){ if(kurs == 4){ cout << "Diplom himoyasiga tayyorlaning" << endl; return; } list bool passed = true; for(int i = 0; i < fan.size(); i++){ if((*it).getMark() < 3){ passed = false; } it++;
} if(!passed){ cout << "Talaba qayta o'qishga qolgan" << endl; } else{
cout << "Talaba keyingi semestrga o'tgan" << endl; } } virtual int getStipendiya(){ list int ball = 5; for(int i = 0; i < fan.size(); i++){ if((*it).getMark() < ball){ ball = (*it).getMark(); } it++;
} switch(ball){ case 3: return 350000; case 4: return 500000; case 5: return 650000; default: return 0; } }
cout << "Talaba: " << FIO << "\n" << "Fakultet: " << fakultet << "\n" << "Kurs: " << kurs << "\n" << "Stipendiya: " << getStipendiya() << " so'm\n"; } };
string FIO, fakultet, sessiya; int kurs, stipendiya; list bool paid; public: TalabaKontrakt(string fio, string facul, string ses, int ku, list FIO = fio; fakultet = facul; sessiya = ses; kurs = ku; fan = f; paid = p; } void NextTerm() override{ if(!paid){ cout << "Kontrakt to'lanmagan. Keyingi semestrga o'tkazilmadi." << endl; return; } if(kurs == 4){ cout << "Diplom himoyasiga tayyorlaning" << endl; return;
} list bool passed = true; for(int i = 0; i < fan.size(); i++){ if((*it).getMark() < 3){ passed = false; } it++;
} if(!passed){ cout << "Talaba qayta o'qishga qolgan" << endl; } else{
cout << "Talaba keyingi semestrga o'tgan" << endl; } } int getStipendiya() override{ if(!paid){ return 0; } list int ball = 5; for(int i = 0; i < fan.size(); i++){ if((*it).getMark() < ball){ ball = (*it).getMark(); } it++; } switch(ball){ case 3: return 350000; case 4: return 500000; case 5: return 650000; default: return 0; } } string getStatus(){ if(paid){ return "to'langan"; } else{ return "to'lanmagan"; } } void Malumot() override{ cout << "Talaba: " << FIO << "\n" << "Fakultet: " << fakultet << "\n" < "Kurs: " << kurs << "\n" << "Stipendiya: " << getStipendiya() << " so'm" << "\n" "Kontrakt: " << getStatus() << endl; } }; list srand(time(0)); list fanlar.push_back(Fan("Calculus", (rand()%4+2))); fanlar.push_back(Fan("Programming", (rand()%4+2))); fanlar.push_back(Fan("Physics", (rand()%4+2))); fanlar.push_back(Fan("English", (rand()%4+2))); fanlar.push_back(Fan("Academic Writing", (rand()%4+2))); return fanlar; } int main(){ Talaba talaba1 = Talaba("Zokirov Alisher Azamovich","KIF","qishki",2,generateVirtualMarks()); Talaba talaba2 = Talaba("Asqarov Javohir Alimovich","AX","yozgi",3,generateVirtualMarks()); TalabaKontrakt talaba3 = TalabaKontrakt("Zokirov Alisher Azamovich","KIF","qishki",2,generateVirtualMarks(),true); TalabaKontrakt talaba4 = TalabaKontrakt("Asqarov Javohir Alimovich","AX","yozgi",3,generateVirtualMarks(),false); cout << "Talabalar baholari avtomatik qo'yilmoqda\n" << endl; cout << "Birinchi talaba -> \n" << endl; talaba1.NextTerm(); talaba1.Malumot(); cout << "\nIkkinchi talaba -> \n" << endl; talaba2.NextTerm(); talaba2.Malumot(); cout << "\nUchinchi talaba -> \n" << endl; talaba3.NextTerm(); talaba3.Malumot(); cout << "\nTo'rtinchi' talaba -> \n" << endl; talaba4.NextTerm(); talaba4.Malumot(); return 0; } Download 177.54 Kb. Do'stlaringiz bilan baham: |
ma'muriyatiga murojaat qiling