
-----------------------------------
soulgnat
Wed Jan 21, 2004 3:22 pm

garage fee program...feel free to use
-----------------------------------
this is a program that will calculate garage fees..this is for my school project..:D thanx to lots of help for previous programs, i've done lots of programming! :D thanx :D :lol:  :D  :shock: 

Here is the code:

%Isabella Jawan
%30th September 2003
%This program will calculate the amount of parking charges that should be
%charged at the given amount of time

%----------------------------Program Listings--------------------------------
var answer: string                          %declares answer as string                                  
var totalminutes,minutes,fee,hours: real    %declares totalminutes,minutes,
                                            %fee and hours as real
var x:int                                   %declares x as integer
var totalfee:real                           %declares totalfee as real

locate (10,25)                              %locates items on given rows and
                                            %columns in brackets    
put "WELCOME to Bella's Garage"             %displays welcome message to user
locate (11,24)
put "~~Where your car belongs~~"
locate (20,30)
put "Loading..."                            %displays words in brackets
delay (1000)                                %delays next action by specified
                                            %thousandth of a second
cls                                         %clears screen

loop                                        %starts loop structure
    locate (1,1)
    put chr (201)                           %displays set character 
    locate (2,1)
    
    for i:1..22                             %starts nested counted loop 
        put chr (186)
    end for                                 %ends nested counted loop

    put chr (200)
    locate (1,2)                            %locates number of rows & columns
                                            %specified in brackets
    put repeat(chr(205),77)
    locate (1,78)
    put chr (187)
    x:=0                                    %x is initialized
   
    for i:1..22                             %starts nested counted loop
        x:=x+1                              %starts accumulator
        locate (1+x,78)
        put chr (186)
    end for                                 %ends nested counted loop
   locate (24,2)
    for i:1..76                             %starts nested counted loop
        put chr (205)..
    end for                                 %ends nested counted loop
    locate (24,78)
    put chr (188)
    delay (500)
    locate (2,33)
    put "Welcome!"                          %displays welcome message to user
    locate (1,30)
    put "BELLA'S GARAGE"                    %cuts and paste words onto output
                                            %screen
    locate (18,10)
    put "Please enter prompted information" 
    locate (18,45)
    put "below this line"                   %tells user where to enter needed 
                                            %information
    locate (19,2)
    for i:1..76
        put "-"..                           %puts a divider
    end for                                
    locate (19,5)
    put "HOW MANY"                          %displays words in quotes
    delay (200)
    locate (20,3)
    put "hours has your car been parked ? "..%prompts user to enter number of
                                            %hours car has been parked
    get hours                               %retrieves hours
    locate (20,3)   
    
    for i:1..50                             %starts nested counted loop
        put " "..
    end for                                 %ends nested counted loop
    if hours 0                  %exits when hours is more than 
                                            %0
      end loop                              %ends nested loop structure
    end if                                  %ends selection structure
    
    locate (4,4)
    put "Hours parked"                      %displays words in brackets on 
    locate (5,2)
    put repeat (chr (196),76)               %displays a divider
    locate (6,8)
    put hours                               %displays hours entered
    delay (200)
    locate (20,3)
    put "minutes has your car been parked?"..%prompts user to enter
                                            %the amount of minutes they 
                                            %they have parked their car
    get minutes                             %retrieves minutes entered
    locate (19,3)
        put "------------"                  %puts a divider
    locate (20,3)
    for i:3..30                             %starts nested counted loop
        put "  "..                          %clears the line
    end for                                 %ends nested counted loop
    
    if minutes 0                %exit condition for loop 
                                            %structure  
      end loop                              %ends nested loop structure    
    elsif minutes >59 then
     
     loop                                   %starts nested loop structure
        locate (19,3)
        put "Please enter a number between"..%prompts user to enter a  
        put "0 and 59 :"..                  %number between 0 and 59
        get minutes                         %retrieves minutes 
        locate (18,3)
        for i:2..35                         %starts nested counted loop
            put " "..
        end for                             %ends nested counted loop
        exit when minutes 30 and minutes 