Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- namespace CarpetCalculator
- {
- class Program
- {
- static void Main()
- {
- string carpet1 = "Carpet1";
- string carpet2 = "Carpet2";
- const int INCHES_PER_FOOT = 12;
- const int SQ_FT_PER_SQ_YARD = 9;
- double roomLength,
- roomWidth,
- numOfSquareFeet,
- numOfSquareYards,
- totalCost;
- Console.WriteLine("Please Enter The Room's Length in Feet. ");
- double roomLengthFeet = Console.Read();
- Console.WriteLine("Please Enter The left over inches in the room's Length. ");
- double roomLengthInches = Console.Read();
- Console.WriteLine("Please Enter The Room Width in Feet. ");
- double roomWidthFeet = Console.Read();
- Console.WriteLine("Please Enter The Remaining room Width in Inches. ");
- double roomWidthInches = Console.Read();
- Console.WriteLine("Please Enter The Price of Carpet 1.");
- double carpet1Price = Console.Read();
- Console.WriteLine("Please Enter The Price of Carpet 2.");
- double carpet2Price = Console.Read();
- roomLength = roomLengthFeet +
- roomLengthInches / INCHES_PER_FOOT;
- roomWidth = roomWidthFeet +
- roomWidthInches / INCHES_PER_FOOT;
- numOfSquareFeet = roomLength * roomWidth;
- numOfSquareYards = numOfSquareFeet /
- SQ_FT_PER_SQ_YARD;
- totalCost = numOfSquareYards * carpet1Price;
- Console.WriteLine("The Cost of " +
- carpet1 +
- " is {0:C}", totalCost);
- Console.WriteLine();
- totalCost = numOfSquareYards * carpet2Price;
- Console.WriteLine("The cost of " + carpet2 + " is " + "{0:C}", totalCost);
- Console.ReadLine();
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement