Thanks to visit codestin.com
Credit goes to www.scribd.com

0% found this document useful (0 votes)
26 views1 page

New Text Document

Uploaded by

Rizwan Ahmad
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)
26 views1 page

New Text Document

Uploaded by

Rizwan Ahmad
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/ 1

import java.util.

Arrays;
import java.util.Scanner;

public class Solution{


public static void main(String args[])
{
Scanner sc = new Scanner(System.in);
int[] hockeyPlayers = new int[11];
int[] footballPlayers = new int[11];

for(int i = 0; i < 11; i++)


{
hockeyPlayers[i] = sc.nextInt();
}

for(int i = 0; i < 11; i++)


{
footballPlayers[i] = sc.nextInt();
}

Sport s = new Sport(hockeyPlayers, footballPlayers);


try{
HockeyTeam.class.getMethod("calculateHockeyScore");
HockeyTeam.class.getMethod("findHighestGoalByIndividualInHockey");
FootballTeam.class.getMethod("calculateFootballScore");
FootballTeam.class.getMethod("findHighestGoalByIndividualInFootball");

if(s instanceof HockeyTeam && s instanceof FootballTeam)


{
System.out.println(s.calculateHockeyScore());
System.out.println(s.calculateFootballScore());
System.out.println(s.findHighestGoalByIndividualInHockey());
System.out.println(s.findHighestGoalByIndividualInFootball());
}
}
catch (NoSuchMethodException ex)
{
System.out.println("No such function is exits");
}
}
}

You might also like