Advertisement
desislava_topuzakova

Book.cs

Jul 3rd, 2022
924
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.88 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5.  
  6. namespace Program
  7. {
  8.     public class Book
  9.     {
  10.         private string title;
  11.         private double rating;
  12.  
  13.         public Book(string title, double rating)
  14.         {
  15.             Title = title;
  16.             Rating = rating;
  17.         }
  18.  
  19.         public string Title
  20.         {
  21.             get
  22.             {
  23.                 return title;
  24.             }
  25.  
  26.             set
  27.             {
  28.                 title = value;
  29.             }
  30.         }
  31.  
  32.         public double Rating
  33.         {
  34.             get
  35.             {
  36.                 return rating;
  37.             }
  38.  
  39.             set
  40.             {
  41.                 rating = value;
  42.             }
  43.         }
  44.  
  45.         public override string ToString()
  46.         {
  47.             return $"Book {Title} is with {Rating} rating.";
  48.         }
  49.     }
  50. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement