For this problem I need to have the user input a number and in return receive the Name, current salary and new salary of the teacher. I've tried something like this
Dim Names(10)as String
Dim Yos(10) as Integer
Dim Sal(10) as Integer
Dim Nsal(10) as Integer
Dim Rate(10) as Integer
Teachers = 2
Teacher_Num = 0
Dim Number as Integer
Dim Answer as String
PRINT " Congrats! 10 of you have been chosen to receive a raise in your salary :D. Please follow instructions below :)."
For Count = 1 To Teachers
Teacher_Num = Teacher_Num + 1
Print "Your number is:",Teacher_Num
Input " Nice to meet you! What's your name? :D ",Names(10)
Input " How many years have you serve here :O?",Yos(10)
Input "What is your current Salary?",Sal(10)
IF Sal(10) > 1 then
Rate(10)= (Yos(10) * 2) +100
Nsal(10) = Rate(10) * (Sal(10))/100
Print " Your name is: ",Names(10)
Print " Your Previous Salary was: ",Sal(10)
Print " Your New Salary is: ",Nsal(10)
Print " Thank you for your time :D, Please allow the next user to begin. (*Dear new user, Please press enter to begin*)"
End If
If Count = Teachers Then
Input "Would you like to see a specific name and current salary of a teacher or yourself?",Answer
If Answer = "Yes" or Answer = "yes" Then
Input "Please input the Teacher's Number",Number
Print "Here's your information: ",Names(Number),Sal(Number),Nsal(Number) `Else`
If Answer = "No" OR Answer = "no" Then
End If
End If
End If
Sleep
Next
End
But it doesn't work (The link below shows the error) Please someone help! This is for an Sba...My teacher wanted my class to input grades a while ago but no one knows how to do this so know one submitted... I've been trying to do this for days but we were never taught much about arrays :(
The first problem is that
Names(10),Rate(10), etc. should beNames(Count),Rate(Count), etc.As
Countgoes from 1 to 10, you want to be using that slot in the arrays. Each time your FOR...NEXT block loops,Names(Count)will resolve toNames(1),Names(2),Names(3)...Names(10).Second Issue
Yos,Sal,Nsal, andRateshould be defined asDoubleinstead ofInteger. Integers won't calculate decimals and so you'll lose precision when calculating the new salary (If I enter 30000 as my salary for one year, it shows -202 instead of 30600). If you intend to round to the nearest dollar, then use doubles for precision andCINT()to round to the nearest integer: