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.      ...
C# Programming; Create a Windows Form Application that displays a scrollable list of 10 random integers...
C# Programming; Create a Windows Form Application that displays a scrollable list of 10 random integers in the range of 1 to 100. The form should also have (1) an Add button (and input textbox) for the user to add a new number to the list, (2) a Delete button to delete the current selected integer, (3) a Sort button to sort the list, (4) a Reverse button to display the list in reverse order, and (5) Display Multiple (and...
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?
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...
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
Create a Windows application in C# that can be used to change the form color. Your...
Create a Windows application in C# that can be used to change the form color. Your form background color should initially be blue. Provide at least two buttons with two different color choices and a Reset option. Change the font style and size on buttons. Align the buttons so that they are in the center of the form. The color choice buttons should be the same size. Add event handlers for the buttons so that when the user click the...
Create a windows form application in C# that looks and functions like a basic calculator. It...
Create a windows form application in C# that looks and functions like a basic calculator. It must do the following: Add, subtract, multiply, and divide. Account for division by zero. Show at least two decimal places. Retain the last number on the window so that, when the user opens the calculator the next time, the number that was in the window at the last close appears. Have a memory, so that users can store values and recall them. Operate with...
C++ In this lab, you will ask the user to design a leaning pyramid. The pyramid...
C++ In this lab, you will ask the user to design a leaning pyramid. The pyramid will either lean left or right. Start by asking the user how tall they want the pyramid to be. Then ask the user if they want the pyramid to lean left or right. You should then display a pyramid that meets the requirements. (See below for examples). YOU MUST use nested loops for your solution for ANY credit. Sample Run #1: Enter a pyramid...
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...
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT