Advertisement
Guest User

Untitled

a guest
Mar 1st, 2015
205
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.39 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5.  
  6. namespace ConsoleApplication8
  7. {
  8. class Program
  9. {
  10. static void Main(string[] args)
  11. {
  12. Console.WriteLine(Scitani1.Secti(20, 30));
  13. Console.ReadLine();
  14. }
  15. }
  16. class Scitani1
  17. {
  18. public static int Secti(int a, int b, int c)
  19. {
  20. return a + b;
  21. }
  22. public static int secti(int a, int b, int c)
  23. {
  24. return a + b + c ;
  25. }
  26. }
  27. //vytvořte třídu pocetznaku
  28. //vytvořte metodu třídy pocet
  29. //metoda vrátí pocet zbnaků v parametru, který obsahuje text
  30. //Přetěžte metodu aby vrátila počet znaků v parametru, který obsahuje desetinné číslo
  31.  
  32. class PocetZnaku
  33. {
  34. public static int Pocet (string a)
  35. {
  36. return a.Length;
  37. }
  38.  
  39. public static int Pocet(double a)
  40. {
  41. return Convert.ToString (a).Length;
  42. }
  43. }
  44. //Zadání ve Wordu
  45. class hodnoty
  46. {
  47. double a = 0;
  48. double b = 0;
  49. double c = 0;
  50.  
  51. public void Nacteni (double a)
  52. {
  53. if( a >0) //IF zajistí aby se načetlo pouze kladné číslo
  54. this.a = a;
  55. else
  56. }
  57. }
  58. public soucet()
  59. {
  60. return a + b + c;
  61. }
  62. public double Prumer()
  63. {
  64. if (b ==0)
  65. return a;
  66. else if (c==0)
  67. return ( a + b)/2;
  68. else
  69. return (a + b + c) /3;
  70. }
  71.  
  72. //Vtvořte třídu MatematOperace
  73. //Vytvořte metodu pruměr, která vráti průměr ze dvou čísel
  74. //Vytvořte přetíženou metoru průměr, která vrátí průměrnou délku ze 3 textů.
  75. //Vytvořte objekt a použíjte vytvořené metody
  76.  
  77. class MatmatOperace
  78. {
  79. public double pruměr (double a, double b)
  80. {
  81. return (a + b) / 2;
  82. }
  83. public double pruměr (double a, double b)
  84. {
  85. return a;
  86. }
  87. public double pruměr (double a, double b, double c)
  88. {
  89. return (a + b + c) / 3;
  90. }
  91. public double pruměr (string a, string b, string c)
  92. {
  93. return (a.Length + b.Length + c.Length) / 3;
  94. }
  95. }
  96. MatematOpeace operace = new matematOperace();
  97. console
  98. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement