Visual Basic Beginner - Help!

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • corky20
    New Member
    • Dec 2006
    • 11

    #1

    Visual Basic Beginner - Help!

    Can someone help...i've only started learning visual basic and i'm pretty new to programming(i know but everyones been there at one point) and need help with a question!

    A man is paid at the hourly rate of £8 per hour for the first 35 hours worked. Thereafter overtime is paid at time and a half for the next 10 hours and double time for further hours worked.
    Design and write a program to input the number of hours worked per week, calculate and print his gross weekly wage.


    I need to write a program for the above question and i'm having a few problems as i've only started learning repetitions!

    Any help would be appreciated!

    Thanks!
  • padhuwork
    New Member
    • Dec 2006
    • 30

    #2
    Originally posted by corky20
    Can someone help...i've only started learning visual basic and i'm pretty new to programming(i know but everyones been there at one point) and need help with a question!

    A man is paid at the hourly rate of £8 per hour for the first 35 hours worked. Thereafter overtime is paid at time and a half for the next 10 hours and double time for further hours worked.
    Design and write a program to input the number of hours worked per week, calculate and print his gross weekly wage.


    I need to write a program for the above question and i'm having a few problems as i've only started learning repetitions!

    Any help would be appreciated!

    Thanks!
    Hi,
    I have the code.
    I m not able to attach the file here. Since I m a new member.
    Let me know your mail id, can send across the project file to you right away.
    Regards,
    Padhu

    Comment

    • corky20
      New Member
      • Dec 2006
      • 11

      #3
      Hi there, thanks for the help!

      I have sent you a private msg with my email address!

      If you can email me the solution it would be great!!!

      thanks!

      Comment

      • corky20
        New Member
        • Dec 2006
        • 11

        #4
        If anyone else can help that would be great!

        I just need the code for the above problem...i wouldn't ask but it's urgent!

        I don't have a clue what i'm doing really...only started VB as part of my HND!

        Comment

        • LacrosseB0ss
          New Member
          • Oct 2006
          • 112

          #5
          I would first, work on assignments before they're due. That would help a lot. But since I'm a nice guy I'll give you some pointers. Keep in mind I'm not writing it for you.

          Step 1:
          Declare a variable to store the inputted time and 1 for his salary. Also store 8 in a public variable as this is the base wage.
          Public Const baseWage As Integer = 8
          Dim time as Integer = 0
          Public wage As Double = 0 (you'll see why this is public in a second)

          Step 2:
          Create sub functions to calculate the wage. One for hourly rate, one for time and a half, one for overtime.

          Step 3:
          Determine which function to call. If time < 36 then hourly. If time < 46 then timeHalf. Otherwise double.

          Your functions will have the following structure:
          hourly:
          salary = baseWage * time

          timeHalf:
          wage = baseWage + (baseWage/2)
          xTime = time-35
          regTime = time - xTime (should be 35)
          salary = (baseWage*regTi me)+(wage*xTime )

          double:
          wage = baseWage * 2
          tHalfWage = baseWage + (baseWage/2)
          oTime = time - 45
          xTime = time - oTime - 35
          regTime = time - oTime - xTime (should be 35)
          salary = (wage*oTime)+(b aseWage*regTime )+(tHalfWage*xT ime)

          Hope this helps. Shouldn't take that long, it's fairly straight forward code.
          - LB

          Comment

          Working...