Create an interface with a method concatenation, JAVA Programming

Assignment Help:

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;
}


Related Discussions:- Create an interface with a method concatenation

How to initialize array in java, How to initialize array in java ? Indi...

How to initialize array in java ? Individual elements of an array are referenced through the array name and through an integer that represents their position in the array. The

Break statement, The break statement is utilized for terminating the curren...

The break statement is utilized for terminating the current While or For loop and after that transferring program control towards statement just after the terminated loop. The foll

Student, short Java application that stores words in an Array or ArrayList....

short Java application that stores words in an Array or ArrayList.

Explain what is multilevel inheritance, Explain what is Multilevel Inherita...

Explain what is Multilevel Inheritance ? The Car-Motorcycle-MotorVehicle instances showed single-level inheritance. There's nothing to stop you from going next. You can describ

Explain the equals() method, Explain the equals() method The equals() m...

Explain the equals() method The equals() method of java.lang.Object acts the similar as the == operator; that is, it tests for object identity rather than object equality. The

Difference between composition and aggregation, Aggregation Comp...

Aggregation Composition Aggregation :  An   association   in  which  one  class refers to collection or a another class. This is a part of  a  who

What is best algorithm, What is best algorithm? Greedy algorithm is the...

What is best algorithm? Greedy algorithm is the best algorithm as it is n algorithm in which always takes the best immediate, or local solution although searching an answer.

Program to calculate the value into hours and minutes, Specifically, you'll...

Specifically, you'll create a program that will hold minutes worked and assign a value. Calculate the value into hours and minutes. Display the result as shown in Figure 2. Reme

What is a proxy, A proxy is an object that is formed after applying advice ...

A proxy is an object that is formed after applying advice to a target object. When you think of client objects the target object and the proxy object are the similar.

Write Your Message!

Captcha
Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd