Advertisement
IvanITD

6 / a) - Architect Arithmetic - Pantheon

Jan 24th, 2024 (edited)
734
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 2.37 KB | Source Code | 0 0
  1. namespace Architect_Arithmetic_Pantheon
  2. {
  3.     internal class Program
  4.     {
  5.  
  6.         //In this section we will write a program that gives the total cost of the flooring material for the "Pantheon", in Rome, Italy.
  7.         static void Main(string[] args)
  8.         {
  9.             // Here I need to get the length and width of the rectangle and return the area!
  10.             double length = 15;
  11.             double width = 18;
  12.  
  13.             // Here I get the rectangle area back from the method!
  14.             double rectangleArea = Rectangle(length, width);
  15.  
  16.             // Here I need to get the radius of the circle and return the area!
  17.             double radius = 21.5;
  18.  
  19.             // Here I get the circle area!
  20.             double circleArea = Circle(radius);
  21.  
  22.  
  23.             // After we separate the floor plan on a paper, we need to get the result from every shape's area, and then add them together!
  24.             //The total result should be saved in a double variable, because in this project, we are instructed to work only with the variable double!
  25.             double totalShapeArea = rectangleArea + (circleArea / 2);
  26.  
  27.             // Now in order to do the next step, we need to write the flooring price!
  28.             double flooringMaterialPrice = 180;
  29.  
  30.             // And now in order to get the cost of the flooring material, we need to multiply the total shape area by the price of the material!
  31.             double totalCost = totalShapeArea * flooringMaterialPrice;
  32.  
  33.             // And now we need to print the result!
  34.             Console.WriteLine($"The total cost for the flooring material, for the Pantheon, is: {Math.Round(totalCost)} euro!");
  35.             // The next step is to round the result to the nearest integer!
  36.            
  37.         }
  38.         static double Rectangle(double length, double width)
  39.         {
  40.             // Here we calculate the area of the rectangle!
  41.             double area = length * width;
  42.             // Here we return the calculated area, of the rectangle, back to the main method!
  43.             return area;
  44.         }
  45.         static double Circle(double radius)
  46.         {
  47.             // Here we calculate the area of the circle!
  48.             double area = Math.PI * Math.Pow(radius, 2);
  49.             // Here we return the calculated area, of the circle, back to the main method!
  50.             return area;
  51.         }
  52.        
  53.        
  54.     }
  55. }
  56.  
Tags: C#
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement