Question One

Question

Explain the concept of encapsulation in Object-Oriented Programming (OOP) and list two benefits of encapsulation

Question Two

Question

Explain the concept of inheritance in OOP and list two benefits of inheritance.

Question Three

Question

Explain virtual methods and abstract methods in OOP, and state the main difference between these two types of methods.

Question Four

Question

Explain the concept of a namespace, and why it is required in Microsoft .NET framework.

Question Five

Question

List and discuss three key responsibilities of the Common Language Runtime (CLR) in the Microsoft .NET Framework.

Question Six

Question

Suppose you are working on an embedded system project for a book publisher, and you are required to write a C# class definition with the name Book which includes the following:

  1. Three private data members, title, author, and price in string, string, and double respectively.
  2. A constructor that accepts a string title_in, another string author_in, and a double price_in as inputs and saves them to the class data members accordingly.
  3. A public method applyDiscount(double a) reduces the price of the book by the given percentage and updates the price of the book. Note that this method should use the data member price for the calculation using the following equation:

Remember to comment your code.