To 0 additems method adds the parameter value to

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.*
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
Page 4
CSE 205Spring 2017Page 5

Upload your study docs or become a

Course Hero member to access this document

Upload your study docs or become a

Course Hero member to access this document

End of preview. Want to read all 7 pages?

Upload your study docs or become a

Course Hero member to access this document

Term
Spring
Professor
Matasu
Tags
Inheritance, class a, public class

  • Left Quote Icon

    Student Picture

  • Left Quote Icon

    Student Picture

  • Left Quote Icon

    Student Picture