//Lab 3
//CIS 199-01
//Due 2/11/2024
//By R2409

//Program displays a form that calculates diameter,
//surface area, and volume based on the radius the user inputs

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace Lab3
{
    public partial class Lab3 : Form
    {
        public Lab3()
        {
            InitializeComponent();
        }

        //calcBtn_Click handles the clicks from the button and 
        //calculates the diameter, surface area, and volume
        private void calcBtn_Click(object sender, EventArgs e)
        {
            double diameter, surfaceArea, volume; //Values as floating-point

            double radiusOfSphere; //Value as s floating-point number

            radiusOfSphere = double.Parse(radiusTxt.Text);//Parse value insert

            diameter = 2.0 * radiusOfSphere; //The diamater of the sphere using 2.0 multiplying the radius
            surfaceArea = 4.0 * Math.PI * Math.Pow(radiusOfSphere, 2); //The surface area of the sphere using 4.0 
                                                                       //multipied by PI squared
            volume = 4.0 / 3.0 * Math.PI * Math.Pow(radiusOfSphere, 3); //The volume of the sphere using 4.0 divided by 3.0
                                                                        //multiplied by PI cubed

            outputDiaLbl.Text = $"{diameter:F}"; //Displays output or diameter with a precision specifier
            outputSurfLbl.Text = $"{surfaceArea:F}"; //Displays output or surface area with a precision specifier
            outputVolLbl.Text = $"{volume:F}"; //Displays output or volume with a precision specifier

        }

        //Loads and displays the form
        private void Lab3_Load(object sender, EventArgs e)
        {

        }
    }
}
