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

Didn\'t have time to do program for class because of emergency, and need it ASAP

ID: 3547624 • Letter: D

Question

Didn't have time to do program for class because of emergency, and need it ASAP, thank you !


The assignment is to write a menu driven program that manages a small business inventory, collection or list. You pick the topic!!! The focus of your program is up to you.

The Menu commands must include:

    P....Display all records (on the screen/monitor)

    S....Create a current report (save it to a file)

    A....Add a new entry

    D....Delete an item from the list (inventory)

    C....Clear all records

    Q...Quit

You must add (1) additional menu option that you choose. It may be a menu option that allows the inventory to be modified. i.e. add inventory quantities, change price/cost, change dates, etc.

Explanation / Answer

Assume that names and phone numbers of all members are stored in alphabetical order in the text file MEMBERPHONES.TXT (available in DocSharing).


The names and phone numbers should be read into an array of structures and then displayed in a listbox when the form is loaded.


When a name is XXXXX XXXXX the name and phone number should appear in the textboxes at the bottom of the screen.


To delete a person highlight a name and click on delete from the menu.


To change a name or phone number click on the modify menu item


To add a new member type the name and phone number into the textboxes and click the add menu item.


When exit is clicked the new membership list should be written to the file and the program should terminate.



There is a menu strip control with one control named Update with modify, add, delete below it. Exit is another control name. There is also a list box to display everything and two labels and text boxes for name and phone number. This is the text file below:

XXXXX, XXXXX

(NNN) NNN-NNNN/p>

XXXXX, XXXXX

(NNN) NNN-NNNN/p>

Nixon, Mike

(NNN) NNN-NNNN/p>

Norton, Herbert

(NNN) NNN-NNNN/p>

Preiss, Carol

(NNN) NNN-NNNN/p>

Ree, Alice

(NNN) NNN-NNNN/p>

XXXXX, XXXXXos

(NNN) NNN-NNNN/p>

XXXXX, XXXXX

(NNN) NNN-NNNN/p>






Imports System.IO

Public Class frmMembership


Class Member

Public Name As String

Public Phone As String

End Class

Dim memberList As New List(Of Member)

Private Sub frmMembership_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load

Dim sr As IO.StreamReader = IO.File.OpenText("MEMBERPHONES.TXT")

Do While (sr.Peek <> -1)

Dim th As New Member

th.Name = sr.ReadLine

th.Phone = sr.ReadLine

memberList.Add(th)

Loop

sr.Close()

For j As Integer = 0 To memberList.Count - 1

lstMembership.Items.Add(memberList(j).Name)

Next

End Sub

Private Sub lstMembership_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles lstMembership.SelectedIndexChanged

txtName.Text = memberList(lstMembership.SelectedIndex).Name

txtPhone.Text = memberList(lstMembership.SelectedIndex).Phone

End Sub


Private Sub mnuUpdateMod_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles mnuUpdateMod.Click

memberList(lstMembership.SelectedIndex).Name = txtName.Text

memberList(lstMembership.SelectedIndex).Phone = txtPhone.Text

RefreshLstInfo()

End Sub



Private Sub mnuUpdateAdd_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles mnuUpdateAdd.Click

Dim NewPerson As New Member

NewPerson.Name = txtName.Text

NewPerson.Phone = txtPhone.Text

memberList.Add(NewPerson)

RefreshLstInfo()

End Sub

Private Sub mnuUpdateDel_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles mnuUpdateDel.Click

memberList.RemoveAt(lstMembership.SelectedIndex)

RefreshLstInfo()

End Sub

Private Sub mnuExit_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles mnuExit.Click

Application.Exit()

End Sub

Private Sub RefreshLstInfo()

lstMembership.Items.Clear()

For j As Integer = 0 To memberList.Count - 1

lstMembership.Items.Add(memberList(j).Name)

Next

End Sub

End Class



HiCustomer
Here is the code......



Imports System.IO

Public Class Form1



Class Member

Public Name As String

Public Phone As String

End Class

Dim memberList As New List(Of Member)

Private Sub frmMembership_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load

Dim sr As IO.StreamReader = IO.File.OpenText("c:MEMBERPHONES.TXT")

Do While (sr.Peek <> -1)

Dim th As New Member

th.Name = sr.ReadLine

th.Phone = sr.ReadLine

memberList.Add(th)

Loop

sr.Close()

For j As Integer = 0 To memberList.Count - 1

lstMembership.Items.Add(memberList(j).Name)

Next

End Sub

Private Sub lstMembership_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles lstMembership.SelectedIndexChanged

txtName.Text = memberList(lstMembership.SelectedIndex).Name

txtPhone.Text = memberList(lstMembership.SelectedIndex).Phone

End Sub



Private Sub mnuUpdateMod_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles mnuUpdateMod.Click

memberList(lstMembership.SelectedIndex).Name = txtName.Text

memberList(lstMembership.SelectedIndex).Phone = txtPhone.Text

RefreshLstInfo()

End Sub





Private Sub mnuUpdateAdd_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles mnuUpdateAdd.Click

Dim NewPerson As New Member

NewPerson.Name = txtName.Text

NewPerson.Phone = txtPhone.Text

memberList.Add(NewPerson)

RefreshLstInfo()

End Sub

Private Sub mnuUpdateDel_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles mnuUpdateDel.Click

memberList.RemoveAt(lstMembership.SelectedIndex)

RefreshLstInfo()

End Sub

Private Sub mnuExit_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles mnuExit.Click

Application.Exit()

End Sub

Private Sub RefreshLstInfo()

lstMembership.Items.Clear()

For j As Integer = 0 To memberList.Count - 1

lstMembership.Items.Add(memberList(j).Name)

Next

End Sub


End Class



Hope, this would help you out...



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