Question-1 Deque Object.
Answer:- The following answer are in the Image format.
Answer:- The following answer are in the Image format.
Question-2 Kiwi Request and Response
Answer:-
import java.until.ArrayDequr;
public class Request {
ArrayDeque<String> pool;
public Request() {
pool = new ArrayDeque<String>();
}
public void initRequest(String i, String p) {
String ID = i;
String prb = p;
String rqt = "Empliyee ID: " + ID +"\nProblem: " + prb;
pool.add(rqt);
}
public void dispRequest() {
System.out.println
("================================================================");
System.out.println("-----------------------REQUEST POOL-------\n");
if (pool.isEmpty () == true) {
System.out.println ("Currently, there is no request in the pool.");
}
else
{
for (String s : pool) {
System.out.println (s);
System.out.println
("--------------------------------------------");
}
}
}
public void attdRequest () {
String status;
if (pool . isEmpty () == true) {
System.out.println
("=====================================================");
System.out.println ("Currently, there is no request in the pool.");
} else {
System.out.println
("=====================================================");
System.out.println ("You need to resolve yhr following problem:");
System.out.print(pool . getFirst () );
status = "R";
if (status . toUpperCase () . equals ("R") ) {
System.out.println
("======================================================");
System.out.println ("The problem has been resolved:");
System.out.println (pool . getFirst () );
pool . remove ();
} else if (status . toUpperCase () . equals ("P") ) {
System.out.println
("\n=======================================================");
System.out.println ("Please resolve the problem ASAP .");
} else {
status = "N";
}
}
}
public static void main (String [] args) {
Request rq = new Request ();
rq . initRequest ("3423", "System is not working");
rq . initReuest (" 3764", "Internet is not working");
rq . dispRequest ();
rq . attdRequest ();
}
}
Question-3 Add a student Details.
Answer:-
No comments:
Post a Comment