Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Need help with a windows GUI application I have to make in Visual Studio in C#.

ID: 3845878 • Letter: N

Question

Need help with a windows GUI application I have to make in Visual Studio in C#.

Here are the instructions,

"Array of a structure. Create a project to analyze an income survey. The statistics for each home include an identification code, the number of members in the household, and the yearly income.

The menus will include File, Reports, and Help. The File menu will contain Enter Data and Exit. As The data are entered, they should be assigned from the text boxes to the elements of a structure.

The reports for the project will be sent to the Print Preview window. Each report should include a title, the programmer name, and the labels identifying the data.

Report 1: A report that displays the input data.

Report 2: A two-Coloumn report listing of the identification number, income for each household that exceeds the average income. The calculated average income should display at the top of the report.

Report 3: The percentage of households that have incomes below the poverty level.

Poverty Guidelines for 2008

"

Thank you ahead of time for providing me with some assistance.

Family Size Income 1 10210 2 13690 3 17170 4 20650 5 24130 6 27610 7 31090 8 34570 For each additional person add 3480

Explanation / Answer

The Code for the IncomeSurvey in c# is given below :

Public Class IncomeForm
   Dim FamilyCount As Integer = 0
   Dim PovertyCount As Integer
   Dim Poverty As Integer
   Dim FamilyId As Integer
   Dim FamilySize As String
   Dim AnnualIncome As String

   Private pFont As New Font("Arial", 12)

   'Define structure data type
   Private Structure Family

       'Elements of structure are declared inside strucure definition
       Dim FamilyId As Integer
       Dim FamilySize As String
       Dim AnnualIncome As String


   End Structure
   Private NewFamily(10) As Family
   Private ii As Short = 0
   Private Sub enterButton_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles enterButton.Click,
   EnterDataToolStripMenuItem.Click, EnterDataToolStripMenuItem.Click

       If ii = NewFamily.GetUpperBound(0) Then
           ReDim NewFamily(ii + 10) 'If the array is full than increase its size by ten
       End If

       With NewFamily(ii) 'Enter customer information into structure at appropriate array index ii
           .FamilyId = CShort(idTextBox.Text)
           .FamilySize = familysizeTextBox.Text
           .AnnualIncome = annualincomeTextBox.Text
       End With

       ii += 1 'Add one more to counter after adding new customer

       Dim Size As Integer
       Dim Income As Integer
       Dim TestIncome As Integer
       Dim AnnualIncome As Decimal
       Dim PovertyPercent As Integer

       'checks to make sure the user has inputted all neccessary fields.
       If idTextBox.Text = "" Or familysizeTextBox.Text = "" Or annualincomeTextBox.Text <= 0 Then

           MessageBox.Show("Please enter a ID number, Family size," _
               & Environment.NewLine & "and your family's annual income!", "Error")
       Else
           Size = CInt(familysizeTextBox.Text)
           Income = CInt(annualincomeTextBox.Text)

               Select Case Size 'Test and decision for flowchart
               'Calculates all neccessary calculations.
               Case 1
                   TestIncome = 10210
               Case 2
                   TestIncome = 13690
               Case 3
                   TestIncome = 17170
               Case 4
                   TestIncome = 20650
               Case 5
                   TestIncome = 24130
               Case 6
                   TestIncome = 27610
               Case 7
                   TestIncome = 31090
               Case 8
                   TestIncome = 34570
               Case Else
                   TestIncome = (34570 + ((familysizeTextBox.Text - 8) * 3480))
           End Select

           If Income <= TestIncome Then
               AnnualIncome = 0 '0 means they are below poverty level for family size
               PovertyCount += 1

           Else
               AnnualIncome = 1 '1 means they are above poverty level for family size
           End If

           FamilyCount += 1
           PovertyPercent = ((FamilyCount - PovertyCount) / FamilyCount)
       End If


       With Me
           .idTextBox.Clear()
           .idTextBox.Focus()
           .familysizeTextBox.Clear()
           .annualincomeTextBox.Clear()
       End With
   End Sub


   Private Sub PrintDocument1_PrintPage(ByVal sender As System.Object, ByVal e As System.Drawing.Printing.PrintPageEventArgs) Handles
   PrintDocument1.PrintPage
       Dim LineHeight As Single = pFont.Height + 2 'Set Line height for printing 2 more than font height
       Dim HPrint As Single = e.MarginBounds.Left 'Set Left Margin for Printing
       Dim VPrint As Single = e.MarginBounds.Top 'Set Top Margin for Printing
       Dim PString As String = "" 'Create string to build printed line during print

       PString = "IN-PUTTED DATA SUMMARY REPORT:" _
           & Environment.NewLine & "" _
           & Environment.NewLine & "Id Number " & ": " & FamilyId.ToString() _
           & Environment.NewLine & "Total number in family " & ": " & FamilySize.ToString() _
           & Environment.NewLine & "Annual Income " & ": " & AnnualIncome.ToString()
       e.Graphics.DrawString(PString, pFont, Brushes.Black, HPrint, VPrint) 'Printing

       VPrint += LineHeight 'Increment to new line
   End Sub

   Private Sub InputtedDataReportToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles
   InputtedDataReportToolStripMenuItem.Click
       PrintPreviewDialog1.Document = PrintDocument1 'set Dialog to current page to print

       PrintPreviewDialog1.ShowDialog()

   End Sub

   Private Sub fontButton_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles fontButton.Click
       FontDialog1.Font = pFont       'Set dialog to font used for printing
       FontDialog1.ShowDialog()       'Show Font dialog
       pFont = FontDialog1.Font       'Set dialog font back to Font used for printing

   End Sub

Private Sub ExitToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles
ExitToolStripMenuItem.Click, exitButton.Click
       Me.Close()
   End Sub

End Class

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote