OldBeliver

Classes_ver02

Apr 7th, 2021 (edited)
60
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.34 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using System.Threading.Tasks;
  6.  
  7. namespace EmergencyRoom_02
  8. {
  9.     class Program
  10.     {
  11.         static void Main(string[] args)
  12.         {
  13.             Driver driver = new Driver("Петров");            
  14.  
  15.             Console.WriteLine($"Журнал медицинского осмотра водителей.\n");
  16.             driver.ShowVitalSigns();
  17.  
  18.             Console.ReadKey();
  19.         }
  20.     }
  21.  
  22.     class Driver
  23.     {
  24.         private string _surname;
  25.         private int _systolicPressure;
  26.         private int _diastolicPressure;
  27.         private float _bodyTemperature;
  28.         private int _alcohol;
  29.  
  30.         public Driver(string surname)
  31.         {
  32.             _surname = surname;
  33.             _systolicPressure = 120;
  34.             _diastolicPressure = 80;
  35.             _bodyTemperature = 36.6f;
  36.             _alcohol = 0;
  37.         }
  38.  
  39.         public void ShowVitalSigns()
  40.         {
  41.             Console.WriteLine($"Водитель {_surname}\n" +
  42.                 $"Артериальное давление {_systolicPressure}/{_diastolicPressure} мм.рт.ст,\n" +
  43.                 $"Температура тела {_bodyTemperature},\n" +
  44.                 $"Алкоголь в крови {_alcohol} промилле.\n");
  45.         }
  46.     }
  47. }
Add Comment
Please, Sign In to add comment