Hello java members i want to u if u can to help me how i can canculate something in a particular method i think is simple but im stuck on that ;p
The program is asking to find the average age of passengers in a buss let me explain u some things first about what the class what need to contain and ofcourse i will post my code to check what mistakes may did
Okey Every buss must have a number and an array 60 slots of passengers.The buss class also contain a method witch addPassengers() to a buss and method GetNumberOfPassengers() witch return the number of passengers in a buss.Also the class contains the GetAverageAge() witch canculate the average of their age.How i will canculate their age?Let me inform you that the program also contains more classes like rout,passenger,RouteManager witch contains the main method.If u need any further information reply.Thanks for your time!
public class Buss { private Passenger [] listpassenger = new Passenger[60]; int numpassenger = 0; public void addpassenger(Passenger passenger){ listpassenger[numpassenger]= passenger; numpassenger++; } public int getnumberofpassengers(){ return numpassenger; } public void getaverageage(){ } }