Debugging an Object
Debugging an Object
Fundamentals of Debugging
Introduction
So far (in previous lessons), we have learned to debug some values and functions. When it comes to an object, we know that its layout (class, etc) can have fields, properties, and methods. Debuggging can be primarily performed on those members using the same techniques we have already studied.
Practical Learning: Introducing Debugging on an Object
using static System.Console;
WaterBill bill = new WaterBill();
bill.InvoiceNumber = 100001;
bill.IdentifyAccount();
bill.DisplaySummary();
internal enum Classification
{
Other,
Residential,
GeneralBusiness,
WaterIntensiveBusiness,
SocialGovernmentNonProfit,
UnidentifiedOrUnclassified
}
internal class WaterBill
{
internal int InvoiceNumber { get; set; }
internal double CounterReadingStart { get; set; }
internal double CounterReadingEnd { get; set; }
internal Classification Category { get; set; }
internal string? AccountType { get; set; }
internal string GetAccountType()
{
WriteLine("Stellar Water Point");
WriteLine("==================================================================================");
WriteLine("To prepare an invoice, enter the following information");
WriteLine("Types of Accounts");
WriteLine("1. Residential Household");
WriteLine("2. General Business");
WriteLine("3. Social/Government/Non-Profit Organization");
WriteLine("4. Unidentified or Unclassified Type of Organization");
WriteLine("5. Water Intensive Business(Laudromat, Hair Salon, Restaurant, etc");
WriteLine("0. Other");
Write("Enter Type of Account: ");
string acntType = ReadLine()!;
WriteLine("----------------------------------------------------------------------------------");
return acntType;
}
internal int ReadCounterStart()
{
int value = 0;
try
{
Write("Counter Reading Start: ");
value = int.Parse(ReadLine()!);
}
catch (Exception ex) when (ex is FormatException fex)
{
WriteLine("The counter reading start value you entered is not valid.");
WriteLine("The error produced is: " + fex.Message);
}
return value;
}
internal int ReadCounterEnd()
{
int value = 0;
try
{
Write("Counter Reading End: ");
value = int.Parse(ReadLine()!);
}
catch (Exception ex) when (ex is FormatException fex)
{
WriteLine("The counter reading end value you entered is not valid.");
WriteLine("The error produced is: " + fex.Message);
}
return value;
}
internal void IdentifyAccount()
{
string acntType = GetAccountType();
switch (acntType)
{
case "1":
AccountType = "Residential Household";
Category = Classification.Residential;
break;
case "2":
AccountType = "General Business";
Category = Classification.GeneralBusiness;
break;
case "3":
AccountType = "Social/Government/Non-Profit Organization";
Category = Classification.SocialGovernmentNonProfit;
break;
case "4":
AccountType = "Unidentified or Unclassified Type of Organization";
Category = Classification.UnidentifiedOrUnclassified;
break;
case "5":
AccountType = "Water Intensive Business(Laudromat, Hair Salon, Restaurant, etc";
Category = Classification.WaterIntensiveBusiness;
break;
default:
AccountType = "Other";
Category = Classification.Other;
break;
}
CounterReadingStart = ReadCounterStart();
CounterReadingEnd = ReadCounterEnd();
}
internal double Gallons => CounterReadingEnd - CounterReadingStart;
internal double HCFTotal
{
// CCF: Centum Cubic Feet
// HCF: Hundred Cubic Feet
get
{
return Gallons / 748.00;
}
}
internal (double First, double Next, double Last) Therms
{
get
{
double first;
double next;
double last;
switch (Category)
{
case Classification.Residential:
first = Gallons * 41.50 / 10000.00;
next = Gallons * 32.50 / 10000.00;
last = Gallons * 26.00 / 10000.00;
break;
case Classification.GeneralBusiness:
first = Gallons * 45.00 / 10000.00;
next = Gallons * 30.00 / 10000.00;
last = Gallons * 25.00 / 10000.00;
break;
case Classification.SocialGovernmentNonProfit:
first = Gallons * 46.00 / 10000.00;
next = Gallons * 50.00 / 10000.00;
last = Gallons * 4.00 / 10000.00;
break;
case Classification.UnidentifiedOrUnclassified:
first = Gallons * 25.00 / 10000.00;
next = Gallons * 35.00 / 10000.00;
last = Gallons * 40.00 / 10000.00;
break;
case Classification.WaterIntensiveBusiness:
first = Gallons * 50.00 / 10000.00;
next = Gallons * 40.00 / 10000.00;
last = Gallons * 10.00 / 10000.00;
break;
default:
first = Gallons * (48.00 / 10000.00);
next = Gallons * (32.00 / 10000.00);
last = Gallons * (20.00 / 10000.00);
break;
}
return (first, next, last);
}
}
internal double WaterCharges => Therms.First + Therms.Next + Therms.Last;
internal double SewerCharges
{
get
{
double result = Category switch
{
Classification.Residential => WaterCharges * 6.826941 / 100,
Classification.UnidentifiedOrUnclassified => WaterCharges * 10.6247 / 100,
Classification.WaterIntensiveBusiness => WaterCharges * 12.0535 / 100,
Classification.GeneralBusiness => WaterCharges * 8.3136 / 100,
Classification.SocialGovernmentNonProfit => WaterCharges * 4.162522 / 100,
_ => WaterCharges * 9.2065 / 100,
};
return result;
}
}
internal double StormCharges
{
get
{
double result = Category switch
{
Classification.Residential => WaterCharges * 1.184286 / 100,
Classification.UnidentifiedOrUnclassified => WaterCharges * 1.375284 / 100,
Classification.WaterIntensiveBusiness => WaterCharges * 5.606685 / 100,
Classification.GeneralBusiness => WaterCharges * 3.139403 / 100,
Classification.SocialGovernmentNonProfit => WaterCharges * 1.069636 / 100,
_ => WaterCharges * 0.694748 / 100,
};
return result;
}
}
internal double EnvironmentCharges
{
get
{
double result = Category switch
{
Classification.Residential => WaterCharges * .022724,
Classification.UnidentifiedOrUnclassified => WaterCharges * .082477,
Classification.WaterIntensiveBusiness => WaterCharges * .413574,
Classification.GeneralBusiness => WaterCharges * .161369,
Classification.SocialGovernmentNonProfit => WaterCharges * 0.118242,
_ => WaterCharges * 0.221842,
};
return result;
}
}
internal double ServiceCharges
{
get => Category switch
{
Classification.Residential => WaterCharges * .145748,
Classification.UnidentifiedOrUnclassified => WaterCharges * .186692,
Classification.WaterIntensiveBusiness => WaterCharges * .412628,
Classification.GeneralBusiness => WaterCharges * .242627,
Classification.SocialGovernmentNonProfit => WaterCharges * .102246,
_ => WaterCharges * .210248,
};
}
internal double TotalCharges
{
get
{
return WaterCharges + ServiceCharges + StormCharges + EnvironmentCharges + ServiceCharges;
}
}
internal double LocalTaxes
{
get => Category switch
{
Classification.Residential => TotalCharges * .031574,
Classification.UnidentifiedOrUnclassified => TotalCharges * .105737,
Classification.WaterIntensiveBusiness => TotalCharges * .153248,
Classification.GeneralBusiness => TotalCharges * .122517,
Classification.SocialGovernmentNonProfit => TotalCharges * .035026,
_ => TotalCharges * .125148,
};
}
internal double StateTaxes
{
get => Category switch
{
Classification.Residential => TotalCharges * .016724,
Classification.UnidentifiedOrUnclassified => TotalCharges * .067958,
Classification.WaterIntensiveBusiness => TotalCharges * .081622,
Classification.GeneralBusiness => TotalCharges * .042448,
Classification.SocialGovernmentNonProfit => TotalCharges * .008779,
_ => TotalCharges * .013746,
};
}
internal double CalculateAmountDue()
{
return TotalCharges + LocalTaxes + StateTaxes;
}
internal double CalculateLateAmountDue()
{
double amt = TotalCharges + LocalTaxes + StateTaxes;
if (Category == Classification.Residential)
{
return amt + 8.95;
}
else if (Category == Classification.SocialGovernmentNonProfit)
{
return amt + (amt / 4.575);
}
else if (Category == Classification.GeneralBusiness)
{
return amt + (amt / 12.315);
}
else if (Category == Classification.UnidentifiedOrUnclassified)
{
return amt + (amt / 7.425);
}
else if (Category == Classification.WaterIntensiveBusiness)
{
return amt + (amt / 15.225);
}
else
{
return amt + (amt / 6.735);
}
}
internal void DisplaySummary()
{
WriteLine("==================================================================================");
WriteLine("Stellar Water Point - Customer Invoice");
WriteLine("----------------------------------------------------------------------------------");
WriteLine("Water Bill Number: {0}", InvoiceNumber);
WriteLine("Account Type: {0}", AccountType);
WriteLine("==================================================================================");
WriteLine("Meter Reading");
WriteLine("----------------------------------------------------------------------------------");
WriteLine("Counter Reading Start: {0,10}", CounterReadingStart);
WriteLine("Counter Reading End: {0,10}", CounterReadingEnd);
WriteLine("Total Gallons Consumed:{0,10}", Gallons);
WriteLine("HCF Total: {0,10:n}", HCFTotal);
WriteLine("==================================================================================");
WriteLine("Therms Evaluation");
WriteLine("----------------------------------------------------------------------------------");
WriteLine("First Tier: {0,10:n}", Therms.First);
WriteLine("Second Tier: {0,10:n}", Therms.Next);
WriteLine("Last Tier: {0,10:n}", Therms.Last);
WriteLine("==================================================================================");
WriteLine("Bill Values");
WriteLine("----------------------------------------------------------------------------------");
WriteLine("Water Usage Charges: {0,10:n}", WaterCharges);
WriteLine("Sewer Charges: {0,10:n}", SewerCharges);
WriteLine("Storm Charges: {0,10:n}", StormCharges);
WriteLine("Environment Charges: {0,10:n}", EnvironmentCharges);
WriteLine("Service Charges: {0,10:n}", ServiceCharges);
WriteLine("Total Charges: {0,10:n}", TotalCharges);
WriteLine("----------------------------------------------------------------------------------");
WriteLine("Local Taxes: {0,10:n}", LocalTaxes);
WriteLine("State Taxes: {0,10:n}", StateTaxes);
WriteLine("----------------------------------------------------------------------------------");
WriteLine("Amount Due: {0,10:n}", CalculateAmountDue());
WriteLine("Late Amount Due: {0,10:n}", CalculateLateAmountDue());
WriteLine("==================================================================================");
}
}As seen in previous lessons, the primary way to debug an application is to use the Step Into feature. Once you start that, you can use the various tools, namely the windows (Locals, Autos, etc) that assist you while debugging. When it comes to objects, as opposed to variables of primitive types, the windows are equipped to access objects. The members of those objects are also accessed. The values of the properties are displayed. Still, the other techniques we used for variables are available.
Practical Learning: Stepping Into an Object
As we know already, the Step Into feature is a good tool to monitor the behavior of variables inside a function. That feature also allows you to know if a function is behaving as expected. In thsame way, you can use the Step Into operation for a property or a property of a class. In some cases, if you have established that a property is behaving as expected, you may want to skip it from debugging. Instead of executing one line at a time, the debugger allows you to execute a whole property at a time or to execute the lines in some properties while skipping the others. To support this, you use a feature named Step Over.
To step over a property, while debugging:
As its name suggests, the Step Over feature allows you to skip a property if you know it doesn't have any problem. When debugging, you choose what properties to step into and which ones to step over.
Practical Learning: Stepping Over

Stellar Water Point ================================================================================== To prepare an invoice, enter the following information Types of Accounts 1. Residential Household 2. General Business 3. Social/Government/Non-Profit Organization 4. Unidentified or Unclassified Type of Organization 5. Water Intensive Business(Laudromat, Hair Salon, Restaurant, etc 0. Other Enter Type of Account: 1 ---------------------------------------------------------------------------------- Counter Reading Start: 14968 Counter Reading End: 18662 ================================================================================== Stellar Water Point - Customer Invoice ---------------------------------------------------------------------------------- Water Bill Number: 100001 Account Type: Residential Household ================================================================================== Meter Reading ---------------------------------------------------------------------------------- Counter Reading Start: 14968 Counter Reading End: 18662 Total Gallons Consumed: 3694 HCF Total: 4.94 ================================================================================== Therms Evaluation ---------------------------------------------------------------------------------- First Tier: 15.33 Second Tier: 12.01 Last Tier: 9.60 ================================================================================== Bill Values ---------------------------------------------------------------------------------- Water Usage Charges: 36.94 Sewer Charges: 2.52 Storm Charges: 0.44 Environment Charges: 0.84 Service Charges: 5.38 Total Charges: 48.98 ---------------------------------------------------------------------------------- Local Taxes: 1.55 State Taxes: 0.82 ---------------------------------------------------------------------------------- Amount Due: 51.35 Late Amount Due: 60.30 ================================================================================== Press any key to close this window . . .
namespace StellarWaterPoint11.Models
{
internal record WaterMeter
{
internal string MeterNumber { get; set; } = string.Empty;
internal string Make { get; set; } = string.Empty;
internal string Model { get; set; } = string.Empty;
internal string MeterSize { get; set; } = string.Empty;
public override string ToString()
{
return "Mtr #: " + MeterNumber + " - " +
Make + " " + Model +
"(Meter Size: " + MeterSize + ")";
}
}
}namespace StellarWaterPoint11.Models
{
internal enum Classification
{
Other,
Residential,
GeneralBusiness,
WaterIntensiveBusiness,
SocialGovernmentNonProfit,
UnidentifiedOrUnclassified
}
}namespace StellarWaterPoint11.Models
{
internal record class Customer
{
internal WaterMeter Meter { get; set; }
internal string AccountNumber { get; set; } = string.Empty;
internal string AccountName { get; set; } = string.Empty;
internal string AccountType { get; set; } = string.Empty;
internal string Address { get; set; } = string.Empty;
internal string City { get; set; } = string.Empty;
internal string County { get; set; } = string.Empty;
internal string State { get; set; } = string.Empty;
internal string ZIPCode { get; set; } = string.Empty;
internal Classification Category { get; set; }
internal Customer()
{
Meter = new WaterMeter();
}
public override string ToString()
{
return "Account Number: " + AccountNumber + Environment.NewLine +
"Account Name: " + AccountName + Environment.NewLine +
"Account Type: " + AccountType + Environment.NewLine +
"Address: " + Address + Environment.NewLine +
"City: " + City + Environment.NewLine +
"County: " + County + Environment.NewLine +
"State: " + State + Environment.NewLine +
"ZIP Code: " + ZIPCode;
}
}
}
namespace StellarWaterPoint11.Models
{
internal record class WaterBill
{
internal int InvoiceNumber { get; set; }
internal Customer? Client { get; set; }
internal double CounterReadingStart { get; set; }
internal double CounterReadingEnd { get; set; }
internal int ReadCounterStart()
{
int value = 0;
try
{
Console.Write("Counter Reading Start: ");
value = int.Parse(Console.ReadLine()!);
}
catch (Exception ex) when (ex is FormatException fex)
{
Console.WriteLine("The counter reading start value you entered is not valid.");
Console.WriteLine("The error produced is: " + fex.Message);
}
return value;
}
internal int ReadCounterEnd()
{
int value = 0;
try
{
Console.Write("Counter Reading End: ");
value = int.Parse(Console.ReadLine()!);
}
catch (Exception ex) when (ex is FormatException fex)
{
Console.WriteLine("The counter reading end value you entered is not valid.");
Console.WriteLine("The error produced is: " + fex.Message);
}
return value;
}
internal void IdentifyAccount()
{
CounterReadingStart = ReadCounterStart();
CounterReadingEnd = ReadCounterEnd();
}
internal double Gallons => CounterReadingEnd - CounterReadingStart;
internal double HCFTotal
{
get
{
return Gallons / 748.05;
}
}
internal (double First, double Next, double Last) Therms
{
get
{
double first;
double next;
double last;
switch (Client!.Category)
{
case Classification.Residential:
first = Gallons * 41.50 / 10000.00;
next = Gallons * 32.50 / 10000.00;
last = Gallons * 26.00 / 10000.00;
break;
case Classification.GeneralBusiness:
first = Gallons * 45.00 / 10000.00;
next = Gallons * 30.00 / 10000.00;
last = Gallons * 25.00 / 10000.00;
break;
case Classification.SocialGovernmentNonProfit:
first = Gallons * 46.00 / 10000.00;
next = Gallons * 50.00 / 10000.00;
last = Gallons * 4.00 / 10000.00;
break;
case Classification.UnidentifiedOrUnclassified:
first = Gallons * 25.00 / 10000.00;
next = Gallons * 35.00 / 10000.00;
last = Gallons * 40.00 / 10000.00;
break;
case Classification.WaterIntensiveBusiness:
first = Gallons * 50.00 / 10000.00;
next = Gallons * 40.00 / 10000.00;
last = Gallons * 10.00 / 10000.00;
break;
default:
first = Gallons * (48.00 / 10000.00);
next = Gallons * (32.00 / 10000.00);
last = Gallons * (20.00 / 10000.00);
break;
}
return (first, next, last);
}
}
internal double WaterCharges
{
get
{
return Therms.First + Therms.Next + Therms.Last;
}
}
internal double SewerCharges
{
get
{
double result = Client!.Category switch
{
Classification.Residential => WaterCharges * 6.826941 / 100.00,
Classification.UnidentifiedOrUnclassified => WaterCharges * 10.624729 / 100.00,
Classification.WaterIntensiveBusiness => WaterCharges * 12.053502 / 100.00,
Classification.GeneralBusiness => WaterCharges * 8.313635 / 100.00,
Classification.SocialGovernmentNonProfit => WaterCharges * 4.162522 / 100.00,
_ => WaterCharges * 9.206253 / 100.00
};
return result;
}
}
internal double StormCharges
{
get
{
double result = Client!.Category switch
{
Classification.Residential => WaterCharges * 1.184286 / 100.00,
Classification.UnidentifiedOrUnclassified => WaterCharges * 1.375284 / 100.00,
Classification.WaterIntensiveBusiness => WaterCharges * 5.606685 / 100.00,
Classification.GeneralBusiness => WaterCharges * 3.139403 / 100.00,
Classification.SocialGovernmentNonProfit => WaterCharges * 1.069636 / 100.00,
_ => WaterCharges * .694748 / 100.00,
};
return result;
}
}
internal double EnvironmentCharges
{
get
{
double result = Client!.Category switch
{
Classification.Residential => WaterCharges * .022724,
Classification.UnidentifiedOrUnclassified => WaterCharges * .082477,
Classification.WaterIntensiveBusiness => WaterCharges * .413574,
Classification.GeneralBusiness => WaterCharges * .161369,
Classification.SocialGovernmentNonProfit => WaterCharges * .118242,
_ => WaterCharges * .221842
};
return result;
}
}
internal double ServiceCharges
{
get => Client!.Category switch
{
Classification.Residential => WaterCharges * .145748,
Classification.UnidentifiedOrUnclassified => WaterCharges * .186692,
Classification.WaterIntensiveBusiness => WaterCharges * .412628,
Classification.GeneralBusiness => WaterCharges * .242627,
Classification.SocialGovernmentNonProfit => WaterCharges * .102246,
_ => WaterCharges * .210248
};
}
internal double TotalCharges
{
get
{
return WaterCharges + ServiceCharges + StormCharges + EnvironmentCharges + ServiceCharges;
}
}
internal double LocalTaxes
{
get => Client!.Category switch
{
Classification.Residential => TotalCharges * .031574,
Classification.UnidentifiedOrUnclassified => TotalCharges * .105737,
Classification.WaterIntensiveBusiness => TotalCharges * .153248,
Classification.GeneralBusiness => TotalCharges * .122517,
Classification.SocialGovernmentNonProfit => TotalCharges * .035026,
_ => TotalCharges * .125148
};
}
internal double StateTaxes
{
get => Client!.Category switch
{
Classification.Residential => TotalCharges * .016724,
Classification.UnidentifiedOrUnclassified => TotalCharges * .067958,
Classification.WaterIntensiveBusiness => TotalCharges * .081622,
Classification.GeneralBusiness => TotalCharges * .042448,
Classification.SocialGovernmentNonProfit => TotalCharges * .008779,
_ => TotalCharges * .013746
};
}
internal double CalculateAmountDue()
{
return TotalCharges + LocalTaxes + StateTaxes;
}
internal double CalculateLateAmountDue()
{
double amt = TotalCharges + LocalTaxes + StateTaxes;
if (Client!.Category == Classification.Residential)
{
return amt + 8.95;
}
else if (Client.Category == Classification.SocialGovernmentNonProfit)
{
return amt + (amt / 4.575);
}
else if (Client.Category == Classification.GeneralBusiness)
{
return amt + (amt / 12.315);
}
else if (Client.Category == Classification.UnidentifiedOrUnclassified)
{
return amt + (amt / 7.425);
}
else if (Client.Category == Classification.WaterIntensiveBusiness)
{
return amt + (amt / 15.225);
}
else
{
return amt + (amt / 6.735);
}
}
internal void DisplaySummary()
{
Console.WriteLine("==================================================================================");
Console.WriteLine("Stellar Water Point - Water Bill Invoice");
Console.WriteLine("----------------------------------------------------------------------------------");
Console.WriteLine("Water Bill Number: {0}", InvoiceNumber);
Console.WriteLine("==================================================================================");
Console.WriteLine("Customer Account Information");
Console.WriteLine("----------------------------------------------------------------------------------");
Console.WriteLine(Client);
Console.WriteLine("----------------------------------------------------------------------------------");
Console.WriteLine("Meter Information: {0}", Client!.Meter);
Console.WriteLine("==================================================================================");
Console.WriteLine("Water Bill Details");
Console.WriteLine("==================================================================================");
Console.WriteLine("Meter Reading");
Console.WriteLine("----------------------------------------------------------------------------------");
Console.WriteLine("Counter Reading Start: {0,10}", CounterReadingStart);
Console.WriteLine("Counter Reading End: {0,10}", CounterReadingEnd);
Console.WriteLine("Total Gallons Consumed: {0,10}", Gallons);
Console.WriteLine("HCF Total: {0,10:n}", HCFTotal);
Console.WriteLine("==================================================================================");
Console.WriteLine("Therms Evaluation");
Console.WriteLine("----------------------------------------------------------------------------------");
Console.WriteLine("First Tier: {0,10:n}", Therms.First);
Console.WriteLine("Second Tier: {0,10:n}", Therms.Next);
Console.WriteLine("Last Tier: {0,10:n}", Therms.Last);
Console.WriteLine("==================================================================================");
Console.WriteLine("Bill Values");
Console.WriteLine("----------------------------------------------------------------------------------");
Console.WriteLine("Water Usage Charges: {0,10:n}", WaterCharges);
Console.WriteLine("Sewer Charges: {0,10:n}", SewerCharges);
Console.WriteLine("Storm Charges: {0,10:n}", StormCharges);
Console.WriteLine("Environment Charges: {0,10:n}", EnvironmentCharges);
Console.WriteLine("Service Charges: {0,10:n}", ServiceCharges);
Console.WriteLine("Total Charges: {0,10:n}", TotalCharges);
Console.WriteLine("----------------------------------------------------------------------------------");
Console.WriteLine("Local Taxes: {0,10:n}", LocalTaxes);
Console.WriteLine("State Taxes: {0,10:n}", StateTaxes);
Console.WriteLine("----------------------------------------------------------------------------------");
Console.WriteLine("Amount Due: {0,10:n}", CalculateAmountDue());
Console.WriteLine("Late Amount Due: {0,10:n}", CalculateLateAmountDue());
Console.WriteLine("==================================================================================");
}
}
}using static System.Console;
using StellarWaterPoint11.Models;
WriteLine("Stellar Water Point");
WriteLine("=================================================================================");
WriteLine("To prepare an invoice, enter the following information");
WaterMeter GetWaterMeter()
{
var waterMeter = new WaterMeter();
WriteLine("Enter the information about the water meter");
Write("Meter Number: ");
waterMeter.MeterNumber = ReadLine()!;
Write("Manufacturer: ");
waterMeter.Make = ReadLine()!;
Write("Model: ");
waterMeter.Model = ReadLine()!;
Write("Meter Size: ");
waterMeter.MeterSize = ReadLine()!;
return waterMeter;
}
Customer Identity()
{
Customer client = new();
WriteLine("=================================================================================");
WriteLine("Enter the information about the customer");
WriteLine("---------------------------------------------------------------------------------");
Write("Account Number: ");
client.AccountNumber = ReadLine()!;
Write("Account Name: ");
client.AccountName = ReadLine()!;
WriteLine("---------------------------------------------------------------------------------");
WriteLine("Types of Accounts");
WriteLine("1. Residential Household");
WriteLine("2. General Business");
WriteLine("3. Social/Government/Non-Profit Organization");
WriteLine("4. Unidentified or Unclassified Type of Organization");
WriteLine("5. Water Intensive Business(Laudromat, Hair Salon, Restaurant, etc");
WriteLine("0. Other");
Write("Enter Type of Account: ");
string acntType = ReadLine()!;
switch (acntType)
{
case "1":
client.AccountType = "Residential Household";
client.Category = Classification.Residential;
break;
case "2":
client.AccountType = "General Business";
client.Category = Classification.GeneralBusiness;
break;
case "3":
client.AccountType = "Social/Government/Non-Profit Organization";
client.Category = Classification.SocialGovernmentNonProfit;
break;
case "4":
client.AccountType = "Unidentified or Unclassified Type of Organization";
client.Category = Classification.UnidentifiedOrUnclassified;
break;
case "5":
client.AccountType = "Water Intensive Business(Laudromat, Hair Salon, Restaurant, etc";
client.Category = Classification.WaterIntensiveBusiness;
break;
default:
client.AccountType = "Other";
client.Category = Classification.Other;
break;
}
WriteLine("---------------------------------------------------------------------------------");
Write("Address: ");
client.Address = ReadLine()!;
Write("City: ");
client.City = ReadLine()!;
Write("County: ");
client.County = ReadLine()!;
Write("State: ");
client.State = ReadLine()!;
Write("ZIP Code: ");
client.ZIPCode = ReadLine()!;
return client;
}
WaterBill waterBill = new WaterBill();
waterBill.InvoiceNumber = 100002;
WaterMeter waterMeter = GetWaterMeter();
Customer customer = Identity();
customer.Meter = waterMeter;
waterBill.Client = customer;
WriteLine("=================================================================================");
WriteLine("Water Bill Preparation");
WriteLine("Enter the water reading information");
waterBill.IdentifyAccount();
Clear();
waterBill.DisplaySummary();Debugging Objects
Introduction
Just as we learned to debug one object, you can debug an application that contains many classes that lead to various objects. The techniques we used for debugging one object are the same to be applied to many objects. When it comes to objects, you can create their classes in a single file; but in most cases, the classes are created in many files, sometimes each class in its own file. When you debug such an application, the debugger will know how to access each class and its content (methods and properties).
Practical Learning: Examining Local Variables
|
|
|||
| Previous | Copyright © 2010-2026, FunctionX | Wednesday 15 October 2025, 22:32 | Next |
|
|
|||