Advertisement
Guest User

Untitled

a guest
Jul 19th, 2018
62
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.59 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using System.Threading.Tasks;
  6.  
  7. namespace ConsoleApp4
  8. {
  9. class Program
  10. {
  11. static void Main(string[] args)
  12. {
  13. Program program = new Program();
  14.  
  15. int a = 10;
  16. int b = 10;
  17. int wynik = program.OperacjaMetoda(a, b, Operacja.DODAWANIE);
  18. Console.Write(wynik);
  19.  
  20. bool checkGRAY = false;
  21. bool checkGREY = false;
  22. checkGRAY = program.ColorMetoda(Color.Gray);
  23. checkGREY = program.ColorMetoda(Color.Grey);
  24. Console.WriteLine("checkGray: " + checkGRAY + ", checkGrey: " + checkGREY);
  25.  
  26. Console.ReadLine();
  27. }
  28.  
  29. enum Operacja
  30. {
  31. DODAWANIE,
  32. MNOŻENIE
  33. }
  34.  
  35. enum Color
  36. {
  37. Black,
  38. White,
  39. Gray,
  40. Grey
  41. }
  42.  
  43. bool ColorMetoda(Color c)
  44. {
  45. switch(c)
  46. {
  47. case Color.Gray:
  48. case Color.Grey:
  49. return true;
  50. default:
  51. return false;
  52. }
  53. }
  54.  
  55. int OperacjaMetoda(int a, int b, Operacja o)
  56. {
  57. switch(o)
  58. {
  59. case Operacja.DODAWANIE:
  60. return a + b;
  61.  
  62. case Operacja.MNOŻENIE:
  63. return a * b;
  64.  
  65. default:
  66. return a - b;
  67. }
  68. }
  69. }
  70. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement