c# struct confusion

Nov 20 2006 3:28 PM

hi guys i was using wrox professional c# ebook to learn c#.. and i came across the following code in the ebook


public class Nevermore60Customer : GenericCustomer
   {
      private uint highCostMinutesUsed;
      public override void RecordCall(TypeOfCall callType, uint nMinutes)
      {
         switch (callType)
         {
            case TypeOfCall.CallToLandline:
               balance += (0.02M * nMinutes);
               break;
            case TypeOfCall.CallToCellPhone:
         uint highCostMinutes, lowCostMinutes;
         uint highCostMinutesToGo =
            (highCostMinutesUsed < 60) ? 60 - highCostMinutesUsed : 0;
         if (nMinutes > highCostMinutesToGo)
         {
            highCostMinutes = highCostMinutesToGo;
            lowCostMinutes = nMinutes - highCostMinutes;
         }
         else
         {
            highCostMinutes = nMinutes;
            lowCostMinutes = 0;
         }
         highCostMinutesUsed += highCostMinutes;
         balance += (0.50M * highCostMinutes + 0.20M *
            lowCostMinutes);
         break;
            default:
               break;

 

and i want to knw what is the use of

private uint highCostMinutesUsed;


i mean how do we set the initial value for that n calculation please explain the logic of the use of the above field

(highCostMinutesUsed < 60) ? 60 - highCostMinutesUsed : 0;

what is the use of above code also???


and i found that until the end of code the  highcostminutesused is  0; please let me knw about that and the  code below


x=(highCostMinutesUsed < 60) ? 60 - highCostMinutesUsed : 0;


Answers (6)