1.0.1 • Published 3 years ago

polluting-cars v1.0.1

Weekly downloads
-
License
MIT
Repository
github
Last release
3 years ago

Description

In a car check center you want to know the average number of polluting points of the N cars that arrive. Likewise, you want to know the polluting points of the car that polluted the least and the one that polluted the most.

Usage

let Car=require("./Car").Car;
let Verification_Center=require("./Verification_Center").Verification_Center;

let arraycars=[];
arraycars.push(new Car(10));
arraycars.push(new Car(24));
arraycars.push(new Car(13));
arraycars.push(new Car(12));
arraycars.push(new Car(11));
arraycars.push(new Car(8));
arraycars.push(new Car(14));
arraycars.push(new Car(10));
arraycars.push(new Car(14));
arraycars.push(new Car(18));
arraycars.push(new Car(17));
arraycars.push(new Car(13));
arraycars.push(new Car(10));
arraycars.push(new Car(7));
arraycars.push(new Car(9));
arraycars.push(new Car(5));
arraycars.push(new Car(8));
arraycars.push(new Car(9));

let verificationcenter=new Verification_Center(arraycars);
let calc=verificationcenter.avg_polluting_spotss();
if(calc.higher===calc.less)
{
    console.log("The contamination points are equal");
}
else
{
    console.log("The points of greatest contamination is: "+calc.higher);
    console.log("The points of least contamination is: "+calc.less);
}
 console.log("The average number of contamination points is: "+calc.avg);