I'm writing a C++ Car park program that holds Cars, Vans and Bikes, and I need to be able to give the percentage for each item that is currently in the car park.
To make my question short, if the car park has 5 cars, 4 vans and 2 bikes, what is the formulae for working out the percentage of cars, vans and bikes currently park so I can implement it to my program?
You can work out the percentages by dividing the total number of one type of vehicle by the total number of vehicles in the garage.
$$ P_{car}=\frac{\text{number of cars}}{\text{total number vehicles}}=\frac{5}{11}=0.\overline{45}=45.\overline{45}\% $$ $$ P_{van}=\frac{\text{number of vans}}{\text{total number vehicles}}=\frac{4}{11}=0.\overline{36}=36.\overline{36}\% $$ $$ P_{bike}=\frac{\text{number of bikes}}{\text{total number vehicles}}=\frac{2}{11}=0.\overline{18}=18.\overline{18}\% $$