Computers and Technology
Computers and Technology, 02.03.2020 23:32, ladybugys

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() {}
};

answer
Answers: 1

Other questions on the subject: Computers and Technology

image
Computers and Technology, 23.06.2019 11:30, leapfroggiez
Auser is given read permission to a file stored on an ntfs-formatted volume. the file is then copied to a folder on the same ntfs-formatted volume where the user has been given full control permission for that folder. when the user logs on to the computer holding the file and accesses its new location via a drive letter, what is the user's effective permission to the file? a. read b. full control c. no access d. modify e. none of the above
Answers: 1
image
Computers and Technology, 23.06.2019 18:00, bubbles173883
While inserting images, the picture command is usually used to insert photos from a digital camera, and the clip art command is usually used to a. edit the sizes and other characteristics of photos that have been inserted. b. take a screenshot of an image and copy it to the clipboard for pasting. c. search for drawings or other images from a library of prepared pictures. d. make illustrations using lines and shapes that are easy to manipulate.
Answers: 1
image
Computers and Technology, 24.06.2019 01:30, kevin72836
Hazel has just finished adding pictures to her holiday newsletter. she decides to crop an image. what is cropping an image?
Answers: 1
image
Computers and Technology, 24.06.2019 03:00, 2020IRodriguez385
With editing, word automatically displays a paste options button near the pasted or moved text. a. cut-and-paste b. drag-and-drop c. inline d. copy-and-carry
Answers: 1
Do you know the correct answer?
HW3_P1 - Student list using array

Given a Student class, create a class with following c...

Questions in other subjects: