Advertisement
Guest User

Untitled

a guest
Feb 23rd, 2017
78
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.64 KB | None | 0 0
  1. namespace ConsoleApplication15
  2. {
  3. class Program
  4. {
  5. static void Main(string[] args)
  6. {
  7. Chem_prvek P1 = new Chem_prvek();
  8. Console.WriteLine("Zadejte prvek: ");
  9. P1.ZNAK = Convert.ToString(Console.ReadLine());
  10. Console.WriteLine("Zadej počet protonů");
  11. P1.P_CISLO = Convert.ToInt32(Console.ReadLine());
  12. Console.WriteLine("Zadej počet nuklidů:");
  13. P1.N_CISLO = Convert.ToInt32(Console.ReadLine());
  14. Console.WriteLine(P1.info());
  15. Console.ReadKey();
  16. }
  17. }
  18. }
  19.  
  20.  
  21.  
  22.  
  23.  
  24.  
  25.  
  26.  
  27.  
  28.  
  29.  
  30.  
  31.  
  32. namespace ConsoleApplication15
  33. {
  34. class Chem_prvek
  35. {
  36. string znak;
  37. int p_cislo;
  38. int n_cislo;
  39. public Chem_prvek()
  40. {
  41.  
  42. }
  43. public string ZNAK
  44. {
  45. get
  46. {
  47. return znak;
  48. }
  49. set
  50. {
  51. znak = value;
  52. }
  53. }
  54. public int P_CISLO
  55. {
  56. get
  57. {
  58. return p_cislo;
  59. }
  60. set
  61. {
  62. p_cislo = value;
  63. }
  64. }
  65. public int N_CISLO
  66. {
  67. get
  68. {
  69. return n_cislo;
  70. }
  71. set
  72. {
  73. n_cislo = value;
  74. }
  75. }
  76. public string info()
  77. {
  78. return string.Format("Zadali jste prvek {0}, který má {1} protonů, {2} neutronů a {3} elektronů",znak,p_cislo,n_cislo-p_cislo,n_cislo-p_cislo);
  79. }
  80.  
  81. }
  82. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement