Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- namespace Esercizio_Galeazzi
- {
- class Biglietto
- {
- Random x=new Random();
- int numero;
- List<Mezzo> mezzi = new List<Mezzo>();
- public Biglietto()
- {
- numero = x.Next(0, 99);
- }
- public void Auto()
- {
- mezzi.Add(new Auto("BB399HT",2000, "Civic type R", "Honda", 2500, 1800, 5));
- }
- public void Moto()
- {
- mezzi.Add(new Moto("BB399HT", 125, "Wr", "Husqvarna", 1800, 1500, 1));
- }
- }
- }
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- namespace Esercizio_Galeazzi
- {
- class Autobus:Mezzo
- {
- int npostiasedere;
- int npiani;
- public Autobus(string targa, int cilindrata, string modello, string marca, double larghezza, double altezza, int npostiasedere, npiani):base(targa, cilindrata ,modello,marca, larghezza, altezza)
- {
- this.npostiasedere = npostiasedere;
- this.npiani=npiani;
- }
- public override void CalcoloTariffa()
- {
- base.CalcoloTariffa();
- tariffa = (tariffa * 100) + (npiani * 60);
- }
- public override string ToString()
- {
- return base.ToString() + "\nPosti: " + npostiasedere + "\nPiani: " + npiani;
- }
- }
- }
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- namespace Esercizio_Galeazzi
- {
- class Furgone:Mezzo
- {
- int npostianteriori;
- double larghezzacassone;
- double altezzacassone;
- double capacità;
- 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)
- {
- this.npostianteriori = npostianteriori;
- this.larghezzacassone = larghezzacassone;
- this.altezzacassone = altezzacassone;
- this.capacità = capacità;
- }
- public override void CalcoloTariffa()
- {
- base.CalcoloTariffa();
- tariffa = (tariffa * 75) + (capacità * 5);
- }
- public override string ToString()
- {
- return base.ToString() + "\nPosti: " + npostianteriori + "\nLargezza cassone: " + larghezzacassone + "\nAltezza cassone: " + altezzacassone + "\nCapacità: " + capacità;
- }
- }
- }
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- namespace Esercizio_Galeazzi
- {
- class Moto:Mezzo
- {
- int nposti;
- public Moto(string targa, int cilindrata, string modello, string marca, double larghezza, double altezza, int nposti):base(targa, cilindrata ,modello,marca, larghezza, altezza)
- {
- this.nposti = nposti;
- }
- public override void CalcoloTariffa()
- {
- base.CalcoloTariffa();
- tariffa = tariffa * 25;
- }
- public override string ToString()
- {
- return base.ToString() + "\nOmologata per: " + nposti;
- }
- }
- }
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- namespace Esercizio_Galeazzi
- {
- class Auto: Mezzo
- {
- int nporte;
- public Auto(string targa, int cilindrata, string modello, string marca, double larghezza, double altezza, int nporte):base(targa, cilindrata ,modello,marca, larghezza, altezza)
- {
- this.nporte = nporte;
- }
- public override void CalcoloTariffa()
- {
- if (cilindrata <= 2400)
- {
- base.CalcoloTariffa();
- tariffa = tariffa * 50;
- }
- else
- {
- base.CalcoloTariffa();
- tariffa = tariffa * 80;
- }
- }
- public override string ToString()
- {
- return base.ToString() + "\nNumero porte: " + nporte;
- }
- }
- }
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- namespace Esercizio_Galeazzi
- {
- class Mezzo
- {
- protected string targa;
- protected int cilindrata;
- protected string marca;
- protected string modello;
- protected double larghezza;
- protected double altezza;
- protected double tariffa;
- public Mezzo(string targa, int cilindrata, string modello, string marca, double larghezza, double altezza)
- {
- this.targa = targa;
- this.cilindrata = cilindrata;
- this.modello = modello;
- this.marca = marca;
- this.larghezza = larghezza;
- this.altezza = altezza;
- tariffa = 0.0;
- }
- public virtual void CalcoloTariffa()
- {
- tariffa=cilindrata / 1000;
- }
- public override string ToString()
- {
- return "\nMarca" + marca + "\nModello: " + modello + "\nTarga: " + targa + "\nCilindrata: " + cilindrata + "\nLarghezza: " + larghezza + "\nAltezza: " + altezza;
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement