Advertisement
Guest User

Carpet Calculator Attempt Useful program

a guest
Oct 10th, 2010
354
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 2.10 KB | None | 0 0
  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()
  11.         {
  12.  
  13.             string carpet1 = "Carpet1";
  14.             string carpet2 = "Carpet2";
  15.             const int INCHES_PER_FOOT = 12;
  16.             const int SQ_FT_PER_SQ_YARD = 9;
  17.  
  18.  
  19.             double roomLength,
  20.                 roomWidth,
  21.  
  22.                 numOfSquareFeet,
  23.                 numOfSquareYards,
  24.                 totalCost;
  25.  
  26.  
  27.          
  28.            
  29.            
  30.                 Console.WriteLine("Please Enter The Room's Length in Feet. ");
  31.                 double roomLengthFeet = Console.Read();
  32.        
  33.            
  34.  
  35.             Console.WriteLine("Please Enter The left over inches in the room's Length. ");
  36.             double roomLengthInches = Console.Read();
  37.  
  38.  
  39.             Console.WriteLine("Please Enter The Room Width in Feet. ");
  40.             double roomWidthFeet = Console.Read();
  41.  
  42.  
  43.             Console.WriteLine("Please Enter The Remaining room Width in Inches. ");
  44.             double roomWidthInches = Console.Read();
  45.  
  46.  
  47.             Console.WriteLine("Please Enter The Price of Carpet 1.");
  48.             double carpet1Price = Console.Read();
  49.  
  50.  
  51.             Console.WriteLine("Please Enter The Price of Carpet 2.");
  52.             double carpet2Price = Console.Read();
  53.  
  54.  
  55.             roomLength = roomLengthFeet +
  56.                 roomLengthInches / INCHES_PER_FOOT;
  57.  
  58.             roomWidth = roomWidthFeet +
  59.                 roomWidthInches / INCHES_PER_FOOT;
  60.  
  61.             numOfSquareFeet = roomLength * roomWidth;
  62.             numOfSquareYards = numOfSquareFeet /
  63.                 SQ_FT_PER_SQ_YARD;
  64.  
  65.  
  66.             totalCost = numOfSquareYards * carpet1Price;
  67.             Console.WriteLine("The Cost of " +
  68.                 carpet1 +
  69.                 " is {0:C}", totalCost);
  70.             Console.WriteLine();
  71.  
  72.             totalCost = numOfSquareYards * carpet2Price;
  73.             Console.WriteLine("The cost of " + carpet2 + " is " + "{0:C}", totalCost);
  74.  
  75.             Console.ReadLine();
  76.         }
  77.     }
  78. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement