Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Old Program
#1
I must have made this program about 3 or so years ago when I was first learning QuicBasic.  I already see some small bugs in it but w/e here it is.

Code:
'*****************************************************************************
'*****************************************************************************
'**                                                                         **
'**                         Programmer: Jon Brown                           **
'**                                                                         **
'**                          Program Objective:                             **
'**                                                                         **
'**      To Calculate how much on average a freelancer makes per hour       **
'**                                                                         **
'**                                                                         **
'**                                                                         **
'**                                                                         **
'**                                                                         **
'*****************************************************************************
'*****************************************************************************

'/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/
'/\                        Creating all of the gosubs                        /
'/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/                                                                          /

CLS
GOSUB A100.Initialize
GOSUB B100.CreateMenu
GOSUB C100.WrapUp
END

'/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/
'/\                              Create Variables                            /
'/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/

A100.Initialize:
RandomMoney = 0
Name$ = ""
hours = 0
AmountEarned = 0
code% = 0
AmountMinusRandom = 0
Contin$ = ""
RETURN

'/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/
'/\                             Create Menu                                  /
'/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/
B100.CreateMenu:
        CLS
        LOCATE 2, 36: PRINT "Freelancers"
        LOCATE 4, 34: PRINT "Code"
        LOCATE 4, 42: PRINT "Function"
        LOCATE 5, 34: PRINT "----"
        LOCATE 5, 42: PRINT "--------"
        LOCATE 6, 35: PRINT "1"
        LOCATE 7, 35: PRINT "2"
        LOCATE 6, 42: PRINT "Run Program"
        LOCATE 7, 42: PRINT "Exit Program"
        LOCATE 9, 20: INPUT "Enter the code to perform the specified function. ", code%
        IF code% = 1 THEN
                GOSUB B200.Algorithm
        END IF
        IF code% = 2 THEN
                GOSUB C100.WrapUp
        END IF

RETURN

'/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/
'/\                             Coding The Algorithm                         /
'/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/

B200.Algorithm:
        CLS
        LOCATE 2, 24: INPUT "Amount of money earned ==> ", AmountEarned
        LOCATE 3, 24: INPUT "Hours worked ==> ", hours
        LOCATE 4, 24: INPUT "Other Expenses ==> ", RandomMoney
        AmountMinusRandom = AmountEarned - RandomMoney
        IF hours = 0 THEN
                hours = 1
        END IF
        MoneyPerHour = AmountEarned / hours
        LOCATE 6, 24: PRINT "Amount Earned after your other expenses ==>"; AmountMinusRandom
        LOCATE 7, 24: PRINT "Money made per hour ===>"; MoneyPerHour;
        LOCATE 9, 24: INPUT "Do you Wish to run program again (Y/N)"; Contin$
        Contin$ = UCASE$(Contin$)
        IF Contin$ = "Y" THEN
                GOSUB B200.Algorithm
        END IF
        IF Contin$ = "N" THEN
                GOSUB C100.WrapUp
        END IF
RETURN

'/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/
'/\                                 WrapUp                                   /
'/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/

C100.WrapUp:
        CLS
        LOCATE 2, 25: PRINT "Program All done"
RETURN
Reply
#2
So, do you have a question on it?  Tell us what you are having problems with, and if you need help...
Ralph, using QuickBASIC 4.5 and Windows XP Home Edition and Service Pack 2, with HP LaserJet 4L printer.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)