Question: Question 1: Create a class Student with following attributes: ID Name Phone Number (String) Email Create getter and setter for all the attributes. Create a

Question 1:

  • Create a class Student with following attributes:

  • ID

  • Name

  • Phone Number (String)

  • Email

  • Create getter and setter for all the attributes. Create a constructor to initialize all their values and a toString() method that returns the details of the Student.

  • Create 10 objects of Student class with following values: (make sure to keep the same order as below)

ID

Name

Phone Number

Email

5

Adrin

+19874639110

adrin@abc.com

6

April

+77873093939

april@abc.com

2

Ben

+17837362222

ben@abc.com

10

Elie

+27383627222

elie@abc.com

9

Gen

+617839382291

gen@abc.com

4

Hilary

+17837484722

hilary@abc.com

3

Isha

+9773784748472

isha@abc.com

8

Jack

+18738492722

jack@abc.com

7

Kevin

+19847462627

kevin@abc.com

1

Manish

+17837364728

manish@abc.com

  • Add all the above ten Students to an array list.

  • Create a method sort() that takes one parameter : an arraylist of Students and sort the arraylist in ascending order based on the ID of the Student. (NOTE: YOU HAVE TO USE INSERTION SORT ALGORITHM)

  • Print the arraylist that youve just sorted.

Question 2

  • Create an array of String with following values in it:

    • Ball

    • Dog

    • Cat

    • Apple

    • America

    • Bull

    • Cotton

  • Sort the array alphabetically using selection sort and print the contents of the array.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!