Jump to content

Welcome to Geeks to Go - Register now for FREE

Need help with your computer or device? Want to learn new tech skills? You're in the right place!
Geeks to Go is a friendly community of tech experts who can solve any problem you have. Just create a free account and post your question. Our volunteers will reply quickly and guide you through the steps. Don't let tech troubles stop you. Join Geeks to Go now and get the support you need!

How it Works Create Account
Photo

help in declaring variables.


  • Please log in to reply

#1
grifter2420

grifter2420

    New Member

  • Member
  • Pip
  • 3 posts
I am an online student which has its flaws in learning. I have asked (emailed and posted in the threads) a question regarding Visual Logic. I have browsed through visual logic questions posted here and realize that no help for homework is a rule. I ask not so much for help doing my work as much as I ask in simply declaring a letter as a readable variable.

I have an assignment that is to create a program that figures out base pay, OT pay, and taxes depending on tax bracket. I have the structure set right with all the proper "If conditions". The thing is that none of my conditions trigger. They are supposed to trigger when entering the letter corresponding with the tax status: Married, Divorced, Single, Widowed. No matter what I have done, the conditions always trigger to the false side of the conditions.

Input: (taxBracket)Please indicate if your filing status is M (married), S (single), D (divorced), W (widowed)

If (taxBracket = M) (this is how my condition is written)
then taxes = .15 * totalSal
If taxBracket = S
then taxes = .22 * totalSal
etcetc


Now, I know my structure is set because when I change the if conditions to numbers it always triggers the right conditions

If taxBracket = .15
then taxes = .15 * totalSal
If taxBracket = .22
then taxes = .22 * totalSal
  • 0

Advertisements


#2
grifter2420

grifter2420

    New Member

  • Topic Starter
  • Member
  • Pip
  • 3 posts
Here's some screenshots to show what I got and the command execution. At the end of the screenshots you will see how it doesn't work with letter variables but it works with number variables in the If conditions.


Any help on correcting this flaw would be much appreciated.

Attached Thumbnails

  • vl1.PNG
  • vl2.PNG
  • vl3.PNG
  • vl5.PNG
  • vl6.PNG
  • vl7.PNG

  • 0

#3
grifter2420

grifter2420

    New Member

  • Topic Starter
  • Member
  • Pip
  • 3 posts
Haha, nevermind guys. I just needed a break away from it to figure it out.
Had to declare each letter as a variable for itself before the tax portion ran.
Works like a charm now.

Attached Thumbnails

  • vl8.PNG

  • 0






Similar Topics

0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users

As Featured On:

Microsoft Yahoo BBC MSN PC Magazine Washington Post HP