You should develop a program that manipulates and processes numbers. Your program should read a text file that has 20 random numbers between 1-40. Then it should display the following in an informative RichTextBox:
1 - The Summation of all numbers.
2 - The average of all number.
3 - The smallest number.
The Program should sort the numbers from the input file and place the sorted number is another file that has the prefix “sorted_” and the extension .txt that should be written in the same directory as the input file is in. Your code should only use file manipulation methods to sort the numbers. You can declare an many temporary files as you need in the process. No other method is allowed (NO Array usage, NO API). Do not declare a variable for each generated number.
4 - After sorting the number, the RichTextBox should display the median of the number sorted.
The input file that contains the random numbers should be created and the numbers should be dynamically generated in the “Form_Load” method.

Solution PreviewSolution Preview

This material may consist of step-by-step explanations on how to solve a problem or examples of proper writing, including the use of citations, references, bibliographies, and formatting. This material is made available for the sole purpose of studying and learning - misuse is strictly forbidden.

namespace Sorting
    public partial class Form1 : Form
       public Form1()

       private void Form1_Load(object sender, EventArgs e)
            Random rnd = new Random();
            StreamWriter outputFile;
            outputFile = File.CreateText("input.txt");
            int sum = 0;
            double total = 0.0;
            int smallest = int.MaxValue;
            int number;
            int size = 20;
            for (int i = 0; i < size; i++)
                number = rnd.Next(1, 40);
                total += number;
                sum += number;
                if (smallest > number)
                   smallest = number;
$50.00 for this solution

PayPal, G Pay, ApplePay, Amazon Pay, and all major credit cards accepted.

Find A Tutor

View available C-Family Programming Tutors

Get College Homework Help.

Are you sure you don't want to upload any files?

Fast tutor response requires as much info as possible.

Upload a file
Continue without uploading

We couldn't find that subject.
Please select the best match from the list below.

We'll send you an email right away. If it's not in your inbox, check your spam folder.

  • 1
  • 2
  • 3
Live Chats