53 lines
1.3 KiB
C#
53 lines
1.3 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
using System.Diagnostics.Tracing;
|
|
using System.Linq;
|
|
using System.Text;
|
|
using System.Threading.Tasks;
|
|
|
|
namespace SzimulaciOOP
|
|
{
|
|
internal class auto
|
|
{
|
|
|
|
public string nev;
|
|
public double soforpenze;
|
|
public double fogyasztas;
|
|
public double benzin;
|
|
public double benzinKapacitas;
|
|
public double megteendoUt;
|
|
public double hianyzoBenzin;
|
|
|
|
|
|
public Double Range(Double minValue, Double maxValue)
|
|
{
|
|
Random random = new Random();
|
|
var x = random.NextDouble();
|
|
|
|
return x * maxValue + (1 - x) * minValue;
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/*
|
|
soforpenze,autofogyasztasa,benzin,benzintankméret(30-200),adotthosszusaguut
|
|
*/
|
|
public auto(string nev,double benzinKapacitas, double megteendoUt)
|
|
{
|
|
Random random = new Random();
|
|
|
|
this.nev = nev;
|
|
this.benzinKapacitas = benzinKapacitas;
|
|
this.megteendoUt = megteendoUt;
|
|
soforpenze = random.Next(10000,300000);
|
|
fogyasztas = random.Next(4,40);
|
|
benzin = Range(0, benzinKapacitas);
|
|
|
|
hianyzoBenzin = ((megteendoUt / 100) * fogyasztas)- benzin;
|
|
|
|
}
|
|
}
|
|
}
|