Qbasicnews.com
January 20, 2018, 05:42:58 PM *
Welcome, Guest. Please login or register.

Login with username, password and session length
News: Back to Qbasicnews.com | QB Online Help | FAQ | Chat | All Basic Code | QB Knowledge Base
 
   Home   Help Search Login Register  
Pages: [1]
  Print  
Author Topic: Old Program  (Read 3398 times)
Tia
Member
*
Posts: 37


« on: January 03, 2009, 07:12:49 AM »

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
Logged
Ralph
Ancient Guru
****
Posts: 544


« Reply #1 on: February 22, 2009, 02:46:37 PM »

So, do you have a question on it?  Tell us what you are having problems with, and if you need help...
Logged

Ralph, using QuickBASIC 4.5 and Windows XP Home Edition and Service Pack 2, with HP LaserJet 4L printer.
Pages: [1]
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.21 | SMF © 2015, Simple Machines Valid XHTML 1.0! Valid CSS!