Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- namespace OOP_1N122L_grafika_lato_2025
- {
- internal class Student
- {
- //pola
- public string imie;
- public string nazwisko;
- private int wiek;
- private double sredniaOcen;
- //metody
- public void PrzedstawSie()
- {
- Console.WriteLine($"Student: {imie} {nazwisko}, " +
- $"wiek: {wiek}, średnia: {sredniaOcen}.");
- }
- public void ZdajEgzamin(string przedmiot, double ocena)
- {
- Console.WriteLine($"Student zdał egazmin z przedniotu: {przedmiot} na ocenę: {ocena}.");
- }
- public double JakaOcena(int procenty)
- {
- double ocena = 2.0;
- if (procenty < 50 || procenty > 100)
- ocena = 2.0;
- if (procenty >= 50 && procenty < 75)
- ocena = 3.0;
- if (procenty >= 75 && procenty < 80)
- ocena = 3.5;
- if (procenty >= 80 && procenty < 85)
- ocena = 4.0;
- if (procenty >= 85 && procenty < 90)
- ocena = 4.5;
- if (procenty >= 90 && procenty <= 100)
- ocena = 5.0;
- return ocena;
- }
- public void UstawWiek(int _wiek)
- {
- if (_wiek > 17)
- wiek = _wiek;
- else
- wiek = 19;
- }
- public void UstawSredniaOcen(double _srednia)
- {
- if (_srednia >= 3 && _srednia <= 5)
- sredniaOcen = _srednia;
- else
- sredniaOcen = 3;
- }
- public int PokazWiek()
- { return wiek; }
- public double PokazSredniaOcen()
- { return sredniaOcen; }
- }
- }//następnym razem konstruktory i właściwości
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement