none
structures and array help.. on visual basic 2010 RRS feed

All replies

  • Very sorry - I don't do homework assignments.

    However, if you make a decent stab at a question, I will assist you with specific difficulties you encounter, and will attempt to explain concepts you are struggling with.


    "Premature optimization is the root of all evil." - Knuth

    If I provoked thought, please click the green arrow

    If I provoked Aha! please click Propose as Answer

    We are here to learn, to share knowledge, and to earn points; all in about equal measure.

    Friday, December 7, 2012 11:00 PM
  • No no im not asking for answers sorry should have been clearer.. here is what i have so far

    Structure Employee

    Dim Firstnamestring As String

    Dim Lastnamestring As String

    Dim Identificationnumberstring As String

    Dim Jobtitlestring As String

    Dim SalaryDecimal As Decimal

    Dim BenefitsString As String

    Dim DaysoffDecimal() As Decimal

    End Structure

    I feel its correct but im having trouble on the array part.

    Friday, December 7, 2012 11:05 PM
  • mr.evo1 :

    Hope the below gives you a start with structure/array

    Imports System.IO

    Module Module1
        Public Structure Employee
            Public fName As String
            Public lName As String
            Public Id As String
            Public jobTitle As String
            Public salary As Decimal
            Public benefits As String
            Public daysoff As Decimal
            Public Sub New(ByVal pfName As String, ByVal plName As String, ByVal pId As String, ByVal pjobTitle As String, ByVal psalary As Decimal, ByVal pbenefits As String, ByVal pdaysoff As Decimal)
                fName = pfName
                lName = plName
                Id = pId
                jobTitle = pjobTitle
                salary = psalary
                benefits = pbenefits
                daysoff = pdaysoff
            End Sub

        End Structure
        Sub Main()

            Dim empArrayDeclaration() As Employee = New Employee(1) {}
            empArrayDeclaration(0).fName = "evo"
            Dim empArray() As Employee = {New Employee("evo1", "test", "ID100", "Coder", 99999.99, "401K", 15.0), New Employee("evo2", "test", "ID100", "Coder", 99999.99, "401K", 15.0)}

            For Each emp In empArray
                Console.WriteLine(" Fname={0}, Lname = {1} ,ID = {2} , Title ={3} ,Salary = {4} ,Benefits ={5},days off = {6}", emp.fName, emp.lName, emp.jobTitle, emp.Id, emp.salary, emp.benefits, emp.daysoff)
            Next
        End Sub
    End Module

    Saturday, December 8, 2012 12:22 AM