100%(21)21 out of 21 people found this document helpful
This preview shows page 3 - 6 out of 7 pages.
to 0. addItems method adds the parameter value to numOfItems and returns the updatednumOfItems.Decide an appropriate datatype for each attribute and return type for each method. You will alsoneed to decide the parameter types for all mutator methods.Decide an appropriate public/private modifier for each variable and each method.*
Get answer to your question and much more
CSE 205Spring 20179. Study the class diagram and the code that follows. Then fill in the three blanks given below. [6points]Vehicle[] vehicleList = new Vehicle[3];vehicleList[0] = new Vehicle();vehicleList[1] = new Truck();vehicleList[2] = new Car();for (int i=0; i <= 2; i++)vehicleList[i].move();a) vehicleList[0].move() refers to move() of____Vehicle___classb) vehicleList[1].move() refers to move() of_____Vehicle___classc) vehicleList[2].move() refers to move() of____Car________classSection 3:Output Problems [Total 22 points]10. Study the code segment given below and write the output of this code in the space providedbelow. [10 points]public class Split1{public static void main(String[] args){String line = "/java//programming/";String[] words = line.split("/");System.out.println("\nsize " + words.length);for (int i=0; i<words.length; i++)System.out.println(words[i] + " with length" + words[i].length());}}VehicleCarmove()move()Truck