week 17 - ArrayList Storing Object.docx - Week 17–...

  • No School
  • AA 1
  • 3

This preview shows page 1 - 3 out of 3 pages.

Week 17– Arraylist Section: Arraylist Question 1: Create a class Student which has three attributes name, phone and group. Create a class which contains a main method. The class should contain an arraylist that stores students. The values are provide below. Name Group Phone number Ayush L1N1 9876543210 Rahul L1M1 9876543211 Gaurav L1N2 9876543212 i. Display all the values in the list using for each loop ii. Change the group of Rahul from “L1M1” to “L1N2” iii. Remove “Gaurav” from the list. iv. Add a new Student “Aavaya, L1C1, 9876543213” before Ayush. v. Change name of “Ayush” to “Aayush”. vi. Replace Aavaya info with Gaurave info. vii. Display the list using for loop.
Image of page 1

Subscribe to view the full document.

Sample code for Bus class : public class Bus { private String numberPlate ; private String color ; private String route ; private String customerName ; privateboolean availableStatus ; privateint rate ; public String getNumberPlate() { return numberPlate ; } public void setNumberPlate(String numberPlate) { this . numberPlate = numberPlate; } public String getColor() { return color ; }
Image of page 2
Image of page 3
  • Fall '19

What students are saying

  • Left Quote Icon

    As a current student on this bumpy collegiate pathway, I stumbled upon Course Hero, where I can find study resources for nearly all my courses, get online help from tutors 24/7, and even share my old projects, papers, and lecture notes with other students.

    Student Picture

    Kiran Temple University Fox School of Business ‘17, Course Hero Intern

  • Left Quote Icon

    I cannot even describe how much Course Hero helped me this summer. It’s truly become something I can always rely on and help me. In the end, I was not only able to survive summer classes, but I was able to thrive thanks to Course Hero.

    Student Picture

    Dana University of Pennsylvania ‘17, Course Hero Intern

  • Left Quote Icon

    The ability to access any university’s resources through Course Hero proved invaluable in my case. I was behind on Tulane coursework and actually used UCLA’s materials to help me move forward and get everything together on time.

    Student Picture

    Jill Tulane University ‘16, Course Hero Intern

Ask Expert Tutors You can ask You can ask ( soon) You can ask (will expire )
Answers in as fast as 15 minutes