a using java create an interface with a


a)  Using Java, create an interface with a method called concatenation which will be implemented in the class patient in part b.

b)  Using Java, write the class patient with the following:

i)  three private data members: ID, fname and lname.

ii)  A default constructor.  This constructor is used to initialise the data members to null.

iii) Another constructor with the following arguments: ID, fname and lname.  This constructor is used to initialise the data members.

iv) Accessor methods (settors and gettors).

v)  An implementation of the concatenation method.

c)  Write a main class to instantiate the patient class and to output the result of the concatenation.

d)  What will be the output from the following 'switch' statement?

int number = 45;
switch ( number ){
case 35: System.out.print("Hello");
case 45: System.out.print("Good");
case 55: System.out.print("Bye");
default: System.out.print("Hello Good Bye"); }

e)  What will be the value of variable sum after executing the while loop?

int sum = 0, cont = 1;
while (cont <= 10 ) {
sum += cont;
cont +=3;
}

Request for Solution File

Ask an Expert for Answer!!
JAVA Programming: a using java create an interface with a
Reference No:- TGS0361351

Expected delivery within 24 Hours