Facebook
From ori, 2 Months ago, written in Plain Text.
Embed
Download Paste or View Raw
Hits: 193
  1. א.
  2.  String name;
  3. Double speed;
  4. Int mem;
  5. Double price;
  6.  Public Computer
  7. (string name, double speed, int mem, double price)
  8.  Void UpdateMem(int addition)
  9.  Int GetMem()
  10.  
  11.  
  12.  Override string ToString()
  13. ב.
  14. ג. public static void Main(string[]args)
  15. ד.         {
  16. ה.             computer comp = new computer (Meabed Kolshehu, 15, 32, 2000)
  17. ו.             Console.WriteLine("comp = " + comp);
  18. ז.             comp.UpdateMem(96);
  19. ח.             Console.WriteLine("comp = " + comp);
  20. ט.         }
  21. י. using System;
  22. יא.
  23. יב. namespace ConsoleApp3
  24. יג. {
  25. יד.     internal class Program
  26. טו.     {
  27. טז.         public class computer
  28. יז.         {
  29. יח.             String name;
  30. יט.             double speed;
  31. כ.             int mem;
  32. כא.             double price;
  33. כב.
  34. כג.             public computer (string name, double speed, int mem, double price)
  35. כד.             {
  36. כה.                 this.name = name;
  37. כו.                 this.speed = speed;
  38. כז.                 this.mem = mem;
  39. כח.                 this.price = price;
  40. כט.             }
  41. ל.             public void UpdateMem(int addition)
  42. לא.             {
  43. לב.                 this.mem += addition;
  44. לג.             }
  45. לד.             public int GetMem()
  46. לה.             {
  47. לו.                 return this.mem;
  48. לז.             }
  49. לח.             public override string ToString()
  50. לט.             {
  51. מ.                 return "Computer.[Name: " + this.name + ", speed: " + this.speed + ", mem: " + this.mem + ", price: " + this.price+ "]";
  52. מא.             }
  53. מב.
  54. מג.         }
  55. מד.     }
  56. מה. }
  57.  
  58.