Problem Statement
You are to create a Visual Basic(VB) project for a census bureau to obtain and analyze household income survey data within the Pittsburgh area (including Morgantown Ky).
Data Collected:
Home identification code (4 alphanumeric characters) – required
Program should generate it using a random number generator. You won’t use this anywhere it just need to be generated. Generate the first number in the Form Load event and then each subsequent number in the button click. See attached code as example.
Date of the survey – required (try using the datetime picker control), must be a valid date. You do not need to use the date anywhere just have it available on your form to select.
County and State (1 input only) they reside in - required
Hamilton, Pa
Butler, Pa
Clermont, Pa
Warren, Pa
Campbell, Ky
Boone, Ky
Kenton, Ky
The household yearly income – required, must be numeric, must be greater than 0.
Events:
There should be 4 buttons on the screen:
1.Submit: This event will validate all data and save the data to the necessary arrays for processing.
2.Exit: This event will exit the application
3.Total Households Surveyed: This event will process the arrays and display the total households surveyed by state and then by county in a Message box (see below for example).
4.Average Household Income: This event will process the arrays and display the average household income by state and then by county in a Message box (see below for example).
Instructions:
1)Create a well designed modular program based on design techniques taught.
2)Use good naming conventions on all objects, variables, procedures, functions, etc.
3)Option Strict and Option Explicit must be on
4)All survey information must be saved to an array(s).
5)When the user clicks the button “Total Households Surveyed”, do the necessary calculations and display in a Message box the Total Households Surveyed by county for all that were surveyed (see below for example).
6)When the user clicks the button “Average Household Income”, do the necessary calculations and display in a Message box the Average Household Income by county for all that were surveyed (see below for example).
Average Household Income (Output as example only)
Pensylvania: $30,000
Hamilton: $40,000
Butler: $20,000
Clermont: $30,000
Warren: $0
Kentucky: $35,000
Boone: $0
Campbell: $35,000
Kenton: $35,000
Number of Households Surveyed (Output as example only)
Pensylvania: 4
Hamilton: 2
Butler: 1
Clermont: 1
Warren: 0
Kentucky: 3
Boone: 0
Campbell: 2
Kenton: 1
Imports System.Math
Imports System
Public Class Form1
Private arrayIncome(,) As String
Dim i As Integer = 0
Dim j As Integer = 0
Dim ran As Random = New Random()
Dim id As Integer
Dim avgSalaryResult As String
Dim countyResult As String
Dim stateCount As Integer
Dim countyCount As Integer
Private Sub btnExit_Click(sender As Object, e As EventArgs) Handles
btnExit.Click
Me.Close()
End Sub
Private Sub btnAvgIncome_Click(sender As Object, e As EventArgs)
Handles btnAvgIncome.Click
Dim totalSalary As Integer = 0
Dim countySalary As Integer = 0
Dim avgSalary As Integer
Dim countyName As String
Dim totalSurveyed As Integer
Dim diffState As String = String.Empty
For iValue As Integer = 0 To i - 1
Dim tempState As String
tempState = arrayIncome(iValue, 0).Substring(arrayIncome(iValue,
0).LastIndexOf(",") + 1)
If Not diffState.Contains(tempState) Then
diffState = diffState + "," + tempState
End If
Next
diffState = diffState.Trim()
diffState = diffState.Trim(",")
Dim processedCounty As String = String.Empty
For iValue As Integer = 0 To diffState.Split(",").Length
Dim st As String = String.Empty
Dim county As String = String.Empty
st = diffState.Split(",")(iValue)
arrayIncome(iValue, 0).Substring(arrayIncome(iValue,
0).LastIndexOf(",") + 1)
For jValue As Integer = 0 To i - 1
If st = arrayIncome(jValue, 0).Substring(arrayIncome(jValue,
0).LastIndexOf(",") + 1) Then
totalSalary = totalSalary + arrayIncome(jValue, 1)
county = arrayIncome(jValue, 0).Substring(0, arrayIncome(jValue,
0).LastIndexOf(","))
If Not county.Contains(processedCounty) Then
processedCounty = processedCounty + "," + county
For kValue As Integer = 0 To i - 1
countyCount = countyCount + 1
If county = arrayIncome(kValue, 0).Substring(0, arrayIncome(kValue,
0).LastIndexOf(",")) Then
countySalary = countySalary + arrayIncome(kValue, 1)
countyCount = countyCount + 1
countyName = arrayIncome(kValue, 0).Substring(0,
arrayIncome(kValue, 0).LastIndexOf(",")) + ": " + countySalary +
"/n"
Else
countySalary = arrayIncome(kValue, 1)
countyName = arrayIncome(kValue, 0).Substring(0,
arrayIncome(kValue, 0).LastIndexOf(",")) + ": " + countySalary +
"/n"
End If
county = arrayIncome(jValue, 0).Substring(0, arrayIncome(kValue,
0).LastIndexOf(","))
Next
End If
stateCount = stateCount + 1
countyCount = 0
countyResult = countyResult + countyName
End If
Next
avgSalary = totalSalary \ stateCount
avgSalaryResult = st + avgSalary.ToString() + "\n"
Next
End Sub
Private Sub btnSubmit_Click(sender As Object, e As EventArgs)
Handles btnSubmit.Click
arrayIncome(i, j) = txtIncome.Text REM (0,0)
arrayIncome(i, ++j) = txtCounty.Text() REM (0,1)
i = i + 1
j = j + 1
id = ran.Next(1000, 9999)
txtId.Text = id.ToString()
txtCounty.Text = ""
txtIncome.Text = ""
End Sub
Private Sub Form1_Load(sender As Object, e As EventArgs) Handles
MyBase.Load
id = ran.Next(1000, 9999)
txtId.Text = id.ToString()
End Sub
End Class
Problem Statement You are to create a Visual Basic(VB) project for a census bureau to obtain...
Design a project in C to collect household information for a census bureau which should obtain and analyze household information within the Greater Toronto Area. Data Collected: • Date of collection of data using MM/DD/YYYY format • Regions: o Peel o York o Durham • Towns – required o For Peel Brampton Mississauga o For York Maple Vaughan o For Durham Whitby Oshawa • Race of head of household – required (Caucasian, Indigenous, African American, Asian, Other) • Number of...
Must be done in C# please! Thanks! In this assignment you will create a program named Test Scores that displays the average of all tests; average midterm score; average final score; and displays the midterm or final score of a particular student. Create a class level two dimensional integer array named Grades initialized with the following data: 897 242 301 987 116 450 865 128 992 109 88 75 94 70 90 87 81 79 97 79 78 80 92...
***PLEASE AVOID USING A "CLASS" IN SOLUTION*** thank you. Please use Visual Studio to write a C# program to allow user to store contact information. 1. User should be able to type in name, E-mail and phone number in the text boxes and click Add button to save the contact record. Every time when user add record, user should be able to see all the information displayed in the right side display text box. (allow up to 10 records) 2....
could you please help me with this problem, also I need a little text so I can understand how you solved the problem? import java.io.File; import java.util.Scanner; /** * This program lists the files in a directory specified by * the user. The user is asked to type in a directory name. * If the name entered by the user is not a directory, a * message is printed and the program ends. */ public class DirectoryList { public static...