Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

C# Programmin Question: Create a new Console Application project (C#, .NET Core) called Question03 (without quotes). Create a new class called Course. This class should

C# Programmin Question:

Create a new Console Application project (C#, .NET Core) called "Question03" (without quotes).

Create a new class called Course. This class should have three properties: CourseID (string), Name (string), and CourseType (an enumerator which options are: Online, Hybrid, and FaceToFace). In the Course class, override the ToString method in a way that meaningful information is displayed for Course objects. In addition, the Course class must have two static methods: SaveToFile, and LoadFromFile.

The first method, SaveToFile, is supposed to save one or more Course objects to a specified text file (i.e. C:\MyCOMP123Folder\Example.txt). This method receives two parameters: The first is a list of Course objects to be saved (Hint: You must use lists, not arrays), and the second is a string that represents the full physical path, including the file name, of the text file to be created). This method "returns" void, and writes each Course object in an individual line in the text file. Each line contains the values of each property, in the following order: CourseID, FullName, Email. Each value should be separated by colons (the ":" character, without quotes).

The second method, LoadFromFile, is supposed to load one or more Course objects from a specified text file (i.e. C:\MyCOMP123Folder\Example.txt), which comes in the same format as specified for method SaveToFile. This method receives one parameter: A string representing the full physical path, including the file name, of the text file to be loaded. This method returns a list of Course objects loaded from the targeted file (Hint: You must use lists, not arrays).

Once you are done, go back to the Main method in your Program.cs file, and write the test harness that fully demonstrates that your code works as per requirements. In other words, you must invoke the SaveToFile method to write a list of Course objects to your hard disk, and then invoke the LoadFromFile method to load the data from the file you have just created. At the end, make sure to include a loop that iterates over the list of Course objects you have just loaded from the file, and display their information in the Console. For full marks, make sure both methods handle possible exception scenarios and, in case of error, provide a clean and meaningful message to the user (Hint: Implement try-catch blocks).

Once you are done, copy the entire content of your source code files and paste them to the answer box of this question. In the last test question you will submit the whole solution with this and all other projects in this test.

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Demystifying Databases A Hands On Guide For Database Management

Authors: Shiva Sukula

1st Edition

8170005345, 978-8170005346

More Books

Students also viewed these Databases questions