Inbox - / if (head == null) { head = new EmailNode();...

Info iconThis preview shows pages 1–2. Sign up to view the full content.

View Full Document Right Arrow Icon
public class Inbox { public static void main(String[] args) { EmailNode head = null; E while (true) { System.out.println("1. Receive e-mail (at beginning)"); System.out.println("2. Receive e-mail (at end)"); System.out.println("3. Delete first email (at top)"); System.out.println("4. Delete last email (at bottom)"); System.out.println("5. Delete email by its position"); System.out.println("6. Find and delete e-mail"); System.out.println("7. Sort by sender"); System.out.println("8. List emails"); System.out.println("9. Read email at a particular position"); S int choice = IO.readInt(); i if (choice == 1) { //input data for email from user
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Background image of page 2
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: / if (head == null) { head = new EmailNode(); head.data = /* data from user */; } else { EmailNode n1 = new EmailNode(); n1.data = /* data from user */; n1.next = head; head = n1; } } else if (choice == 2) { } else if (choice == 3) { } else if (choice == 4) { } else if (choice == 5) { } else if (choice == 6) { } else if (choice == 7) { } else if (choice == 8) { EmailNode ptr = head; while (ptr != null) { System.out.println(ptr.data.getSender()); ptr = ptr.next; } } else if (choice == 9) { } else if (choice == 10) { return; } } } }...
View Full Document

Page1 / 2

Inbox - / if (head == null) { head = new EmailNode();...

This preview shows document pages 1 - 2. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online