Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // File Prologue
- // CS 1400-X01
- // Sara Payne
- // Lab #3
- // Aug 30, 2011
- // I delcare that the following source code was written by me, or provided
- // by the instructor for this project. I understand that copying
- // source code from any other source constitutes cheating, and that I will
- // reveive a zero grade on this project if I am found in violation of
- // this policy.
- using System;
- class Program
- {
- static void Main ()
- {
- // Declare pi as a const variable
- const double PI = 3.14159;
- // Declare Diamater product
- const int DIAMATER_PORDUCT = 2;
- // Declare Variables to hold data for radius, area, diamater, circumference, unused space
- double area, radius, diamater, area_of_circle, unused_Space;
- // Tell user that we are finding the unused space between crops which is the area within the square
- // but outside the circles.
- Console.WriteLine("This program finds the empty space that is not used within the cirlce of crops");
- // Prompt user what the radius of one circle is
- Console.Write("Please enter the radius of the one crop circle: ");
- // Get radius typed by user and save it in a variable named radius
- radius = double.Parse(Console.ReadLine());
- // Find the diamater of circle by radius * 2 (or diamater product)
- // Save diamater as variable diamater
- diamater = (radius * DIAMATER_PORDUCT);
- // Use the radius of the circle to compute the area of the circle (PI* radius^2)
- area_of_circle = (PI * radius * radius);
- // Find area of the square in bariable name area
- area = diamater * diamater;
- // Save area of square in variable name area
- // Find unused space by area - area_of_circle
- unused_Space = area - area_of_circle;
- // Save unused space answer in variable unused_Space 31.4
- // Print unused_Space
- Console.WriteLine ("This is the unused space between crops {0}",unused_Space);
- Console.ReadLine ();
- }
- }
Add Comment
Please, Sign In to add comment