Complete the code to define a computed property that returns the full name.
public class Person { public string FirstName { get; set; } public string LastName { get; set; } public string FullName => [1]; }
The computed property FullName combines FirstName and LastName with a space.
Complete the code to create a computed property that returns the area of a rectangle.
public class Rectangle { public double Width { get; set; } public double Height { get; set; } public double Area => [1]; }
The computed property Area multiplies Width and Height to get the rectangle's area.
Fix the error in the computed property that returns the initials of a person.
public class Person { public string FirstName { get; set; } public string LastName { get; set; } public string Initials => [1]; }
The computed property Initials returns the first letters of FirstName and LastName separated by a space. Using ToString() converts chars to strings for concatenation.
Fill both blanks to create a computed property that returns the perimeter of a rectangle.
public class Rectangle { public double Width { get; set; } public double Height { get; set; } public double Perimeter => 2 * ([1] + [2]); }
The perimeter of a rectangle is 2 times the sum of its width and height.
Fill all three blanks to create a computed property that returns the volume of a box.
public class Box { public double Width { get; set; } public double Height { get; set; } public double Depth { get; set; } public double Volume => [1] * [2] * [3]; }
The volume of a box is the product of its width, height, and depth.