0% found this document useful (0 votes)
6 views3 pages

IPA17

The document outlines the creation of a Student class with private attributes and necessary methods, including getters, setters, and a parameterized constructor. It also describes a Solution class with a main method that implements a static method to find students by grade and month, returning an array of matching Student objects sorted by roll number. If no students match the criteria, it outputs 'No student found'.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
6 views3 pages

IPA17

The document outlines the creation of a Student class with private attributes and necessary methods, including getters, setters, and a parameterized constructor. It also describes a Solution class with a main method that implements a static method to find students by grade and month, returning an array of matching Student objects sorted by roll number. If no students match the criteria, it outputs 'No student found'.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
You are on page 1/ 3

Create a class Student with below attributes:

rollNo - int
name - String
subject - String
grade - char
date - String [DD/MM/YYYY]

The above attributes should be private.Write Getter and Setter and parametrized
constructor as required.

Create class Solution with main method.


****************************************************************************
Implement one static method: findStudentByGradeAndMonth Solution Class.

findStudentByGradeAndMonth Method:

This method will take an array of Student objects, char value as grade and int
value as month
for input parameters.The method will find out all Students from the given grade and
month.
This method will return array of Student object assending based on their rollNo if
found.
If there is no Student that matches then the method should return null.

for this method- main method should print Student name, subject and total student
found [The
length of the list], if the returned value is not null. If the returned value is
null then
main method should print "No student found".

NOTE:
1. For Taking char as input use sc.nextLine().charAt(0)
2. To match/check the month You havee to convert int month in the parameter
to String.
3. No need to count the Student array if return not null just print the array
length.

****************************************************************************

Consider the below input and output:

input1:

111
Arijit
Math
B
22/09/2023
101
Priyanka
English
A
30/03/2022
107
Shreosi
History
C
13/05/2022
105
Tatan
Physics
A
27/03/2022
A
3

output1:

Priyanka
English
Tatan
Physics
2

input2:

111
Sohel
Math
B
22/09/2022
101
Priyanka
English
A
30/03/2022
107
Gopa
History
C
12/05/2022
105
Kamal
Physics
A
27/03/2022
A
7

output 2:
No student found

You might also like