Advertisement
martyz

Cube Properties

Oct 7th, 2017
63
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.21 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using System.Threading.Tasks;
  6.  
  7. namespace CubeProperties
  8. {
  9.     class Program
  10.     {
  11.         static void Main(string[] args)
  12.         {
  13.             decimal inputNum = decimal.Parse(Console.ReadLine());
  14.             string inputString = Console.ReadLine();
  15.  
  16.             CubeProperties(inputNum, inputString);
  17.         }
  18.  
  19.         private static void CubeProperties(decimal inputNum, string inputString)
  20.         {
  21.             switch (inputString)
  22.             {
  23.                 case "face":
  24.                     Console.WriteLine("{0:0.00}", Math.Sqrt(2*Math.Pow((double)inputNum, 2)));
  25.                     break;
  26.                 case "space":
  27.                     Console.WriteLine("{0:0.00}", Math.Sqrt(3 * Math.Pow((double)inputNum, 2)));
  28.                     break;
  29.                 case "volume":
  30.                     Console.WriteLine("{0:0.00}", Math.Pow((double)inputNum, 3));
  31.                     break;
  32.                 case "area":
  33.                     Console.WriteLine("{0:0.00}", 6 * (inputNum * inputNum));
  34.                     break;
  35.                 default:
  36.                     break;
  37.             }
  38.         }
  39.     }
  40. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement