More MP2 Progress

This commit is contained in:
2022-09-15 14:58:29 -05:00
parent 5be278f113
commit b90ebbb217
110 changed files with 1800 additions and 0 deletions

View File

@@ -0,0 +1,62 @@
namespace Problem2BookClubPoints_CalebFontenot
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void okButton_Click(object sender, EventArgs e)
{
try
{
// Define variables
int booksPurchased,
pointsEarned = 0;
// Get data
booksPurchased = int.Parse(booksPurchasedTextBox.Text);
// Determine points earned with if logic:
if (booksPurchased >= 4)
{
pointsEarned = 60;
}
if (booksPurchased == 3)
{
pointsEarned = 30;
}
if (booksPurchased == 2)
{
pointsEarned = 15;
}
if (booksPurchased == 1)
{
pointsEarned = 5;
}
if (booksPurchased == 0)
{
pointsEarned = 0;
}
// Write pointsEarned to textbox.
pointsTextBox.Text = pointsEarned.ToString();
}
catch
{
MessageBox.Show("Invalid Input");
}
}
private void exitButton_Click(object sender, EventArgs e)
{
this.Close();
}
}
}