Question: In C# , Create a simple console - based phone book application in C# . This application will allow users to add new contacts and
In C# Create a simple consolebased phone book application in C# This application will allow users to add new contacts and view all saved contacts in a phone book. Contacts will be stored in a text file, and you will use StreamReader and StreamWriter for file operations. This exercise will help you understand basic file IO operations in C# without using arrays or collections.
In your cs file you will write the entire application code. Follow the steps below to implement the required functionalities:
Define Main Structure:
Display a simple menu with options to add a name, view names, or exit the application.
Use a switch statement to handle the user's choice.
Keep the application running in a loop until the user decides to exit using a sentinel of to exit
Add Name Functionality:
Prompt the user for a name to add to the phone book.
Use StreamWriter to append this name to phonebook.txt Save to the same directory as your project. You should be able to use the argument of phonebooktxt
When prompting your user you should have one readline for name and one readline for phone number.
When writing names to the text file format your string using a tab t so it writes name a tab indentation phone number
View Names Functionality:
Read and display all names from phonebook.txt using StreamReader.
Submit the following:
Source Code: The source files containing your application code.
Text File: The phonebook.txt file with entries
Evaluation Criteria
Functionality: The application runs without errors, allowing the user to add names to the phone book and view all names stored in the phone book. Test your application thoroughly to catch and fix any bugs.
Code Quality: The code should be wellorganized, properly formatted, and include comments where necessary for clarity.
File IO: Proper use of StreamReader and StreamWriter for reading from and writing to a text file.
If you want to go the extra mile:
Explore error handling, such as checking if the file exists before trying to read from it
Ensure your application is userfriendly, with clear prompts and messages.
Display a header when viewing names and numbers.
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
