subject

HW3_P1 - Student list using array

Given a Student class, create a class with following characteristics:

The class name should be ClassRoom.

Private variable students array to maintain the list of Student objects.

Function addStudent with input parameter name (string) and rollNo(int) adds a new student in "students" list.

Method getAllStudents should return all the students in ClassRoom.

Input
Jack

1

Jones

2

Marry

3

where,

First & Second line represent a student’s name and roll number. And so on.

Output

1 - Jack

2 - Jones

3 - Marry

Assume that,

Maximum "students" count can be 10.

*Driver Class*

*Solution class*

import java. util.*;

class Student {
private String name;
private int rollNo;

public String getName() {}
public void setName(String name) {}
public int getRollNo() {}
public void setRollNo(int rollNo) {}
};

class ClassRoom {

private int i;
private Student[] students;

public void addStudent(String name, int rollNo) {}
public Student[] getAllStudents() {}
};

ansver
Answers: 1

Another question on Computers and Technology

question
Computers and Technology, 22.06.2019 08:10
Technician a says that if a valve is open when a piston rises to the very top of a cylinder, the piston may actually strike the valve head and cause serious engine damage. technician b says if the camshaft is located in the engine block, then the engine is called an overhead valve engine, ohv engine, or an in-block camshaft. who is right? a. b only b. both a and b c. a only d. neither a nor b
Answers: 3
question
Computers and Technology, 23.06.2019 07:00
You need a quick answer from a coworker. the most effective way to reach your coworker is through a. cloud server b. instant message c. teleconference d. telepresence
Answers: 1
question
Computers and Technology, 24.06.2019 00:00
Visualizing a game of “tag” to remember the meaning of contagious
Answers: 3
question
Computers and Technology, 24.06.2019 03:30
Auniform resource locator (url) is a formatted string of text that web browsers, email applications, and other software programs use to identify a particular resource on the internet. true false
Answers: 2
You know the right answer?
HW3_P1 - Student list using array

Given a Student class, create a class with following c...
Questions
question
Chemistry, 05.11.2020 03:30
question
Mathematics, 05.11.2020 03:30
Questions on the website: 13722366