Create a Java program that simulates a simple Personal Diary Management System. Users can read their previous diary entries and write new entries into a text file. The application must read from and write to text files using only the File and Scanner objects. The starter code is given to you. Most of the requirements have been completed. Fill in what is missing.

Below is the complete Java program for a simple Personal Diary Management System:

```java
import java.io.File;
import java.io.FileWriter;
import java.io.IOException;
import java.util.Scanner;

public class DiaryManagementSystem {
private static final String DIARY_FILE_PATH = "diary.txt";

public static void main(String[] args) {
DiaryManagementSystem dms = new DiaryManagementSystem();
dms.start();
}

private void start() {
Scanner scanner = new Scanner(System.in);
boolean exit = false;
displayMenu();

while (!exit) {
System.out.print("Enter your choice: ");
int choice = scanner.nextInt();
scanner.nextLine(); // Consume newline character

switch (choice) {
case 1:
viewDiaryEntries();
break;
case 2:
addDiaryEntry(scanner);
break;
case 3:
exit = true;
break;
default:
System.out.println("Invalid choice. Please try again.");
}
}

scanner.close();
System.out.println("Exiting Diary Management System.");
}

private void displayMenu() {
System.out.println("Personal Diary Management System");
System.out.println("1. View Diary Entries");
System.out.println("2. Add Diary Entry");
System.out.println("3. Exit");
}

private void viewDiaryEntries() {
File file = new File(DIARY_FILE_PATH);
try (Scanner fileScanner = new Scanner(file)) {
System.out.println("Diary Entries:");
while (fileScanner.hasNextLine()) {
System.out.println(fileScanner.nextLine());
}
} catch (IOException e) {
System.out.println("Error occurred while reading diary entries.");
}
}

private void addDiaryEntry(Scanner scanner) {
System.out.print("Enter your diary entry: ");
String entry = scanner.nextLine();

try (FileWriter fileWriter = new FileWriter(DIARY_FILE_PATH, true)) {
fileWriter.append(entry).append("\n");
System.out.println("Diary entry added successfully.");
} catch (IOException e) {
System.out.println("Error occurred while adding diary entry.");
}
}
}
```

Explanation:
- The `DiaryManagementSystem` class contains the main method and handles user interaction.
- The `DIARY_FILE_PATH` variable specifies the path and filename for the diary text file.
- The `start` method initiates the diary management system and displays the menu.
- The `displayMenu` method prints the available options to the console.
- The `viewDiaryEntries` method reads and displays the diary entries stored in the text file.
- The `addDiaryEntry` method prompts the user to enter a diary entry and appends it to the text file.
- The `try-with-resources` statement is used to automatically close the file after writing.