ok so I am practicing with a basic carpet calculator , but when I came midway into it I noticed the " (double) " data types , I know its used to shift a value's decimal places two places but in this case it is acting the same way how "double" in the third block of code (double roomLength,) is doing how the identifier's are all grouper under one data type. Is that what " (double) " is doing as well holding all those identifier's above and below it ?
const int SQ_FT_PER_SQ_YARD = 9;
const int INCHES_PER_FOOT = 12;
const string BEST_CARPET = "Berber";
const string ECONOMY_CARPET = "Pile";
int roomLengthFeet = 12 ,
roomLengthInches = 2,
roomWidthFeet = 13,
roomWidthInches = 7;
double roomLength,
roomWidth,
carpetPrice,
numOfSquareFeet,
numOfSquareYards,
totalCost;
roomLength = roomLengthFeet +
(double) roomLengthInches / INCHES_PER_FOOT;
roomWidth = roomWidthFeet +
(double) roomWidthInches /INCHES_PER_FOOT;
numOfSquareFeet = roomLength * roomWidth;
numOfSquareYards = numOfSquareFeet / SQ_FT_PER_SQ_YARD;
carpetPrice = 27.95;
totalCost = numOfSquareYards * carpetPrice;
Console.WriteLine("The cost of " + BEST_CARPET
+ " is {0:C}", totalCost);
Console.WriteLine();
carpetPrice = 15.95;
totalCost = numOfSquareYards * carpetPrice;
Console.WriteLine("The cost of " + ECONOMY_CARPET + " is"
+ "{0:C}", totalCost);
Console.Read();
thanks again !