From dc1c84da4d1135139e3f702d82104d71888a0af2 Mon Sep 17 00:00:00 2001 From: John Paul Wohlscheid Date: Tue, 2 Mar 2021 06:44:58 -0500 Subject: [PATCH] added a couple more exercises --- qb64/cascading-numbers.bas | 40 +++++++++++++++++++++++++++++++++++++ qb64/cascading-numbers2.bas | 29 +++++++++++++++++++++++++++ qb64/social-security.bas | 39 ++++++++++++++++++++++++++++++++++++ red/ask-age.red | 11 ++++++++++ 4 files changed, 119 insertions(+) create mode 100644 qb64/cascading-numbers.bas create mode 100644 qb64/cascading-numbers2.bas create mode 100644 qb64/social-security.bas create mode 100644 red/ask-age.red diff --git a/qb64/cascading-numbers.bas b/qb64/cascading-numbers.bas new file mode 100644 index 0000000..28ac2e6 --- /dev/null +++ b/qb64/cascading-numbers.bas @@ -0,0 +1,40 @@ +REM Cascading numbers +REM by John Paul Wohlscheid + +REM ask for numbers +PRINT "Please enter four numbers and watch the values cacade" +INPUT "Enter your first number: "; num1% +INPUT "Enter your second number: "; num2% +INPUT "Enter your third number: "; num3% +INPUT "Enter your fourth number: "; num4% + +ab% = num1% - num2% +cd% = num3% - num4% +finalnum% = ab% - cd% + +REM displaying numbers while using str$ to convert numbers to strings +CLS +PRINT STR$(num1%) + " " + STR$(num2%) + " " + STR$(num3%) + " " + STR$(num4%) +PRINT " \ / \ /" +PRINT " \ / \ /" +PRINT " \ / \ /" +PRINT " \ / \ /" +PRINT " \ / \ /" +PRINT +print " " + STR$(ab%) + " " + STR$(cd%) +PRINT +print " \ /" +PRINT " \ /" +print " \ /" +print " \ /" +PRINT " \ /" +PRINT " \ /" +PRINT " \ /" +print " \ /" +PRINT " \ /" +PRINT " \ /" +PRINT " \ /" +print " \/" +PRINT +print " " + STR$(finalnum%) +PRINT "==========================================================" \ No newline at end of file diff --git a/qb64/cascading-numbers2.bas b/qb64/cascading-numbers2.bas new file mode 100644 index 0000000..1580366 --- /dev/null +++ b/qb64/cascading-numbers2.bas @@ -0,0 +1,29 @@ +REM Cascading numbers 2.0 +REM by John Paul Wohlscheid + +REM ask for numbers +PRINT "Please enter twn numbers and watch the values cacade" +INPUT "Enter your first number: "; num1% +INPUT "Enter your second number: "; num2% +INPUT "Enter your third number: "; num3% +INPUT "Enter your fourth number: "; num4% +INPUT "Enter your fifth number: "; num5% +INPUT "Enter your sixth number: "; num6% +INPUT "Enter your seventh number: "; num7% +input "Enter your eighth number: "; num8% +INPUT "Enter your ninth number: "; num9% +INPUT "Enter your tenth number: "; num10% + +ab% = num1% - num2% +cd% = num3% - num4% +ef% = num5% - num6% +gh% = num7% - num8% +ij% = num9% - num10% +finalnum% = ab% - cd% + +REM displaying numbers while using str$ to convert numbers to strings +CLS +PRINT STR$(num1%) + " " + STR$(num2%) + " " + STR$(num3%) + " " + STR$(num4%) + " " + STR$(num5%) + " " + STR$(num6%) + + +PRINT "==========================================================" \ No newline at end of file diff --git a/qb64/social-security.bas b/qb64/social-security.bas new file mode 100644 index 0000000..f81e0dc --- /dev/null +++ b/qb64/social-security.bas @@ -0,0 +1,39 @@ +start: +CLS +PRINT "This program will help you determine" +PRINT "if you are old enough to apply for" +PRINT "Social Security." +PRINT +INPUT "Please enter your current age."; age +IF age < 65 THEN GOSUB young: +IF age > 65 THEN GOSUB old: +IF age = 65 THEN GOSUB correct: +GOTO start + +young: +CLS +PRINT "You are too young. Please try again" +PRINT "in a couple of years." +PRINT +INPUT "Press 'Enter' to continue."; dummyVariable +PRINT +GOTO start + +old: +CLS +PRINT "You are should have applied for" +PRINT "Social Security by now." +PRINT +INPUT "Press 'Enter' to continue."; dummyVariable +PRINT +GOTO start + +correct: +CLS +PRINT "You are now eligiable to apply for " +PRINT "Social Security." +PRINT +INPUT "Press 'Enter' to continue."; dummyVariable +PRINT +GOTO start + diff --git a/red/ask-age.red b/red/ask-age.red new file mode 100644 index 0000000..6d87e2f --- /dev/null +++ b/red/ask-age.red @@ -0,0 +1,11 @@ +Red [needs: view] +view [ + f1: field "First name" + f2: field "Last name" + button "Greet me!" [ + t1/text: rejoin ["Have a nice day " f1/text " " f2/text "!"] + ] + return + t1: text "" 200 + +] \ No newline at end of file