Advertisement
Guest User

Untitled

a guest
Feb 18th, 2019
85
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.86 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 ConsoleApp1
  8. {
  9. class AVTO
  10. {
  11. // Поля класса
  12. public string gosnomer, model, color, FIO;
  13.  
  14.  
  15. // Метод, выводящий в консоль контактную информацию
  16. public void writeInConsoleInfo(string gosnomer, string model, string color, string FIO)
  17. {
  18. Console.WriteLine("Госномер: {0}\nМодель: {1}\nЦвет: {2}\nФИО: {3}\n",gosnomer , model, color,FIO);
  19. }
  20.  
  21. }
  22.  
  23. class Program
  24. {
  25. static void Main(string[] args)
  26. {
  27. AVTO myAVTO = new AVTO();
  28. myAVTO.gosnomer = "С224МН";
  29. myAVTO.model = "LADA 2114";
  30. myAVTO.color = "silver";
  31. myAVTO.FIO = "Камалов И.И";
  32. AVTO hisAVTO = new AVTO();
  33. hisAVTO.gosnomer = "Н125УТ";
  34. hisAVTO.model = "LADA 2110";
  35. hisAVTO.color = "black";
  36. hisAVTO.FIO = "Сабитов А.М.";
  37. myAVTO.writeInConsoleInfo(myAVTO.gosnomer,myAVTO.model,myAVTO.color,myAVTO.FIO);
  38. hisAVTO.writeInConsoleInfo(hisAVTO.gosnomer, hisAVTO.model, hisAVTO.color, hisAVTO.FIO);
  39. Console.ReadLine();
  40. }
  41. }
  42. }
  43. namespace Лабораторная_работа__0_2_
  44. {
  45. class Book
  46. {
  47. private string Author;
  48. private string Name;
  49. private string Izdat;
  50. private int KolvoStr;
  51. private int Year;
  52. private static double price = 9;
  53.  
  54. public void Method(string Author, string Name, string Izdat, int KolvoStr, int Year)
  55. {
  56. this.Author = Author;
  57. this.Name = Name;
  58. this.Izdat = Izdat;
  59. this.KolvoStr = KolvoStr;
  60. this.Year = Year;
  61. }
  62.  
  63.  
  64. public static void SetPrice(double price)
  65. {
  66. Book.price = price;
  67. }
  68. public void Writelnb()
  69. {
  70. Console.WriteLine("\nАвтор: {0}\nНазвание: {1}\nГод издания: { 2}\n {3} стр. \nСтоимость аренды: {4} ", Author, Name, Year, KolvoStr, Book.price);
  71. }
  72. public double PriceBook(int s)
  73. {
  74. double cust = s * price;
  75. return cust;
  76. }
  77. class Program
  78. {
  79. static void Main(string[] args)
  80. {
  81. Book b = new Book();
  82. b.Method("A.S. Pushkin", "Kapitanskaya dochka", "Williams", 123, 2012);
  83. Book.SetPrice(12);
  84. b.Writelnb();
  85. Console.WriteLine("\n Итоговая стоимость аренды: {0} p.", b.PriceBook(3));
  86. Console.ReadLine();
  87. }
  88. }
  89. }
  90. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement