Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.util.*;
- public class NotebookApp {
- public static void main(String args[]) {
- Scanner in=new Scanner(System.in);
- Notebook notebook= new Notebook();
- boolean done=false;
- String answer;
- while ( ! done) {
- System.out.println("\n1. Add note");
- System.out.println("2. Show all notes");
- System.out.println("3. Show one note");
- System.out.println("4. Remove note");
- System.out.println("0. exit");
- System.out.print("> ");
- answer = in.nextLine();
- if (answer.equals ("1")){
- System.out.println("New Note? ");
- notebook.storeNote(in.nextLine());
- }
- else if (answer.equals ("2")){
- notebook.showNotes();
- }
- else if (answer.equals ("3")){
- System.out.println("New Note? ");
- notebook.showNote(Integer.parseInt(in.nextLine()));
- }
- else if (answer.equals ("4")){
- System.out.println("New Note? ");
- notebook.removeNote(Integer.parseInt(in.nextLine()));
- }
- else if (answer.equals ("0")) done = true;
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement