Guest User

Untitled

a guest
Mar 21st, 2018
96
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.02 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 ConsoleApp2
  8. {
  9. class Person
  10. {
  11. public string name;
  12. public string hairColor;
  13. public int shoesSize;
  14. public int height;
  15. public int age;
  16.  
  17. public void PrintDetails()
  18. {
  19. Console.WriteLine("{0} kurio plauku spalva {1} , batu dydis {2}, ugis {3}, amzius {4}", name, hairColor, shoesSize, height, age);
  20. }
  21.  
  22. }
  23.  
  24. class Program
  25. {
  26. static void PrintHumanDetails(Person person)
  27. {
  28. Console.WriteLine("{0} kurio plauku spalva {1} , batu dydis {2}, ugis {3}, amzius {4}", person.name, person.hairColor, person.shoesSize, person.height, person.age);
  29. }
  30.  
  31.  
  32. static void Main(string[] args)
  33. {
  34. // zmogus: vardas, plauku spalva, batu dydis, ugis
  35. Person tomas = new Person();
  36. tomas.name = "Tomas";
  37. tomas.hairColor = "juodi";
  38. tomas.shoesSize = 40;
  39. tomas.height = 185;
  40. tomas.age = 21;
  41.  
  42. Person petras = new Person();
  43. petras.name = "Petras";
  44. petras.hairColor = "blondinas";
  45. petras.shoesSize = 20;
  46. petras.height = 170;
  47. petras.age = 24;
  48.  
  49. tomas.PrintDetails();
  50. PrintHumanDetails(petras);
  51.  
  52. Console.ReadKey();
  53.  
  54. }
  55.  
  56. static string Ask(string question)
  57. {
  58. string variable = "";
  59.  
  60. while (variable == "")
  61. {
  62. Console.Clear();
  63. Console.WriteLine(question);
  64. variable = Console.ReadLine();
  65. }
  66.  
  67. return variable;
  68. }
  69.  
  70. static int AskNumber(string question)
  71. {
  72. int number = 0;
  73. do
  74. {
  75. Console.Clear();
  76. Console.WriteLine(question);
  77.  
  78. } while (!int.TryParse(Console.ReadLine(), out number));
  79.  
  80. return number;
  81. }
  82.  
  83. }
  84. }
Add Comment
Please, Sign In to add comment