By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
459,491 Members | 1,196 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 459,491 IT Pros & Developers. It's quick & easy.

Visual Basic Beginner - Help!

P: 11
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!
Dec 7 '06 #1
Share this Question
Share on Google+
4 Replies


P: 30
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
Dec 7 '06 #2

P: 11
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!
Dec 7 '06 #3

P: 11
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!
Dec 7 '06 #4

LacrosseB0ss
100+
P: 113
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*regTime)+(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)+(baseWage*regTime)+(tHalfWage*xTime)

Hope this helps. Shouldn't take that long, it's fairly straight forward code.
- LB
Dec 7 '06 #5

Post your reply

Sign in to post your reply or Sign up for a free account.