Guest User

Untitled

a guest
Feb 19th, 2018
72
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.04 KB | None | 0 0
  1. class Program
  2.     {
  3.         static void Main(string[] args)
  4.         {
  5.             Table bla = new Table(5);
  6.  
  7.             int b = bla.get();
  8.  
  9.             Table liran = new Table(3);
  10.             Table ido = new Table(8);
  11.  
  12.             int c = ido.get() + liran.get();
  13.  
  14.             Console.WriteLine("do you want to change the height of the Table?");
  15.             string answer = Console.ReadLine();
  16.             if (answer == "yes")
  17.             {
  18.                 Console.WriteLine("Enter the height of the table");
  19.                 int height = int.Parse(Console.ReadLine());
  20.                 liran.set(height);
  21.                 Console.WriteLine("the height of your table is now: " + liran.get());
  22.             }
  23.            
  24.         }
  25.     }
  26.     class Table
  27.     {
  28.         private int height;
  29.         public Table(int a)
  30.         {
  31.             height = a;
  32.         }
  33.  
  34.         public int get()
  35.         {
  36.             return height;
  37.         }
  38.  
  39.         public void set(int change)
  40.         {
  41.             height = change;
  42.         }
  43.     }
Add Comment
Please, Sign In to add comment