Professor A. Ebrahimi
Visual Basic

2/2/06

Shahezad Contractor

Page 44 - First version of the Invoice Program

Compare the payroll program from the last class to the invoice program.

INPUT COMPARISON

 

  Payroll Program Invoice Program
Input Variable employeeid itemid
Input Variable hoursworked quantity
Input Variable hourlyrate unitprice
Process grosspay subtotal
Part of the program (known) TAXRATE SALESTAX
Process taxamount taxamount
Process netpay totalprice

*TAXRATE and SALESTAX is a fixed amount, therefore it is a constant

Nassau County Sales Tax 8.625%

Chapter 2 talks about Input, Process, Output (IPO)

Input= Enter to program
Process= Computation, Calculation,
Output = Outcome, Display out

IPO is a food processor

Input = vegetables
Process = Choose process Grind
Output= Juice Shake

In Visual Basic every variable must be declared and the data type must be known.

The keyword dim is used to declare an identifier (variable) and the keyword integer used for the whole number, keyword single or double used for fractions.

integer = 40 hours

Single & Double = 6.50 dollars

The difference between a single and a double is the way you request the memory small or big.


For the convention always use lower case and you should not use spaces

 

dim itemid, quantity as integer
dim unitprice, subtotal as single
const SALESTAX as single = 0.08625

itemid = Inputbox ("Please enter the Item ID")
quantity = Inputbox ("Please enter the Quantity")
unitprice = Inputbox ("Please enter the Unit Price")

subtotal = quantity * unitprice
taxamount = subtotal * SALESTAX
totalprice = subtotal + taxamount

msgbox ("The Item's ID is" &itemid)
msgbox ("The Quantity is" &quantity)
msgbox ("The Unit Price is" &unitprice)
msgbox ("The SubTotal is" &subtotal)
msgbox ("The Tax Amount is" &taxamount)
msgbox ("The Total Price is" &totalprice)

 

 

Akibu, Hakeem O. +1
Alagheband, Shadi C. +1
Colon, Christen N. +2
Contractor, Shahezad M. +5
Francoeur, Ralph J. +1
Ghazanchyan, Farideh +1
Guo, Sunli +1
Halajian, Alishan A. +2
Hicks, Raheem  
Hicks, Rory  
Nemati, Matthew +1
Paul, My-Kerline  
Saeed, Amna +1
Saeed, Asma +1