Question

This is Visual Basic program, thank you for your help In this assignment, you'll start a...

This is Visual Basic program, thank you for your help

In this assignment, you'll start a new Windows Forms application.
Assume we have the data shown below:
Names_first={"jack","marjy","tom","luke","sam","al","joe","miky","lu"}
Name_last={"jones","ety","fan","spence","amin",sid","bud","ant","ben"}
Amounts={234.45,8293.1,943.25,27381.0,271.39,7436.12,2743.0,1639.95,2354.2}

The above will allows us to emulate reading data from a file, which we will learn in the next unit.
For now, we will assume the data above has been read from a file.
We need to process this data in fast way. For that purpose, we need to:

  1. Declare three arrays on the global level, with the names shown above.
  2. Write code for the form load event handler. The handling code simply assigns the arrays to the values shown above.
  3. Write a handler code for a button named Show Balance, that asks the user to type in the client first name into an inputbox (and nothing else), then we search the names array then display the client's balance, or an error message if that client does not exist. Examples of code to search arrays can be found in the textbook.
  4. Write another handler code for another button named Show Bank Assets that displays via messagebox the sum of all balances in the balances array.
  5. Finally write another handler code that shows the client names (first and last name) of all those who have a balance under $500. Each name can appear in a message.
0 0
Add a comment Improve this question Transcribed image text
Answer #1

Screenshot

Quick Launch (Ctrl+Q) Help Window Start - deepthi.onganattu - D 1 . 1 BankApplicationInVb - Microsoft Visual Studio File Edit

Design

Quick Launch (Ctrl+Q) - 2 x deepthi.onganattu - D File Test BankApplicationInVb - Microsoft Visual Studio Edit View Project BCode

Public Class frmBankApplication
    'Global array declaration
    Dim Names_first(9) As String
    Dim Name_last(9) As String
    Dim Amounts(9) As Double
    'Form load initailize global array and always point into text box
    Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load
        'Initialize values into array
        Names_first = {"jack", "marjy", "tom", "luke", "sam", "al", "joe", "miky", "lu"}
        Name_last = {"jones", "ety", "fan", "spence", "amin", "sid", "bud", "ant", "ben"}
        Amounts = {234.45, 8293.1, 943.25, 27381.0, 271.39, 7436.12, 2743.0, 1639.95, 2354.2}
        txtfName.Select()
    End Sub
    'Loop through first name array and compare with text box value
    'If equal display balance
    'Otherwise error message
    Private Sub btnShowBalance_Click(sender As Object, e As EventArgs) Handles btnShowBalance.Click
        For i As Integer = 0 To Names_first.Length - 1
            If Names_first(i).CompareTo(txtfName.Text) = 0 Then
                txtfName.Text = ""
                MessageBox.Show("Balance of " + txtfName.Text + " is $" + CStr(Amounts(i)))
                Return
            End If
        Next
        txtfName.Text = ""
        MessageBox.Show("Error!!!" + txtfName.Text + " not found")
    End Sub
    'Loop through amounts array and find sum of assets in message box
    Private Sub btnBankAssets_Click(sender As Object, e As EventArgs) Handles btnBankAssets.Click
        Dim Balance As Double
        Balance = 0
        For i As Integer = 0 To Amounts.Length - 1
            Balance = Balance + Amounts(i)
        Next
        MessageBox.Show("Bank asset = $" + CStr(Balance))
    End Sub
    'Loop through aounts array to find less than 500 from amounts array
    'Return names of that asset persons
    Private Sub btnLessthan_Click(sender As Object, e As EventArgs) Handles btnLessthan.Click
        Dim names As String
        names = ""
        For i As Integer = 0 To Amounts.Length - 1
            If Amounts(i) < 500 Then
                names += Names_first(i) + " " + Name_last(i) + vbCrLf
            End If
        Next
        MessageBox.Show("First and last names:-" + vbCrLf + names)
    End Sub
    'Exit from application
    Private Sub btnExit_Click(sender As Object, e As EventArgs) Handles btnExit.Click
        Me.Close()
    End Sub
End Class

Add a comment
Know the answer?
Add Answer to:
This is Visual Basic program, thank you for your help In this assignment, you'll start a...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • In Java. Write a GUI contact list application. The program should allow you to input names...

    In Java. Write a GUI contact list application. The program should allow you to input names and phone numbers. You should also be able to input a name and have it display the previously entered phone number. The GUI should look something like the following, although you are welcome to format it in any way that works. This should be a GUI application with a JFrame. The program should contain two arrays of Strings. One array will contain a list...

  • Hi, I need help to finish this program. Thank you import java.io.FileNotFoundException; import javax.swing.JFrame; /** *...

    Hi, I need help to finish this program. Thank you import java.io.FileNotFoundException; import javax.swing.JFrame; /** * The Main class containing the main() and run() methods. */ public class Main {    public static void main(String[] pArgs) {    new Main().run(); } /** * The Roster of students that is read from the input file "gradebook.dat". */    ??? /** * A reference to the View object. */ ??? /** * This is where execution starts. Instantiate a Main object and...

  • In this lab assignment, you'll write code that parses an email address and formats the ci and zip...

    Using Microsoft Visual Studio C# In this lab assignment, you'll write code that parses an email address and formats the ci and zip code portion of an address. String Handling Email: nne@murach.com Parse City: Fresno State: ca Zp code: 93722 Format ให้ 2 Parsed String Formatted String User name: anne Domain name: murach.comm City, State, Zip: Fresno, CA 93722 OK OK Create a new Windows Forms Application named StringHandling and build the form as shown above. 1. Add code to...

  • Parallel Arrays Summary In this lab, you use what you have learned about parallel arrays to...

    Parallel Arrays Summary In this lab, you use what you have learned about parallel arrays to complete a partially completed Java program. The program should either print the name and price for a coffee add-in from the Jumpin’ Jive coffee shop or it should print the message: "Sorry, we do not carry that.". Read the problem description carefully before you begin. The data file provided for this lab includes the necessary variable declarations and input statements. You need to write...

  • Please run the program and show the result with screenshots after. Thank you (Java Eclipse) Customer...

    Please run the program and show the result with screenshots after. Thank you (Java Eclipse) Customer Data: Area Codes Assume you work for a company that tracks customer information, including name, gender and phone numbers Your company has a file called customers.txt which contains the following information: Jiming Wu F 4082123458 James Brown M 8315678432 Leanna Perez F 4087654433 Xing Li M 8313214555 Stacey Cahill O 8312123333 Mohammed Abbas M 4083134444 Kumari Chakrabarti F 4086667777 Shakil Smith M 4082123333 Jung...

  • The following form will be used to determine the sales commission of employees. Using Visual Basic...

    The following form will be used to determine the sales commission of employees. Using Visual Basic Studio, build the form with these features:  The checkbox “Target Met” must be disabled.  The title of the form should appear as “Sales Commissions” Write the code to do the following: After entering the totals sales, the checkbox will automatically be checked if the average sales per month was $1,500 or more. Note: The average sales per month can be calculated by...

  • I need help regarding my Visual Basic code ISC/ITE 285 Homework Due: Monday, January 28 by...

    I need help regarding my Visual Basic code ISC/ITE 285 Homework Due: Monday, January 28 by 11:55 pm Create a text file named "Grades.txt" which will contain a list of numeric grades. Save the file in the projects Bin/Debug folder. A sample of the file contents is shown below: 80 96 95 86 54 97 Create a string array that will be populated from the file "Grades.txt" when the array is created (Class-level array). Also create a numeric array that...

  • Write you code in a class named HighScores, in file named HighScores.java. Write a program that...

    Write you code in a class named HighScores, in file named HighScores.java. Write a program that records high-score data for a fictitious game. The program will ask the user to enter five names, and five scores. It will store the data in memory, and print it back out sorted by score. The output from your program should look approximately like this: Enter the name for score #1: Suzy Enter the score for score #1: 600 Enter the name for score...

  • C++ with Pseudocode in the beginning This assignment will require you to write a program that...

    C++ with Pseudocode in the beginning This assignment will require you to write a program that will create an array of 10 string objects. The array will be initialized with the strings which contain the person’s name and phone number in one string. The following is an example of test data: “Renee Javens, 678-1223”, “Joe Looney, 586-0097”, “Geri Palmer, 223-8787”, “Lynn Presnell, 887-1212”, “Bill Wolfe, 223-8878”, “Sam Wiggins, 486-0998”, “Bob Kain, 586-8712”, “Tim Haynes, 586-7676”, “John Johnson, 223-9037”, “Jean James,...

  • C Program Assignment: 2-Add comments to your program to full document it by describing the most...

    C Program Assignment: 2-Add comments to your program to full document it by describing the most important processes. 3-Your variables names should be very friendly. This means that the names should have meaning related to what they are storing. Example: Instead of naming the variable that stores the hours worked for an employee in a variable called ‘x’ you should name it HoursWorked. 5-Submit your .c program (note that I only need your source code and not all files that...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT