namespace lab6_4_CalebFontenot { public partial class Form1 : Form { public Form1() { InitializeComponent(); } /* * The CupsToOunces method accepts a number of cups as an argument and returns the equivalent number of fluid ounces. */ private double CupsToOunces(double cups) { return cups * 8.0; } private void convertButton_Click(object sender, EventArgs e) { double cups, ounces = 0; // Get the number of cups. if (double.TryParse(cupsTextBox.Text, out cups)) { // Convert the cups to ounces. ounces = CupsToOunces(cups); // Display the ounces ouncesTextBox.Text = ounces.ToString("n1"); } else { // Display an error message. MessageBox.Show("Enter a valid number."); } } private void exitButton_Click(object sender, EventArgs e) { this.Close(); } } }