SHARE
TWEET

Untitled

a guest Oct 22nd, 2019 83 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using System.Threading.Tasks;
  6.  
  7. namespace ConsoleApplication11
  8. {
  9.     class Exam
  10.     {
  11.         public string Name;
  12.         public int rating;
  13.         public int Rating
  14.         {
  15.             get
  16.             {
  17.                 if (rating < 5)
  18.                     return 2;
  19.                 else
  20.                     return (rating + 1) / 2;
  21.             }
  22.             set
  23.             {
  24.                 if (value < 0)
  25.                     rating = 0;
  26.                 else if (value > 10)
  27.                     rating = 10;
  28.                 else
  29.                     rating = value;
  30.             }
  31.         }
  32.         public Exam(string name)
  33.         {
  34.             name = name;
  35.         }
  36.     }
  37.     class Program
  38.     {
  39.         static void Main()
  40.         {
  41.             Exam examen = new Exam("Петров");
  42.             Console.Write("Студент - {0}: введите оценку за экзамен:");
  43.             examen.Rating = Convert.ToInt32(Console.ReadLine());
  44.             Console.WriteLine("В зачетку: {0}", examen.Rating);
  45.             Console.ReadKey();
  46.         }
  47.     }
  48. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Not a member of Pastebin yet?
Sign Up, it unlocks many cool features!
 
Top