Question

In: Computer Science

A, B:   Design and Implement a C# windows form application to ask the user for 10...

A, B:   Design and Implement a C# windows form application to ask the user for 10 integer numbers, sort them in ascending order and display the sorted list. Use bubble sort technique to sort the array elements and do not use any built-in sort method to sort the array elements.
                                                       [02]
C:    Test and evaluate your program by inputting variety of values.

Solutions

Expert Solution

using System;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using System.Threading;
namespace WindowsFormsApplication1
{
    public partial class Form1: Form
    {

        public Form1()
        {
            InitializeComponent();
            FillArray();
        }
        static int[] arr= new int[10];

        private void FillArray()
        {
             for(i=0;i<10;i++)
             {
                   arr[i] = Convert.ToInt32(Console.ReadLine());        
             }  

        }

        private void btnOne_Click(object sender, EventArgs e)
        {
             
                             int len,i,j,temp;  
   
                Console.WriteLine("Original array :");
            foreach (int val in arr)                       
                 Console.Write(val + " ");                     
            for ( j = 0; j <= arr.Length - 2; j++)
            {
                for ( i = 0; i <= arr.Length - 2; i++)
                {
                    if (arr[i] > arr[i + 1])
                    {
                        temp = arr[i + 1];
                        arr[i + 1] = arr[i];
                        arr[i] = temp;
                    }
                } 
            }
            Console.WriteLine("\n"+"Sorted array :");
            foreach (int val in arr)                       
            Console.Write(val + " ");
                        Console.Write("\n"); 
            
        }
}
}

input

4
10 2 5 3 

Input number of values to be sorted:Input 4 strings below :
Original array :
10 2 5 3 
Sorted array :
2 3 5 10 
8
10 -2 5 2 1 -8 0 6 

Input number of values to be sorted:Input 8 strings below :
Original array :
10 -2 5 2 1 -8 0 6 
Sorted array :
-8 -2 0 1 2 5 6 10 

Related Solutions

A, B:    Design and Implement a C# windows form application to encrypt and decrypt text....
A, B:    Design and Implement a C# windows form application to encrypt and decrypt text. The application use to receive a string and display another encrypted string. The application also decrypt the encrypted string. The approach for encryption/decryption is simple one i.e. to encrypt we will add 1 to each character, so that "hello" would become "ifmmp", and to decrypt we would subtract 1 from each character.    C:   Test and evaluate application by applying different strings.      ...
Implement a program in C++ that does the following: Ask the user and read at least...
Implement a program in C++ that does the following: Ask the user and read at least 10 numbers as input from the keyboard and stores them in a an array Displays the array of numbers on the screen (as is, before sorting) Sorts those numbers in the array using Selection Sort Algorithm Displays the array of numbers on the screen (AFTER sorting)
C# Programming Discuss how to build a Multi-Form Windows application in C#. That is an App...
C# Programming Discuss how to build a Multi-Form Windows application in C#. That is an App that has more than one form, like say maybe 5 forms. How do you connect these forms and pass data objects between these forms?
programing language JAVA: Design and implement an application that reads a sentence from the user, then...
programing language JAVA: Design and implement an application that reads a sentence from the user, then counts all the vowels(a, e, i, o, u) in the entire sentence, and prints the number of vowels in the sentence. vowels may be upercase
Language: C# Create a new Console Application. Your Application should ask the user to enter their...
Language: C# Create a new Console Application. Your Application should ask the user to enter their name and their salary. Your application should calculate how much they have to pay in taxes each year and output each amount as well as their net salary (the amount they bring home after taxes are paid!). The only taxes that we will consider for this Application are Federal and FICA. Your Application needs to validate all numeric input that is entered to make...
Design and implement a C++ program that performs the following steps:Ask the user to enter a...
Design and implement a C++ program that performs the following steps:Ask the user to enter a positive integer number N; Your program may need to prompt the user to enter many times until it reads in a positive number;Let user to enter N (obtained in the previous step) floating point numbers, and count how many positive ones there are in the sequence and sum up these positive numbers; (Hint: negative numbers or 0 are ignored).Display result.You can and should use...
Design and implement a program that reads a series of 10 integers from the user and...
Design and implement a program that reads a series of 10 integers from the user and prints their average. Read each input value as a string, and then attempt to convert it to an integer using the Integer.parseInt method. If this process throws a NumberFormatException (meaning that the input is not a valid number), print an appropriate error message and prompt for the number again. Continue reading values until 10 valid integers have been entered.
Design a program (in C++)to calculate the stock purchasing and selling transactions. 1. ask the user...
Design a program (in C++)to calculate the stock purchasing and selling transactions. 1. ask the user to enter the name of the stock purchased, the number of share purchased, and the price per share purchased 2. assume the buyer pays 2% of the amount he paid for the stock purchase as broker commission 3. assume that the buyer sold all stocks. Ask the user to enter the price per share sold. 4. assume the buyer will pay another 2% of...
How to make an application for windows using c# ?
How to make an application for windows using c# ?
C# windows application form. Create a base class to store characteristics about a loan. Include customer...
C# windows application form. Create a base class to store characteristics about a loan. Include customer details in the Loan base class such as name, loan number, and amount of loan. Define subclasses of auto loan and home loan. Include unique characteristics in the derived classes. For example you might include details about the specific auto in the auto loan class and details about the home in the home loan class. Create a presentation class to test your design by...
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT