I created this little application which calculates an average of temperatures based on values given by user. I am trying to create a news switch statement so that for example the average temperature this week was < 10 it would give a message such as "it was a cold week". Here is my code and what I am doing wrong:
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
namespace TempAverages
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void btnCalc_Click(object sender, EventArgs e)
{
int tempMonday = Convert.ToInt32(txtMonday.Text);
int tempTuesday = Convert.ToInt32(txtTuesday.Text);
int tempWednesday = Convert.ToInt32(txtWednesday.Text);
int tempThursday = Convert.ToInt32(txtThursday.Text);
int tempFriday = Convert.ToInt32(txtFriday.Text);
int weekdays = 5;
int tempAverage = (tempMonday + tempTuesday + tempWednesday + tempThursday + tempFriday) / weekdays;
switch (weathernews)
{
case 1: tempAverage < 10;
lblResult.Text = "it was a cold week with only" + tempAverage;
break;
case 2: tempAverage > 20;
lblResult.Text = "it was quite warm with" + tempAverage;
}
}
}
}
i get error messages such as "the name weathernews does not exist in the current context"