Skip to main content

TCS IPA previous year coding quistion ( 35 marks ) --- ( in JAVA )

        Problem Statement :-  




Video Link : click here

Create a class Footwear which consists of the below attributes.


  footwearId=int

  footwearName=String

  footwearType=String

  price =int


the above attributes should be private.

write getter and setter and parametrised constructor as required.


create the class footwearProgram with the main method.

implement the 1 static methods.getCountByType in the Solution class.



getCountByType method:

   this method will take two input parameters.

array of the Footwear objects and string parameter footwear type.

this method will return the count of the footwears from array of the

footwear objects for the given type of footwear.

if no footwear with the given footwear type is found in the

array of footwear abjects,then the method should return 0.


for getCountByType method- the main method should print the count of the footwears ,if the returned value

is greater than zero. or it should print "Footwear not available";





consider the sample input and output.

Sample Input 1 : 

100

Sketchers

sneekers

12345

103

Puma

running shoes

10099

102

reebok

Running shoes

5667

101

Reebok

running shoes

5656

99

reebok

floaters

5666

Running shoes



Sample output:

3



Sample input2:


100

Puma

sneekers

12345

101

Puma

sneekers

10099

102

Puma

sneekers

5000

102

Reebok

sneekers

8000

104

Puma

floaters

2000

running shoes



Sample output:

Footwear not available


Thank you !


Comments