Aliendreamer

methods painthouse exam 18.03.2017

Mar 27th, 2017
172
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.51 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Deployment.Internal;
  4. using System.Linq;
  5. using System.Text;
  6. using System.Threading.Tasks;
  7.  
  8. namespace issue1
  9. {
  10.     class Program
  11.     {
  12.  
  13.  
  14.         private static  double House(double lenghtA, double HeightB)
  15.         {
  16.             double onesidebody = lenghtA*(lenghtA/2);
  17.             double backsidesqyare =(lenghtA/2)*(lenghtA/2);
  18.             double backsidetriangle = (lenghtA/2)*(HeightB - (lenghtA/2));
  19.             double backsidetrianglee = backsidetriangle/2;
  20.             double backside = backsidesqyare + backsidetrianglee;
  21.             double door =(lenghtA/5)*(lenghtA/5);
  22.             double frontside = (backsidetrianglee + backsidesqyare) - door;
  23.             double house = backside + frontside + (2*onesidebody);
  24.             return house;
  25.  
  26.         }
  27.  
  28.  
  29.         private  static double Roof(double lengthA)
  30.             {
  31.                 double roofoneside = lengthA*(lengthA/2);
  32.  
  33.                double roof = 2*roofoneside;
  34.             return roof;
  35.             }
  36.  
  37.         static void Main(string[] args)
  38.         {
  39.             //input
  40.  
  41.             double lenghtA = double.Parse(Console.ReadLine());
  42.             double HeightB =double.Parse(Console.ReadLine());
  43.  
  44.  
  45.            
  46.            
  47.  
  48.             double greenPaint =House(lenghtA,HeightB)/ 3;
  49.  
  50.             double redpaint = Roof(lenghtA)/ 5;
  51.  
  52.             Console.WriteLine("{0:f2}",greenPaint);
  53.             Console.WriteLine("{0:f2}",redpaint);
  54.  
  55.  
  56.  
  57.  
  58.  
  59.  
  60.         }
  61.     }
  62. }
Advertisement
Add Comment
Please, Sign In to add comment