Advertisement
sowamaciej

Untitled

Jul 3rd, 2018
81
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.45 KB | None | 0 0
  1. using System;
  2.  
  3. namespace calc
  4. {
  5. class Program
  6. {
  7. static void Main(string[] args)
  8. {
  9.  
  10. double PierwszaLiczba;
  11. double DrugaLiczba;
  12.  
  13. Console.WriteLine("Podaj pierwsza liczbe: ");
  14. PierwszaLiczba = Convert.ToDouble(Console.ReadLine());
  15. Console.WriteLine("Podaj druga liczbe: ");
  16. DrugaLiczba = Convert.ToDouble(Console.ReadLine());
  17. kalkulator Kalk = new kalkulator(PierwszaLiczba, DrugaLiczba);
  18. Console.WriteLine("Wynik mnozenia: " + Kalk.Mnozenie());
  19. Console.WriteLine("Wynik dzielenia: " + Kalk.Dzielenie());
  20. Console.ReadLine();
  21.  
  22.  
  23. }
  24.  
  25. }
  26. class kalkulator
  27. {
  28. double PierwszaLiczba;
  29. double DrugaLiczba;
  30.  
  31. public void SetDrugaLiczba(double liczba) //setter
  32. {
  33. DrugaLiczba = liczba;
  34. }
  35. public double GetDrugaLiczba() //getter
  36. {
  37. return DrugaLiczba;
  38. }
  39. public kalkulator(double pierwsza, double druga) //konstruktor
  40. {
  41. PierwszaLiczba = pierwsza;
  42. DrugaLiczba = druga;
  43. }
  44.  
  45. public double Mnozenie()
  46. {
  47. return PierwszaLiczba * DrugaLiczba;
  48.  
  49.  
  50.  
  51. }
  52. public double Dzielenie()
  53. {
  54. return PierwszaLiczba / DrugaLiczba;
  55.  
  56. }
  57.  
  58.  
  59. }
  60.  
  61.  
  62. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement