From 2ab307929f9b64d5ddf891fa5ef9f0d823c5c063 Mon Sep 17 00:00:00 2001 From: owleyeview Date: Tue, 25 Oct 2022 20:32:33 -0700 Subject: [PATCH] header comments and formatting --- .idea/workspace.xml | 25 +++++++++++++++++-------- src/PhoneBookMain.java | 31 ++++++++++++++++++++++--------- src/PhoneBookManager.java | 11 +++++++++-- src/PhoneBookNode.java | 15 +++++++++++---- 4 files changed, 59 insertions(+), 23 deletions(-) diff --git a/.idea/workspace.xml b/.idea/workspace.xml index 1ac2b06..c0904e7 100644 --- a/.idea/workspace.xml +++ b/.idea/workspace.xml @@ -2,7 +2,9 @@ - + + + - { + "keyToString": { + "RunOnceActivity.OpenProjectViewOnStart": "true", + "RunOnceActivity.ShowReadmeOnStart": "true", + "settings.editor.selected.configurable": "preferences.lookFeel" } -}]]> +} diff --git a/src/PhoneBookMain.java b/src/PhoneBookMain.java index 77b69e3..625c827 100644 --- a/src/PhoneBookMain.java +++ b/src/PhoneBookMain.java @@ -1,9 +1,15 @@ - - +/* +Rashaan, Derek, Cece and Nathan +10/25/2022 +CS 145 +Phone Book Assignment +PhoneBookMain.java + */ + +// A program for creating, viewing and manipulating a phone book linked list import java.util.*; public class PhoneBookMain { - public static void main(String[] args) { Scanner s = new Scanner(System.in); PhoneBookManager javaPages = new PhoneBookManager(); @@ -40,7 +46,8 @@ public static void main(String[] args) { done = true; break; default: // valid input commands not found - System.out.println("Invalid command. Select from the commands above."); + System.out.println("Invalid command. " + + "Select from the commands above."); break; } } while (!done); // end of do while loop @@ -59,8 +66,10 @@ public static void displayIntroMessage() { // displays the user menu public static void displayMenu() { System.out.println(); - System.out.print("(A)dd a new entry \n(M)odify an existing entry \n(D)isplay complete phone book list " + - "\n(B)ellingham phone book list \n(S)eattle phone book list \n(Q)uit \n"); + System.out.print("(A)dd a new entry \n(M)odify an existing entry " + + "\n(D)isplay complete phone book list " + + "\n(B)ellingham phone book list \n(S)eattle phone book list " + + "\n(Q)uit \n"); System.out.println(); System.out.print("Enter a command from the list above: "); } @@ -82,7 +91,8 @@ public static void addEntry(Scanner s, PhoneBookManager javaPages) { System.out.print("Enter an EMAIL ADDRESS: "); String emailAddress = s.nextLine(); System.out.println("--Entry created--"); - PhoneBookNode newEntry = new PhoneBookNode(firstName, lastName, address, city, phoneNumber, emailAddress); + PhoneBookNode newEntry = new PhoneBookNode(firstName, lastName, + address, city, phoneNumber, emailAddress); javaPages.append(newEntry); } @@ -129,7 +139,8 @@ public static void modifyEntry(Scanner s, PhoneBookManager javaPages) { current = current.next; } // user menu for modifications - System.out.println("(F)irst name, (L)ast name, (A)ddress, (C)ity, (P)hone number, (E)mail address"); + System.out.println("(F)irst name, (L)ast name, (A)ddress, " + + "(C)ity, (P)hone number, (E)mail address"); System.out.println("Select a field to modify: "); command = s.nextLine().toLowerCase(); // accept an input command @@ -166,7 +177,8 @@ public static void modifyEntry(Scanner s, PhoneBookManager javaPages) { current.setEmailAddress(emailAddress); break; default: // valid input commands not found - System.out.println("Invalid command. Select from the commands above."); + System.out.println("Invalid command. " + + "Select from the commands above."); break; } done = true; @@ -180,6 +192,7 @@ public static void modifyEntry(Scanner s, PhoneBookManager javaPages) { public static void displayList(PhoneBookManager javaPages) { javaPages.printList(); } + // search the phone book list and print the entries with Bellingham in the city field public static void displayBellingham(PhoneBookManager javaPages) { System.out.println(); diff --git a/src/PhoneBookManager.java b/src/PhoneBookManager.java index f93e31f..f804678 100644 --- a/src/PhoneBookManager.java +++ b/src/PhoneBookManager.java @@ -1,5 +1,12 @@ - - +/* +Rashaan, Derek, Cece and Nathan +10/25/2022 +CS 145 +Phone Book Assignment +PhoneBookManager.java + */ + +// A class for creating and managing a linked list of phone book nodes public class PhoneBookManager { PhoneBookNode head; diff --git a/src/PhoneBookNode.java b/src/PhoneBookNode.java index 3a03e44..349a2db 100644 --- a/src/PhoneBookNode.java +++ b/src/PhoneBookNode.java @@ -1,5 +1,12 @@ - - +/* +Rashaan, Derek, Cece and Nathan +10/25/2022 +CS 145 +Phone Book Assignment +PhoneBookNode.java + */ + +// A class for creating node objects for a phone book linked list public class PhoneBookNode { // Object fields @@ -103,7 +110,7 @@ public void setNext(PhoneBookNode next) { } public String toString() { - return this.firstName + " " + this.lastName + " | " + this.address + " " + this.city + " | " + - this.phoneNumber + " | " + this.emailAddress; + return this.firstName + " " + this.lastName + " | " + this.address + + " " + this.city + " | " + this.phoneNumber + " | " + this.emailAddress; } }