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

Write the hashcode() method of java.lang.object, Write the hashCode() metho...

Write the hashCode() method of java.lang.Object Anytime you override equals() you should also override hashCode(). The hashCode() method should ideally return the similar int f

Map objects to a relational database? , Due to impedance mismatch between r...

Due to impedance mismatch between relational technology and object you need to understand the progress of mapping classes (objects) and their relationships to tables and relationsh

PROBLEM 2, #The objective is to implement a menu-based system for Bank Acco...

#The objective is to implement a menu-based system for Bank Accounts in order to simulate a very simple banking system. Many structures have to be declared to manage bank accounts.

Use the constructor, Can we use the constructor, instead of init(), to init...

Can we use the constructor, instead of init(), to initialize servlet? Ans) Yes. Of course you can use the constructor instead of init(). There's nothing to stop you. But you sho

What is preferred organizational structure for organization, What is the pr...

What is the preferred organizational structure for the organization? Preferred Organizational Structure for organization is hierarchal. Where there is various departments inter

Boardcolourling, write a program to find the minimum no of colors to fill a...

write a program to find the minimum no of colors to fill a board where some of the elements of different color are already placed.

What is java rmi, Remote Method Invocation (RMI) is the process of activati...

Remote Method Invocation (RMI) is the process of activating a method on a remotely running object. RMI offers location transparency in the sense that it gives the feel that a metho

What is the role of the jms provider, The JMS provider handles security of ...

The JMS provider handles security of the messages, data conversion and the client triggering. The JMS provider verifies the level of encryption and the security level of the messag

Why class can''t extend more than one class, Why is an Interface be able to...

Why is an Interface be able to extend more than one Interface but a Class can't extend more than one Class? Basically Java doesn't permit multiple inheritances, so a Class is r

Java applet programming examples, Question: (a) The following is a simp...

Question: (a) The following is a simple example of a Java Class: // File: Welcome.java public class Welcome { public static void main(String args[]) { System.out.printl

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