April 09, 2020, 07:24:08 AM *
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]
Author Topic: QBASIC Challenge  (Read 2260 times)
New Member

Posts: 11

« on: March 08, 2003, 09:08:53 PM »


Im new to QBASIC (well duhh), i have a challenge from my QBASIC teacher. I really dont know how to do this or have a clue on how to start. If there is any talented QBASIC programmer out there, can ya help me out.

Write a program that does the following:
One screen at a time, present the user with information about a CD that can be purchased.
The user should be able to enter the number of CDs that will be purchased.
Display a table on the screen with column headings for CD Title, Artist(s), Price, Quantity Purchased, Discount, and Total Cost.
Display 7 rows of data at a time. Each row should include the CD title, the artist(s), the price of an individual CD, the number of CDs purchased, the discount (if any), and the total cost of the CDs for each specific title.
Give a 15 percent discount if 5 or more CDs of a single title are purchased.
Calculate and display the total number of CDs purchased, the total discount, and the total amount spent for all CDs purchased.
Write this program in a step-by-step sequence starting from your template.bas program below.
You will need a total of 15 CDs in this program. Use titles from your own collection or do a search at a web site like Yahoo for the information you need.
Be sure to use "good programming" practice when you write
Include a Variable Identification section to document the name and purpose of each variable.
Use REM statements to identify the title of the program, the name of the programmer, and the date.
USE REM statements to identify the purpose of specific parts of the program as needed.
Use spaces to break up the program so it is easy to read.
Use meaningful variable names.
Use a step-by-step procedure to develop the program and temporary code to test the code as it is built.
Note: This program must be done in a modular style .
Special Submission Instructions: Since you are writing this program in a step-by-step process, you will need to submit each version of the program showing the addition of the new information for each subprogram and any temporary printing that verifies that the program is working as expected.
Be sure to save each program in the sequence using a separate name (e.g. cds1.bas, cds2.bas, cds3.bas, etc.)
When you have completed the final version of the program, zip all of the files together and sent them to leonhartilly@msn.com
DECLARE SUB Introscreen ()
DECLARE SUB PressAnyKey ()
REM program
REM name
REM date
'title$.......name of program
'name$.........name of programmer
CALL Introscreen
CALL PressAnyKey
SUB Introscreen
REM title,author, and date of the program
title$ = "Computer Art"
name$ = "bill gate"
day$ = "today"
REM Change display mode
REM Random number generator
LET n = 1
FOR i = 440 TO 1000
LET x = INT(RND * 1000) + 37
c1 = INT(RND * 639) - 1
r1 = INT(RND * 199) - 1
c2 = INT(RND * 639) - 1
r2 = INT(RND * 199) - 1
c = INT(RND * 16) - 1
LINE (c1, r1)-(c2, r2), c
LET n = n + 1
SOUND x, i / 1000
LOOP UNTIL (n > 10)
LOCATE 10, 34
PRINT title$
LOCATE 12, 35
PRINT name$
LOCATE 14, 35
PRINT day$
SUB PressAnyKey
key$ = ""
LOCATE 25, 26
PRINT "Press Any Key to End Program";
key$ = INKEY$
LOOP UNTIL (key$ <> "")
Posts: 8244

« Reply #1 on: March 08, 2003, 09:11:58 PM »

As stated in the forum rules, we won't do your homework. Just try it, and when you are stuck, ask and we'll help.

SCUMM (the band) on Myspace!
ComputerEmuzone Games Studio
underBASIC, homegrown musicians
New Member

Posts: 11

« Reply #2 on: March 08, 2003, 09:27:50 PM »

well im just putting this up, this is actually an extra credit. Im not really here yet, he said i will learn about it soon. If that's the rule, then it's alright. Thanks for telling me, i never thought i could get a reply that fast. I think in the future i will need of ya help. Thanks first :wink:
Posts: 2567

« Reply #3 on: March 08, 2003, 11:45:41 PM »

well, in that case welcome to the board Cheesy

if you want to do this extra credit, take a crack at it.  when you hit a roadblock, come to us with that specific problem and we'll see what we can do.

i]"I know what you're thinking. Did he fire six shots or only five? Well, to tell you the truth, in all this excitement, I've kinda lost track myself. But being as this is a .44 Magnum ... you've got to ask yourself one question: 'Do I feel lucky?' Well, do ya punk?"[/i] - Dirty Harry
Posts: 75

« Reply #4 on: March 09, 2003, 10:59:57 AM »

Hi leon, like the others said, the "fun" of QB is trying to figure out how to do stuff.  Its like working a great puzzle.

I will point out a couple things though, the use of LET is so archaic that even the HELP file says so.  Just remove thos words.  Also, I don't get what the purpose for having ten random lines at random lengths and colors is supposed to accomplish.  The "jingle" is harmless, but drawing those lines just doesn't seem to "fit" into any relevance to the program.  They don't even look good.   Smiley

Just my 2 cents worth.   Dex

EDIT:  I also noticed, the for/next loop after the second RANDOMIZE TIMER statement, doesn't do anything. At the end of the loop, i will always be 1000, which makes the line:

SOUND x, i / 1000

equivalent to :

SOUND x, 1

The fact that the loop uses 440 as its start point (middle A on a keyboard), would imply that this should be some sort of note value.
Also, the value x is generated, then discarded 559 times,(from 440 to 1000), only the last value of x is used.
New Member

Posts: 11

« Reply #5 on: March 09, 2003, 10:32:03 PM »

thanks for pointing out that.
Pages: [1]
Jump to:  

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