Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /**************************************************************/
- /* */
- /* Class: CIS 110 -- Programming I */
- /* */
- /* Program: Ch3Prb2.CS */
- /* */
- /* Programmer: Kyle Collins */
- /* */
- /* Purpose: This program, given the radius and the */
- /* height of a cylinder, will calculate the */
- /* surface area, and volume, of said cylinder */
- /* */
- /**************************************************************/
- using System;
- using LibUtil;
- // Begin namespace Ch3Prb2
- namespace Ch3Prb2
- {
- // Begin application class Ch3Prb2App
- class Ch3Prb2
- {
- static double radius, height, surfaceArea, volume;
- static void Main()
- {
- ConsoleApp.ClrScr(); IdentifyApplication();
- InputRadius(); InputHeight();
- CalcSurfAndVol(); DisplayResults();
- }
- static void IdentifyApplication()
- {
- Console.WriteLine("\nApplication: Ch3Prb2 -- Calculate the " +
- "surface area and volume of a cylinder\n");
- }
- static void InputRadius()
- {
- Console.Write("Radius "); radius = Double.Parse(Console.ReadLine());
- }
- static void InputHeight()
- {
- Console.Write("Height "); height = Double.Parse(Console.ReadLine());
- }
- static void CalcSurfAndVol()
- {
- surfaceArea = 2 * Math.PI*(radius + height);
- volume = Math.PI * radius * 2 * height;
- }
- static void DisplayResults()
- {
- Console.WriteLine();
- Console.WriteLine("Surface Area: {0}", surfaceArea);
- Console.WriteLine();
- Console.WriteLine("Volume: {0}", volume);
- Console.WriteLine();
- ConsoleApp.Pause();
- }
- } // End application class Ch3Prb2App
- } // End namespace Ch3Prb2
Add Comment
Please, Sign In to add comment