Search the internet about the properties of the for loop in


Question 1 - Use the CreatePublicKeyPair program in the course material to create a key pair. Then use this key pair in the following network application:

• The server is waiting for requests at port 12345.

• The server is multithreaded so that a new thread is created for a new request.

• A client would first generate a random AES private key. Then, he/she will encrypt this key with the public key of the key pair and send it to the server. When the server receives this, it will first decrypt it with the private key. Then, the AES key will be used for encrypting later communication between the client and the server.

• When the client sends in a message, the server would reply according to the following:

o if the message is "How old are you?", the reply would be "About the same as you".
o if the message is "What are you up to now?", the reply would be "I am talking to you".
o if the message is "Bye", the replay would be "See you.". Then, the thread would end.
o if the message is anything else, the reply would be "I do not quite understand."

• The client would have the following GUI entities:

o A textarea for displaying the replies from the server;
o A textinput and a submit button for entering a message to be sent to the client.

• When the client close the client window, the server should take note of this (by catching an exception thrown) and then terminate the corresponding thread.

Write the client and server.

I suggest you to use writeObject in sending anything to and from the server. Note that when you open an ObjectInputStream and ObjectOutputStream on both client and server, please open the ObjectOutputStream first.

Question 2-

(a) Search the internet about the properties of the for loop in Ada, compare the readability, writability and reliability of the for loop in Ada and Java. Explain your answer.

(b) Java 5.0 provides looping on data structures as described in the course materials. State one situation when you do not want to use this feature in looping through a data structure.

Question 3- The longest phrase in the software life cycle is the maintenance phrase. Therefore, the cost of maintenance is a significant portion of the total cost of the software. Which of readability, writability and reliability of a language do you think is most important if you want to reduce the maintenance cost of a software? Explain your answer.

Question 4- The exception handling feature in Java is not available in early programming languages such as C. Do you think this feature can increase the readability, writability or reliability of Java? Explain your answer.

Question 5- Most modern languages allow the use of '_' as connectors in identifiers, e.g. my_type. However, COBOL uses '-' as connectors in identifiers, e.g. my-type. Do you thing that we should use '-' instead of '_' in Java?

Question 6-

(a) Describe the main use of a variant record type.

(b) Why it is not available in Java?

Request for Solution File

Ask an Expert for Answer!!
JAVA Programming: Search the internet about the properties of the for loop in
Reference No:- TGS01377645

Expected delivery within 24 Hours