Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Create a new Console Application project (C#, .NET Core) In your Program.cs file, inside your Question04 namespace and outside the Program class, create a new

Create a new Console Application project (C#, .NET Core)

In your Program.cs file, inside your Question04 namespace and outside the Program class, create a new class called Professor. In this class, you must define at least 6 properties that describe attributes that a professor has. You are free to come up with your own properties, but you must use at least one instance of each of the following data types: string, int, DateTime, boolean. Your first property must be a string ProfessorID, which is initialized (in the constructor) to a value that is guaranteed to be unique. The Professor class must have only one constructor, which is parameterless. In your Professor class, override the ToString method, so that it returns a string that contains meaningful information on the object. In addition, your class should define two static methods: SaveData and LoadData. The first method, SaveData, is intended to serialize a specified Professor object to the hard drive as an XML file (.xml), in a specified location. It takes two parameters: A Professor object to be saved, and a string that defines the full physical path of the directory in which the output XML file will be created (i.e. C:\MyFolder\). The second method, LoadData, is intended to deserialize and return a Professor object from a specified XML file. It should take only one parameter: A string containing the full physical path to the file that will be loaded (i.e. C:\MyFolder\Data.xml). Once you are done, write the test harness in the Main method of your Program class, ensuring your code is fully functional as per requirements. In other words, define a random Professor object in your Main method, serialize it to your hard drive, and then deserialize it, displaying the loaded object in the Console. For full marks, ensure possible exceptions are properly treated in your code, and in case of errors, a clean and meaningful message is displayed to the user (Hint: Implement try-catch blocks).

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

What Is A Database And How Do I Use It

Authors: Matt Anniss

1st Edition

1622750799, 978-1622750795

More Books

Students also viewed these Databases questions

Question

=+free to pirate employees from competitors?

Answered: 1 week ago