I assume have made a simple math error somewhere given it does what I want, but the numbers for stop 2 and 3 are wrong
var passenger=0;
var passenger1=prompt(“How many passengers get on bus at stop1?”);
if(passenger1>30){console.log(“There are too many passengers on the bus, this many people will have to walk:”+ (passenger1-30));} else{console.log(“The bus isnt full, it shall now proceed to station 2”);}
var passenger2= (passenger+passenger1);
var bus2=prompt(“How many passengers get on bus at stop2?”);
if((passenger2 + bus2)>30){console.log(“There are too many passengers on the bus, this many people have to walk:”+ ((passenger2 + bus2)-30));} else{console.log(“The bus isnt full, it shall now proceed to station 3”);}
var passenger3= (passenger2+bus2);
var bus3=prompt(“How many passengers get on bus at stop3?”);
if((passenger3 + bus3)>30){console.log(“There are too many passengers on the bus, this many people have to walk:”+ ((passenger3 + bus3)-30));} else{console.log(“The bus isnt full, it shall now proceed to station 3”);}
this is the bus question, 24 i think