Numbers
23
45
13
5
56
74
10
30
65
40
Identify the comparisons and the exchange made to sort the array found in the numbers above using the bubble sort technique and the shell sort technique.

 

Lesson 11 Project

Your Name – CIS150 Section

Below is an example of a program written in Visual Basics.Net.  There are several errors in the program.  There are two (2) types of error in this program.

There are three (3)
Compile/syntax errors.

There are three (3) Logic errors.

Use the desktop checking method to debug this program.

 


The green font in the code is internal documentation describing what the code does.

 

 

' Project name:         Debug Project

' Project purpose:      The project calculates the number of

'                       positive integers, negative integers,

'                       and zeros entered by the user.

PrivateSub enterButton_Click(ByVal sender AsObject, ByVal e As System.EventArgs) Handles enterButton.Click

 

' displays the number of positive integers, the number of negative integers, and the number of zeros entered

 

'Declare the variables to be used in this program.

Dim inputNumber AsString'Variable to store the input number from the user

Dim number AsInteger'Variable to hold the input number that was converted to an integer

Dim positiveCounter AsInteger'Variable counter that counts the number of positive numbers.

Dim negativeCounter AsIntejer 'Variable counter that counts the number of negative numbers.

Dim zeroCounter AsInteger'Variable counter that counts the number of zeros.

Dim isConverted AsBoolean'Boolean variable to store True/False if the input was a valid numerical value.

 

 

'Gets input from the user using an input box.

inputNumber = InputBox("Enter an integer. Click Cancel to end. ", "Number Entry", "0")

 

'loops until the users clicks cancels.

DoWhileinput2Number <>""

 

isConverted = Integer.TryParse(inputNumber, number) 'The tryParse method tries to convert the input from the user into an integer and stores the value in the number variable.  If the user enters a number, a boolean true will be stored in the isConverted boolean variable.  If the user enters a letter or symbol, a boolean false will be stored in the isConverted variable and a zero will be stored in the number variable.

 

'Checks that the user entered a number   

If isConverted= TrueThen

 

If number >= 0 Then

 

positiveCounter = Counter + 1 'If the number entered is greater than 0 then increment the positive number counter by 1.

 

ElseIf number < 0 Then

negativeCounter = negativeCounter + 1 'If the number entered is less than zero then increment the negative number counter by 1.

 

Else

 

zeroCounter = zeroCounter -1 'If the user enters zero, then increment the zero counter by 1.

EndIf

 

Else

 

MessageBox.Show("Please enter a number", "Number Entry", MessageBoxButtons.OK)

 

EndIf

 

inputNumber = InputBox("Enter an integer. Click Cancel to end. ","Number Entry", "0")

Loop

 

'Display counter values

        positiveLabel.Text = Convert.ToString(negativeCounter)

        negativeLabel.Text = Convert.ToString(negativeCounter)

        zeroLabel.Text = Convert.ToString(zeroCounter)

 

 

EndSub

 

 

    • 12 years ago
    Complete solution A++
    NOT RATED

    Purchase the answer to view it

    blurred-text
    • attachment
      2014-10-08_200305_l11_debugprojecterrors_1.docx
    • attachment
      q.docx