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

IPA4

The document outlines the creation of a College class with attributes such as id, name, contact number, address, and pin code, along with their respective getters, setters, and a parameterized constructor. It also describes a Solution class with a main method that implements two static methods: findCollegeWithMaximumPincode, which returns the college with the highest pin code, and searchCollegeByAddress, which finds a college by its address. The document includes examples of input and expected output for both methods.
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)
12 views3 pages

IPA4

The document outlines the creation of a College class with attributes such as id, name, contact number, address, and pin code, along with their respective getters, setters, and a parameterized constructor. It also describes a Solution class with a main method that implements two static methods: findCollegeWithMaximumPincode, which returns the college with the highest pin code, and searchCollegeByAddress, which finds a college by its address. The document includes examples of input and expected output for both methods.
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 College with the below attributes.

id-int

name -String

contactNo-int

address-String

pinCode-int

Write the getters and setters and parametrized constructor in the above

mentioned sequence as required.

Create the class Solution with the main method.

Implement the two static methods:

1.findCollegeWithMaximumPincode

2.searchCollegeByAddress

findCollegeWithMaximumPincode method:

Create the Static method in the Solution Class.

This method will take array of the College objects and return the

College object having maximum pincode if found else return null if not

found.

for this method ,main method will print College object with maximum

pincode if the returned value is not null.if the returned value is null ,

then the main method will print "No college found with mentioned attribute".

searchCollegeByAddress method:

Create the Static method in the Solution Class.

This method will take array of College objects as input and address as

input and return College object having the mentioned address if found
else return null if not found.

for this method main method will print College object details as it is ,

if the returned value is not null.if the returned value is null then ,

main method will print "No college found with mentioned attribute".

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

input 1:

4
109
ACT
2500256
mumbai
695001
107
MCE
2500254
malapuram
612354
113
CTE
2500252
chennai
623145
102
SCT
2500255
AP
523641
AP

OUTPUT1:

id-109

name-ACT

contactNo-2500256

address-mumbai

pincode-695001

id-102

name-SCT

contactNo-2500255
address-AP

pincode-523641

INPUT2:

4
111
MJT
2500251
Calicut
401235
105
MET
2500256
kochi
668745
115
IIT
2500262
banglore
569874
110
ACT
2500263
delhi
687945
delhi

output2:

id-110

name-ACT

contactNo-2500263

address-delhi

pincode-687945

id-110

name-ACT

contactNo-2500263

address-delhi

pincode-687945

You might also like