Guest User

Untitled

a guest
Oct 20th, 2017
78
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.88 KB | None | 0 0
  1. // File Prologue
  2. // CS 1400-X01
  3. // Sara Payne
  4. // Lab #3
  5. // Aug 30, 2011
  6.  
  7.  
  8. // I delcare that the following source code was written by me, or provided
  9. // by the instructor for this project. I understand that copying
  10. // source code from any other source constitutes cheating, and that I will
  11. // reveive a zero grade on this project if I am found in violation of
  12. // this policy.
  13.  
  14.  
  15.  
  16. using System;
  17.  
  18. class Program
  19.    
  20. {
  21.     static void Main ()
  22.     {
  23.         // Declare pi as a const variable
  24.         const double PI = 3.14159;
  25.         // Declare Diamater product
  26.         const int DIAMATER_PORDUCT = 2;
  27.         // Declare Variables to hold data for radius, area, diamater, circumference, unused space
  28.         double area, radius, diamater, area_of_circle, unused_Space;
  29.         // Tell user that we are finding the unused space between crops which is the area within the square
  30.         // but outside the circles.
  31.         Console.WriteLine("This program finds the empty space that is not used within the cirlce of crops");
  32.         // Prompt user what the radius of one circle is
  33.         Console.Write("Please enter the radius of the one crop circle: ");
  34.         // Get radius typed by user and save it in a variable named radius
  35.         radius = double.Parse(Console.ReadLine());
  36.         // Find the diamater of circle by radius * 2 (or diamater product)
  37.         // Save diamater as variable diamater
  38.         diamater = (radius * DIAMATER_PORDUCT);
  39.         // Use the radius of the circle to compute the area of the circle (PI* radius^2)
  40.         area_of_circle = (PI * radius * radius);
  41.         // Find area of the square in bariable name area
  42.         area = diamater * diamater;
  43.         // Save area of square in variable name area
  44.         // Find unused space by area - area_of_circle
  45.         unused_Space = area - area_of_circle;
  46.         // Save unused space answer in variable unused_Space 31.4
  47.         // Print unused_Space
  48.         Console.WriteLine ("This is the unused space between crops {0}",unused_Space);
  49.         Console.ReadLine ();
  50.     }
  51. }
Add Comment
Please, Sign In to add comment