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 05:00
Modern businesses use different technologies to accomplish work tasks
Answers: 2
question
Computers and Technology, 22.06.2019 19:50
Write a car class having two private member variables called tank and speed. write public methods called pumpgas and gofast. the method pumpgas gets an integer for gas that must be pumped. that value needs to be added to tank (no more than 20 gallons). it must return the amount of gas that is purchased ($4 per gallon). the method gofast should increase the speed by 5 each time it is called.write a constructor for the above class that initialized both variables to zero.write a tostring to display both the tank and speed when the car is printed.modify the car class to implement the interface comparable and an interface called carinter having the public methods in carinter.write the main program to create an array of size 5 of type car. create 5 car objects having each location of the array to refer to one of the cars. test the pumpgas, gofast, equals method on the array items. write an enhanced loop to print all the car values (using a tostring written last time).write a generic method to find the minimum of four items. pass int, double, char, string and car objects to test this method.
Answers: 1
question
Computers and Technology, 23.06.2019 00:10
Write a function so that the main0 code below can be replaced by the simpler code that calls function mphandminutes tomiles0. original main0 int main) l double milesperhour-70.0; double minutestraveled = 100.0; double hourstraveled; double milestraveled; hourstraveled = minutestraveled / 60.0; milestraveled = hourstraveled * milesperhour; cout < "miles" 2 using namespace std; 4 /* your solution goes here/ 6 int maino 1 test passed 7 double milesperhour 70.0 all tests passed 8 double minutestraveled 100.0; 10 cout < < "miles: " < < mphandminutestomiles(milesper-hour, minutestraveled) < < endl; 12 return 0; 13
Answers: 1
question
Computers and Technology, 24.06.2019 12:40
Match the feature to the network architecture. expensive to set up useful for a small organization easy to track files has a central server inexpensive to set up difficult to track files useful for a large organization does not have a central server client- server network peer-to-peer network
Answers: 3
You know the right answer?
HW3_P1 - Student list using array

Given a Student class, create a class with following c...
Questions
question
Arts, 11.06.2020 11:57
question
Business, 11.06.2020 11:57
question
Mathematics, 11.06.2020 11:57
question
Mathematics, 11.06.2020 11:57
question
Social Studies, 11.06.2020 11:57
question
Mathematics, 11.06.2020 11:57
question
Mathematics, 11.06.2020 11:57
question
Chemistry, 11.06.2020 11:57
Questions on the website: 13722362