Question: java netbeans Given the following Point class. public class Student { private String name; private String id; private int yob; public Student(String id, String name,

java netbeans

Given the following Point class.

public class Student { private String name; private String id; private int yob; public Student(String id, String name, int y){ this.name = name; this.id = id; yob=y;} public Student(Student s){this.id =s.id; this.name = s.name; this.yob = s.yob;} public String getID(){ return id;}

public String getName(){ return name;} public int getYob(){ return yob;} public void setName(String name){ this.name = name;} public void setYob(int yob){ this.yob = yob;} public void setID(String id){ this.id = id;}

}

Q1. Define a class Assignment2 in which it has the static method Q1 as follows:

create an array list of integers that contains the odd numbers from 1-39

print the average of the numbers in the list.

Write a method that counts how many number is divisible by 3.

Write a method that returns all the numbers that are divisible by 5.

Call the Q1 method in the main method.

Q2. Define Q2 method inside the same class as follows:

Create an array list of students.

Create an array of students which has the following student objects:

Insert all students of the array in the array list defined in 1.

Insert the arraylist to itself in the middle.

Search for Randa Jaber and print its location(s) in the list.

Create a new copy of the student Randa Jaber and call it rj.

Search for the object rj. What do you notice? How to fix that.

Note: use different way of searching...

Print the student in the list whose id is 321.

Change the id of the last occurrence of Khalida Ahmad to 678.

10. Replace the 3rd element with the student (588, Mohammad faleh, 1978)

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!