// create a program that thakes 5 quiz grades, prints the average, and determines the grade
public float quiz1, quiz2, quiz3, quiz4, quiz5;
public float average;
void Start()
{
CalculateAverage();
}
private void Update()
{
if (Input.GetKeyDown(KeyCode.Space))
{
CalculateAverage();
}
}
private void CalculateAverage();
{
quiz1 = Random.Range(1f, 100.1f);
quiz2 = Random.Range(1f, 100.1f);
quiz3 = Random.Range(1f, 100.1f);
quiz4 = Random.Range(1f, 100.1f);
quiz5 = Random.Range(1f, 100.1f);
average = (quiz1 + quiz2 + quiz3 + quiz4 + quiz5) / 5;
// Rounding the average to two decimal places
average = Mathf.Round(average * 100) / 100;
if (average >= 90)
Debug.Log("You have an A");
else if (average >= 80 && average < 90)
Debug.Log("You have an B");
else if (average >= 70 && average < 80)
Debug.Log("You have an C");
else
Debug.Log("You have an F");
}