0 Replies - 5115 Views - Last Post: 29 January 2010 - 01:47 PM Rate Topic: -----

#1 sharona10459  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 1
  • Joined: 29-January 10

More examples of Visual logic flowcharts

Post icon  Posted 29 January 2010 - 01:47 PM

Declare Integer Employees
Declare Constant Integer Max_value = 250
Declare String employeesName
Declare Real hoursWorked
Declare Real hourlyPayRate
Declare Real grossPay
Declare Real overtimeHrsWorked
Declare Real overtimePay
Declare Real tax
Declare Real netPay
Call displayOpeningMessage
Call getInput
Call calculateGrossPay
Call calculateOvertimePay
Call calculateTax
Call calculateNetPay
Call displayOutput
Call displayClosingMessage

Module displayOpeningMessage
Display "Pay Calculator"
Display "Enter the values to calculate the gross pay of an employee"
End Module

Module getInput
Display "Please enter employee's name."
Input employeesName
Display "Please enter number of hours the employee worked."
Input hoursWorked
Display "Please enter employee's hourly pay rate."
Input hourlyPayRate
End Module

Module calculateGrossPay
Set grossPay = hoursWorked * hourlyPayRate
End Module

Module calculateOvertimePay
If hoursWorked>40 Then
overtimeHrsWorked = hoursworked - 40
overtimePay = (hoursWorked * (hourlyPayRate * 1.5)
End Module

Module calculateTax
If grossPay < 1500 Then
tax = .15 * grossPay
Else If grossPay >= 1500 And If grossPay <3000 Then
tax = .19 * grossPay
Else If grossPay >= 3000 And If grossPay <4500 Then
tax = .21 * grossPay
Else If grossPay >= 4500 And If grossPay <6000 Then
tax = .23 * grossPay
tax = .27 * grossPay
End Module

Module calculateNetPay
netPay = grossPay + overtimePay – tax
End Module

Module displayOutput
Display “The Employees Name is: “ + employeesName
Display “Hours worked: “ + hoursWorked
Display “Hourly pay rate: $ “ + hourlyPayRate
Display “Gross pay: $ “ + grossPay
Display “Tax: $ “ + tax
Display “Net pay: $ “ + netPay
End Module

Module displayClosingMessage
Display “Thank you for using the Pay Calculator.”
Display “Press any key to quit Pay Calculator.”
End Module

My question is "Is this the way it should look or am I missing something? In visual logic they don't give you examples similar to what we have to code. I am very new at this and I am feeling rather overwhelmed by this class. I love the idea of being able to code almost anything but I'm not sure how things should look. I have bought numerous books on different languages but they don't offer anything in the way of good examples. Is there a beginning programming book that you could recommend that has vast examples for me to follow or get an adequate idea of how to do something in that fashion. I don't want anyone to do my homework for me but how can I learn to do this if there is not structure example for me to get any info from. I'm so frustrated with this class that I'm on the edge of calling it quits. It's not even a programming class yet, it's called logic and design, a pre-class to pre-programming. What will I do when I have to actually code? Someone please help me?

Is This A Good Question/Topic? 0
  • +

Page 1 of 1