DECLARE SUB ReadData (name1$, old1!, new1!, name2$, old2!, new2!, name3$, old3!, new3!, name4$, old4!, new4!) DECLARE SUB ShowGrowth (name1$, old1!, new1!, name2$, old2!, new2!, name3$, old3!, new3!, name4$, old4!, new4!) DECLARE FUNCTION PctGrowth! (oldVal!, newVal!) REM **************************************************************** REM Barb Meester REM Chapter 4, Programming Project # 3, Page 140 REM File name: softdrks REM Date submitted: 02/13/01 REM ***************************************************************** REM REM Percentage growth of major beverage companies REM CLS REM ***********PRINT MAJOR HEADING********************************** REM PRINT PRINT " PERCENT OF GROWTH FOR MAJOR COMPANIES" PRINT " 1991-1992" PRINT PRINT REM ***********CALLS SUBROUTINES AND FUNCTION************************ REM ****Subroutine ReadDate will read all of the data from the main routine REM ****Subroutine ShowGrowth will print report REM ****Function PctGrowth will compute the amount of growth as a percent REM CALL ReadData(name1$, old1, new1, name2$, old2, new2, name3$, old3, new3, name4$, old4, new4) CALL ShowGrowth(name1$, old1, new1, name2$, old2, new2, name3$, old3, new3, name4$, old4, new4) REM REM --- Data: company name, 1991 revenues, 1992 revenues REM DATA PepsiCo, 19292, 21970, Coca-Cola Company, 11572, 13074 DATA A&W Brands, 123, 130, Snapple Beverage Corp., 95, 232 END FUNCTION PctGrowth (oldVal, newVal) PctGrowth = 100 * (newVal - oldVal) / oldVal END FUNCTION SUB ReadData (name1$, old1, new1, name2$, old2, new2, name3$, old3, new3, name4$, old4, new4) REM Read Information READ name1$, old1, new1, name2$, old2, new2, name3$, old3, new3, name4$, old4, new4 END SUB SUB ShowGrowth (name1$, old1, new1, name2$, old2, new2, name3$, old3, new3, name4$, old4, new4) REM Compute growth percentage of four companies PRINT "Company"; TAB(23); " Percent growth " PRINT PRINT name1$, TAB(30); PRINT USING "###.##%"; PctGrowth(old1, new1) PRINT name2$, TAB(30); PRINT USING "###.##%"; PctGrowth(old2, new2) PRINT name3$, TAB(30); PRINT USING "###.##%"; PctGrowth(old3, new3) PRINT name4$, TAB(30); PRINT USING "###.##%"; PctGrowth(old4, new4) END SUB