Here is the dilemna, I can't figure out how to count the time a value is above a certain amount in c#.
Exercise:
A radio station specialized in classical music is raising fund. People call in to pledge donations. Donors who pledge for $100 or above will receive a coffee mug. The radio station wants a program to tell them how many coffee mugs they need. The program will ask for the amount pledged by each donor. When there is no more pledge to enter, input -1 to stop data entry. The program should display the number of pledges that are $100 or above.
Current code:
using System;
public class Question03
{
public static void Main(string[] args)
{
Console.WriteLine("Mugs Need for Donations over $100") ;
Console.WriteLine("=================================");
Console.WriteLine();
int pledge;
int totalPledges = 0;
int numMugs = 0;
Console.Write("Enter the amount to be pledged or -1 to stop: ");
pledge = Convert.ToInt32(Console.ReadLine());
while (pledge != -1)
{
totalPledges = totalPledges + pledge;
//numMugs = numMugs + 1;
Console.Write("Enter the amount to be pledged or -1 to stop: ");
pledge = Convert.ToInt32(Console.ReadLine());
}
Console.WriteLine("Total amount pledged: {0}", totalPledges);
//Console.WriteLine("Number of pledges: { 0}", numStudents);
for (pledge = 0; pledge > 100)
{
Console.WriteLine("Number of Mugs: {0}", pledge);
}
}
}