daily pastebin goal
4%
SHARE
TWEET

Carpet Calculator

a guest Oct 9th, 2010 615 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5.  
  6. namespace CarpetCalculator
  7. {
  8.     class Program
  9.     {
  10.         static void Main(string[] args)
  11.         {
  12.             const int SQ_FT_PER_SQ_YARD = 9;
  13.             const int INCHES_PER_FOOT = 12;
  14.             const string BEST_CARPET = "Berber";
  15.             const string ECONOMY_CARPET = "Pile";
  16.  
  17.             int roomLengthFeet = 12,
  18.             roomLengthInches = 2,
  19.             roomWidthFeet = 14,
  20.             roomWidthInches = 7;
  21.  
  22.             double roomLength,
  23.                 roomWidth,
  24.                 carpetPrice,
  25.                 numOfSquareFeet,
  26.                 numOfSquareYards,
  27.                 totalCost;
  28.  
  29.             roomLength = roomLengthFeet +
  30.                 roomLengthInches / INCHES_PER_FOOT;
  31.             roomWidth = roomWidthFeet +
  32.                 roomWidthInches / INCHES_PER_FOOT;
  33.             numOfSquareFeet = roomLength * roomWidth;
  34.             numOfSquareYards = numOfSquareFeet /
  35.                 SQ_FT_PER_SQ_YARD;
  36.  
  37.             carpetPrice = 27.95;
  38.             totalCost = numOfSquareYards * carpetPrice;
  39.             Console.WriteLine("The Cost of " +
  40.                 BEST_CARPET +
  41.                 " is {0;C}", totalCost);
  42.             Console.WriteLine();
  43.             carpetPrice = 15.95;
  44.             totalCost = numOfSquareYards * carpetPrice;
  45.             Console.WriteLine("The cost of " + ECONOMY_CARPET + " is " + "{0;C}", totalCost);
  46.  
  47.             Console.Read();
  48.  
  49.      
  50.  
  51.  
  52.  
  53.  
  54.         }
  55.     }
  56. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top