Question: I am having issues with this code: using static System.Console; class CarpetTest { private int Length; private int Width; public static int MOTTO { get;
I am having issues with this code:
using static System.Console; class CarpetTest { private int Length; private int Width;
public static int MOTTO { get; private set; } public int Area { get; private set; }
static void Main() { Carpet aRug = new Carpet(); aRug.Width = 12; aRug.Length = 14; Write("The {0} x {1} carpet", aRug.Width, aRug.Length); WriteLine("has an area of {0}", aRug.Area); WriteLine("Our motto is: {0}", Carpet.MOTTO);
} }
internal class Carpet { internal static int MOTTO; internal int Area; internal int Length; internal int Width; }
Output is:The 12 x 14 carpethas an area of 0 Our motto is: 0
Should be:
The 12 x 14 carpet has an area of 168
Our motto is: Our carpets are quality-made
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
