• API
• FAQ
• Tools
• Archive
daily pastebin goal
28%
SHARE
TWEET

# Carpet Calculator Attempt Useful program

a guest Oct 10th, 2010 158 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()
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. ");
32.
33.
34.
35.             Console.WriteLine("Please Enter The left over inches in the room's Length. ");
37.
38.
39.             Console.WriteLine("Please Enter The Room Width in Feet. ");
41.
42.
43.             Console.WriteLine("Please Enter The Remaining room Width in Inches. ");
45.
46.
47.             Console.WriteLine("Please Enter The Price of Carpet 1.");
49.
50.
51.             Console.WriteLine("Please Enter The Price of Carpet 2.");
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.