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 ConsoleApplication11
- {
- class Exam
- {
- public string Name;
- public int rating;
- public int Rating
- {
- get
- {
- if (rating < 5)
- return 2;
- else
- return (rating + 1) / 2;
- }
- set
- {
- if (value < 0)
- rating = 0;
- else if (value > 10)
- rating = 10;
- else
- rating = value;
- }
- }
- public Exam(string name)
- {
- name = name;
- }
- }
- class Program
- {
- static void Main()
- {
- Exam examen = new Exam("Петров");
- Console.Write("Студент - {0}: введите оценку за экзамен:");
- examen.Rating = Convert.ToInt32(Console.ReadLine());
- Console.WriteLine("В зачетку: {0}", examen.Rating);
- Console.ReadKey();
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement