Advertisement
dbrazo

yes

Feb 5th, 2020
53
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 4.78 KB | None | 0 0
  1.             // DoubleDecimalTest
  2.             Console.WriteLine("<< DoubleDecimalTest.cs >>");
  3.             double age = 11.5;
  4.             Console.WriteLine(age);
  5.  
  6.             Console.WriteLine();
  7.  
  8.             // Room
  9.             Console.WriteLine("<< Room.cs >>");
  10.             sbyte length = 15, width = 25;
  11.             Console.WriteLine("Length(ft): " + length);
  12.             Console.WriteLine("Width(ft): " + width);
  13.             Console.WriteLine("The floor space is " + length * width + " square feet.");
  14.  
  15.             Console.WriteLine();
  16.  
  17.             // Carpet
  18.             Console.WriteLine("<< Carpet.cs >>");
  19.             int length1 = 20, width1 = 16;
  20.             double carpet = 7;
  21.             Console.WriteLine("Length(ft): " + length1);
  22.             Console.WriteLine("Width(ft): " + width1);
  23.             Console.WriteLine("Price per square foot of carpet: " + carpet.ToString("c"));
  24.             Console.WriteLine("The base cost of carpeting the whole room is " + ((length1 * width1) * carpet).ToString("c"));
  25.  
  26.             Console.WriteLine();
  27.  
  28.             // Yards
  29.             Console.WriteLine("<< Yards.cs >>");
  30.             int length2 = 25, width2 = 42;
  31.             double carpet1 = 63;
  32.             Console.WriteLine("Length(ft): " + length2);
  33.             Console.WriteLine("Width(ft): " + width2);
  34.             Console.WriteLine("Price per square yard of carpet: " + carpet1.ToString("c"));
  35.             Console.WriteLine("The base cost of carpeting the whole room is " + (((length2 * width2) / 9) * carpet1).ToString("c"));
  36.  
  37.             Console.WriteLine();
  38.  
  39.             // HoursAndMinutes
  40.             Console.WriteLine("<< HoursAndMinutes.cs >>");
  41.             byte minutes = 197;
  42.             Console.WriteLine("You have worked " + (minutes / 60) + " hours and " + (minutes % 60) + " minutes today. Good Job!");
  43.  
  44.             Console.WriteLine();
  45.  
  46.             // Eggs
  47.             Console.WriteLine("<< Eggs.cs >>");
  48.             sbyte c1 = 23, c2 = 35, c3 = 36, c4 = 24;
  49.             var sum = (c1 + c2 + c3 + c4);
  50.             Console.WriteLine("A total of " + sum + " eggs have been produced this month. That's " + (sum / 12) + " dozen and " + (sum % 12) + " eggs.");
  51.  
  52.             Console.WriteLine();
  53.  
  54.             // EggsInteractive
  55.             Console.WriteLine("<< EggsInteractive.cs >>");
  56.             Console.Write("Chicken 1: ");
  57.             string c5 = Console.ReadLine();
  58.             Console.Write("Chicken 2: ");
  59.             string c6 = Console.ReadLine();
  60.             Console.Write("Chicken 3: ");
  61.             string c7 = Console.ReadLine();
  62.             Console.Write("Chicken 4: ");
  63.             string c8 = Console.ReadLine();
  64.             int sum1 = (int.Parse(c5) + int.Parse(c6) + int.Parse(c7) + int.Parse(c8));
  65.             Console.WriteLine("A total of " + sum1 + " eggs have been produced this month. That's " + (sum1 / 12) + " dozen and " + (sum1 % 12) + " eggs.");
  66.  
  67.             Console.WriteLine();
  68.  
  69.             // Tests
  70.             Console.WriteLine("<< Tests.cs >>");
  71.             sbyte t1 = 90, t2 = 84, t3 = 96, t4 = 91, t5 = 94;
  72.             var avg = ((t1 + t2 + t3 + t4 + t5) / 5);
  73.             Console.WriteLine("Average test score: " + avg);
  74.  
  75.             Console.WriteLine();
  76.  
  77.             //Payroll
  78.             Console.WriteLine("<< Payroll.cs >>");
  79.             Console.Write("Enter your name: ");
  80.             string name = Console.ReadLine();
  81.             Console.Write("Social Security Number: ");
  82.             string ssn = Console.ReadLine();
  83.             Console.Write("Hourly pay rate: ");
  84.             string rate = Console.ReadLine();
  85.             Console.Write("Hours worked: ");
  86.             string worked = Console.ReadLine();
  87.             Console.WriteLine("Payroll summary for: " + name);
  88.             Console.WriteLine("SSN: " + ssn);
  89.             Console.WriteLine("You worked " + worked + " hours at " + double.Parse(rate).ToString("c") + " per hour");
  90.             var gross = double.Parse(rate) * double.Parse(worked);
  91.             var fed = gross * 0.15;
  92.             var state = gross * 0.05;
  93.             var net = gross * 0.80;
  94.             Console.WriteLine("Gross pay: " + gross.ToString("c"));
  95.             Console.WriteLine("Federal withholding: " + fed.ToString("c"));
  96.             Console.WriteLine("State withholding: " + state.ToString("c"));
  97.             Console.WriteLine("Net pay: " + net.ToString("c"));
  98.  
  99.             Console.WriteLine();
  100.  
  101.             //PigLatin
  102.             Console.WriteLine("<< PigLatin.cs >>");
  103.             Console.Write("Original word: ");
  104.             string word = Console.ReadLine();
  105.             var letter = word.Substring(0, 1);
  106.             var translation = word.Substring(1) + letter + "ay";
  107.             Console.WriteLine("Translated word: " + translation);
  108.  
  109.             Console.WriteLine();
  110.             Console.ReadLine();
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement