Advertisement
Guest User

EsercizioGALEAZZI

a guest
Jan 23rd, 2020
131
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 5.61 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 Esercizio_Galeazzi
  8. {
  9. class Biglietto
  10. {
  11. Random x=new Random();
  12. int numero;
  13. List<Mezzo> mezzi = new List<Mezzo>();
  14.  
  15. public Biglietto()
  16. {
  17. numero = x.Next(0, 99);
  18. }
  19.  
  20. public void Auto()
  21. {
  22. mezzi.Add(new Auto("BB399HT",2000, "Civic type R", "Honda", 2500, 1800, 5));
  23. }
  24.  
  25. public void Moto()
  26. {
  27. mezzi.Add(new Moto("BB399HT", 125, "Wr", "Husqvarna", 1800, 1500, 1));
  28. }
  29.  
  30.  
  31. }
  32. }
  33.  
  34.  
  35.  
  36.  
  37. using System;
  38. using System.Collections.Generic;
  39. using System.Linq;
  40. using System.Text;
  41. using System.Threading.Tasks;
  42.  
  43. namespace Esercizio_Galeazzi
  44. {
  45. class Autobus:Mezzo
  46. {
  47. int npostiasedere;
  48. int npiani;
  49.  
  50. public Autobus(string targa, int cilindrata, string modello, string marca, double larghezza, double altezza, int npostiasedere, npiani):base(targa, cilindrata ,modello,marca, larghezza, altezza)
  51. {
  52. this.npostiasedere = npostiasedere;
  53. this.npiani=npiani;
  54. }
  55.  
  56. public override void CalcoloTariffa()
  57. {
  58. base.CalcoloTariffa();
  59. tariffa = (tariffa * 100) + (npiani * 60);
  60. }
  61.  
  62. public override string ToString()
  63. {
  64. return base.ToString() + "\nPosti: " + npostiasedere + "\nPiani: " + npiani;
  65. }
  66. }
  67. }
  68.  
  69.  
  70.  
  71.  
  72.  
  73. using System;
  74. using System.Collections.Generic;
  75. using System.Linq;
  76. using System.Text;
  77. using System.Threading.Tasks;
  78.  
  79. namespace Esercizio_Galeazzi
  80. {
  81. class Furgone:Mezzo
  82. {
  83. int npostianteriori;
  84. double larghezzacassone;
  85. double altezzacassone;
  86. double capacità;
  87.  
  88. public Furgone(string targa, int cilindrata, string modello, string marca, double larghezza, double altezza, int npostianteriori,double larghezzacassone, double altezzacassone, double capacità):base(targa, cilindrata ,modello,marca, larghezza, altezza)
  89. {
  90. this.npostianteriori = npostianteriori;
  91. this.larghezzacassone = larghezzacassone;
  92. this.altezzacassone = altezzacassone;
  93. this.capacità = capacità;
  94. }
  95.  
  96. public override void CalcoloTariffa()
  97. {
  98. base.CalcoloTariffa();
  99. tariffa = (tariffa * 75) + (capacità * 5);
  100. }
  101.  
  102. public override string ToString()
  103. {
  104. return base.ToString() + "\nPosti: " + npostianteriori + "\nLargezza cassone: " + larghezzacassone + "\nAltezza cassone: " + altezzacassone + "\nCapacità: " + capacità;
  105. }
  106. }
  107. }
  108.  
  109.  
  110.  
  111.  
  112.  
  113. using System;
  114. using System.Collections.Generic;
  115. using System.Linq;
  116. using System.Text;
  117. using System.Threading.Tasks;
  118.  
  119. namespace Esercizio_Galeazzi
  120. {
  121. class Moto:Mezzo
  122. {
  123. int nposti;
  124.  
  125. public Moto(string targa, int cilindrata, string modello, string marca, double larghezza, double altezza, int nposti):base(targa, cilindrata ,modello,marca, larghezza, altezza)
  126. {
  127. this.nposti = nposti;
  128. }
  129.  
  130. public override void CalcoloTariffa()
  131. {
  132. base.CalcoloTariffa();
  133. tariffa = tariffa * 25;
  134. }
  135.  
  136. public override string ToString()
  137. {
  138. return base.ToString() + "\nOmologata per: " + nposti;
  139. }
  140. }
  141. }
  142.  
  143.  
  144.  
  145.  
  146.  
  147.  
  148. using System;
  149. using System.Collections.Generic;
  150. using System.Linq;
  151. using System.Text;
  152. using System.Threading.Tasks;
  153.  
  154. namespace Esercizio_Galeazzi
  155. {
  156. class Auto: Mezzo
  157. {
  158. int nporte;
  159.  
  160. public Auto(string targa, int cilindrata, string modello, string marca, double larghezza, double altezza, int nporte):base(targa, cilindrata ,modello,marca, larghezza, altezza)
  161. {
  162. this.nporte = nporte;
  163. }
  164.  
  165. public override void CalcoloTariffa()
  166. {
  167. if (cilindrata <= 2400)
  168. {
  169. base.CalcoloTariffa();
  170. tariffa = tariffa * 50;
  171. }
  172. else
  173. {
  174. base.CalcoloTariffa();
  175. tariffa = tariffa * 80;
  176. }
  177. }
  178.  
  179. public override string ToString()
  180. {
  181. return base.ToString() + "\nNumero porte: " + nporte;
  182. }
  183. }
  184. }
  185.  
  186.  
  187.  
  188.  
  189.  
  190.  
  191.  
  192. using System;
  193. using System.Collections.Generic;
  194. using System.Linq;
  195. using System.Text;
  196. using System.Threading.Tasks;
  197.  
  198. namespace Esercizio_Galeazzi
  199. {
  200. class Mezzo
  201. {
  202. protected string targa;
  203. protected int cilindrata;
  204. protected string marca;
  205. protected string modello;
  206. protected double larghezza;
  207. protected double altezza;
  208. protected double tariffa;
  209.  
  210. public Mezzo(string targa, int cilindrata, string modello, string marca, double larghezza, double altezza)
  211. {
  212. this.targa = targa;
  213. this.cilindrata = cilindrata;
  214. this.modello = modello;
  215. this.marca = marca;
  216. this.larghezza = larghezza;
  217. this.altezza = altezza;
  218. tariffa = 0.0;
  219. }
  220.  
  221. public virtual void CalcoloTariffa()
  222. {
  223. tariffa=cilindrata / 1000;
  224. }
  225.  
  226. public override string ToString()
  227. {
  228. return "\nMarca" + marca + "\nModello: " + modello + "\nTarga: " + targa + "\nCilindrata: " + cilindrata + "\nLarghezza: " + larghezza + "\nAltezza: " + altezza;
  229. }
  230.  
  231.  
  232.  
  233. }
  234. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement