In this part you will write classes using interfaces. Write a class that impleme
ID: 3844030 • Letter: I
Question
In this part you will write classes using interfaces. Write a class that implements following interfaces public interface IntA{public void printTable(double [][] table); public int sumOfIntegerTableCint [][]a);} public interface IntB {public int smallestNumber(int a, int b, int c);} In this part you will write classes extending following abstract class. abstract class Bilgi{public void helloTurkey(){System.out.println("Hello Turkey");} abstract boolean isEven(int n);} Write a Test class and test all of the classes that implemented in Part I and Part II.Explanation / Answer
Hi, I have implemented both Part 1 and Part 2.
Please repost Part 3.
interface IntA {
public void printTable(double[][] table);
public int sumOfIntegerTable(int[][] a);
}
interface IntB {
public int smallestNumber(int a, int b, int c);
}
public class IntAImp implements IntA, IntB {
@Override
public void printTable(double[][] table) {
for(int i=0; i<table.length; i++){
for(int j=0; j<table[i].length; j++)
System.out.println(table[i][j]+" ");
System.out.println();
}
}
@Override
public int sumOfIntegerTable(int[][] a) {
int sum = 0;
for(int i=0; i<a.length; i++){
for(int j=0; j<a[i].length; j++)
sum += a[i][j];
}
return sum;
}
@Override
public int smallestNumber(int a, int b, int c) {
int min = a;
if(min > b)
min = b;
if(min > c)
min = c;
return min;
}
}
///Part II
abstract class Bilgi {
public void helloTurkey() {
System.out.println("Hello Turkey");
}
abstract boolean isEven(int n);
}
class BilgiExtend extends Bilgi {
@Override
boolean isEven(int n) {
if(n%2 == 0)
return true;
return false;
}
}
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.