• Log in or sign up for an account here: https://www.sythe.org/login

c# homework

Do It Right

Forum Addict
Joined
Feb 12, 2012
Sythe Gold
0
Messages
416
c# homework
hey i was wondering if anyone could help em with my homework for C# hereare the directions


1. The form includes a menubar and a list box.
2. The menubar includes a file menu item which contains options for Open and Exit
3. The menubar includes a Calculate menu item which contains options for Max, Min, and Average
4. When the File/Open command is used the program prompts the user for a file using the common dialog Open
File dialog box.
5. Open a file containing a series of numbers such as:
456.66
234.44
678.55
234.55
6. Display the values in the list box.
7. When the user choose Calculate/Max display the largest value in the list.
8. When the user chooses Calculate/Min display the smallest value in the list.
9. When the user chooses Calculate/Average displays the average of these numbers.
10. When the user choose File/Exit the program exits.



I have made the form and got the exit to work and i was wondering how i am going to scan a given file and go through all the numbers in it and find the biggest number and then find the lowest number and then find the average number.

any help is appreciated thanks.
 
c# homework
You could do this more efficiently but for the sake of I/O homework here...

Code:
        double[] numbers = File.ReadLines("c:\\values.txt");

        foreach (double d in lines)
        {
            listBox1.items.add(new ListItem(d.ToString());
        }

I've just written that from scratch so it probably needs playing around with first. Good luck. :p
 
Runescape Gamblingrunescape gambling
Back
Top