ComputerScienceExpert

(11)

$18/per page/

About ComputerScienceExpert

Levels Tought:
Elementary,Middle School,High School,College,University,PHD

Expertise:
Applied Sciences,Calculus See all
Applied Sciences,Calculus,Chemistry,Computer Science,Environmental science,Information Systems,Science Hide all
Teaching Since: Apr 2017
Last Sign in: 12 Weeks Ago, 3 Days Ago
Questions Answered: 4870
Tutorials Posted: 4863

Education

  • MBA IT, Mater in Science and Technology
    Devry
    Jul-1996 - Jul-2000

Experience

  • Professor
    Devry University
    Mar-2010 - Oct-2016

Category > Programming Posted 02 May 2017 My Price 9.00

Galaxy Trekkers assignmenT

I am having a major problem with my visual basic community app. and I will not be able to complete my Galaxy Trekkers assignment, I have attached the assignments instructions and the completed code for the assignment i just need some help finishing the assignment. If you are able help can you make sure the finished product is in a visual basic zip file.  

 

Public Class Form1
Structure Members
Public Id As String
Public LastName As String
Public FirstName As String
Public MiddleIntial As String
Public Grade As String
Public ClassString As String End Structure
Private Member(250) As Members
Dim Students As String
Dim Record As String
Dim newLineIndex As Integer
Dim newIndex As Integer
Dim commaIndex As Integer
Private Sub Form1_Load(ByVal sender As System.Object,
ByVal e As System.EventArgs) Handles MyBase.Load
Dim MyFile As New FileInfo("StudentList.txt")
StudentsList.Items.Clear()
If MyFile.Exists() Then
LoadList()
Else
MessageBox.Show("error", "Error", MessageBoxButtons.OK,
MessageBoxIcon.Error)
End If End Sub
Private Sub LoadList()
Dim Id(10) As Members
Dim Index As Integer = 0
Students = My.Computer.FileSystem.ReadAllText("\StudentList.txt")
For subscript As Integer = 1 To 6
' Locate the newline character in the Students variable
newLineIndex = Students.IndexOf(ControlChars.NewLine, newIndex) ' Assigns a line from the Students variable to the Record variable
Record = Students.Substring(newIndex, newLineIndex - newIndex)
'Locate the comma in the Record Variable
commaIndex = Record.IndexOf(",", Index)
'Assigns ID , LastName, FirstName, MiddleInitial, Grade and ClassString to the
array
Member(subscript).Id = Record.Substring(0, commaIndex)
Index = commaIndex + 1
Member(subscript).LastName = Record.Substring(commaIndex + 1)
Member(subscript).FirstName = Record.Substring(commaIndex + 1)
Member(subscript).MiddleIntial = Record.Substring(commaIndex + 1)
Member(subscript).Grade = Record.Substring(commaIndex + 1)
Member(subscript).ClassString = Record.Substring(commaIndex + 1)
'Add items to the listBox
StudentsList.Items.Add(Member(subscript).Id)
StudentsList.Items.Add(Member(subscript).LastName)
StudentsList.Items.Add(Member(subscript).FirstName)
'update the newIndex
newIndex = newLineIndex + 5
Next subscript
End Sub
Private Sub exitButton_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles exitButton.Click
Me.Close()
End Sub
End Class

Chapter 9 – Case 2 Galaxy Trekkers Figure 1 Instructions
In this case, you will create a Visual Basic solution that displays the Galaxy Trekkers club membership. This
program uses an array of structures to hold membership information that is read in from a sequential file. You will
use a graphic file and a text data file with the instructions below.
Step 1: Create the Project:
Create a Visual Basic Project using the project name “GalaxyTrekkers”.
Step 2 – Design the Form:
Design the form as shown in Figure 1. You will need one button control, one list box, and one picture box. Load
the downloaded galaxy.jpg image into the picture box.
Step 3 – Add the text file to the project:
Copy the downloaded text file to the GalaxyTrekkers folder using Windows Explorer. In the VB.Net IDE, click on
the Project menu and select Add existing item. Browse to the GalaxyTrekkers folder. In the File Type combo at
the bottom of the Add Existing dialog, select All Files. You will now see the downloaded file StudentList.txt. Select
it and click on Add. The text file will now appear in the Solution Explorer. By doing this, you are now able to view
the contents of the file within the IDE by double-clicking its name in Solution Explorer.
Look at the file contents. You will see that there are 6 fields for each record, separated by commas. The fields
are ID, last name, first name, middle initial, grade, and class period. These fields will need to be declared as
member variables in a structure. Treat all of these fields as type String.
Step 4 – Declare the form-level variables:
Declare a structure named Members that contains a member variable for each of the fields in the text file.
Declare an array of type Member with a size of 250.
Step 5 – Write a procedure to read the text file and load the list box:
Chapter 11 presented introduction (split function) that read the entire contents of a text file into memory and then
parsed out each record by searching for the occurrence of a delimiter. In this program, you will do that, but after
reading in one line of the text file, you must also break out the individual fields.
For each line in the text file, create a new structure of type Member, and load the individual member variables of
the structure with the values from the text file line. Then add that structure to the next available position in the
array of structures.
When the entire file has been read in and loaded into structures in the array, then load the list box by reading the
array. Only the ID, last name and first name fields will be loaded into the list box. See Figure 2 for details of how
the list box contents should appear.
Hints:
1 – Use a For loop to break out the fields in each line of the text file, because you know how many fields there
are. 2 – You will have to pad the ID field to a length of 10 to make the display in the list box look right.
Step 6 – Add code in the Form’s Load event:
Call the procedure created in Step 5 to load the data into the structure array and display the members in the list
box.
Step 7 – Finish up:
Be sure to add the code for the Exit button.
Step 8: Save and run
Save all files, then start the application. Figure 2 shows a sample run of this program. Figure 2

Attachments:

Answers

(11)
Status NEW Posted 02 May 2017 08:05 AM My Price 9.00

-----------

Attachments

file 1493712345-Solutions file 2.docx preview (51 words )
H-----------ell-----------o S-----------ir/-----------Mad-----------am ----------- Th-----------ank----------- yo-----------u f-----------or -----------you-----------r i-----------nte-----------res-----------t a-----------nd -----------buy-----------ing----------- my----------- po-----------ste-----------d s-----------olu-----------tio-----------n. -----------Ple-----------ase----------- pi-----------ng -----------me -----------on -----------cha-----------t I----------- am----------- on-----------lin-----------e o-----------r i-----------nbo-----------x m-----------e a----------- me-----------ssa-----------ge -----------I w-----------ill----------- be----------- qu-----------ick-----------ly -----------onl-----------ine----------- an-----------d g-----------ive----------- yo-----------u e-----------xac-----------t f-----------ile----------- an-----------d t-----------he -----------sam-----------e f-----------ile----------- is----------- al-----------so -----------sen-----------t t-----------o y-----------our----------- em-----------ail----------- th-----------at -----------is -----------reg-----------ist-----------ere-----------d o-----------n -----------THI-----------S W-----------EBS-----------ITE-----------. ----------- Th-----------ank----------- yo-----------u -----------
Not Rated(0)