Qbasicnews.com

Full Version: Help with a problem please, I'm stuck
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Pages: 1 2 3
I need to write a program that lets you enter a band name and the number of minutes of studio time. Then out put a list of the bands, their total number of minutes, and the studio charge ($200 per hour), then give a total on the minutes and charges...

The output should look like this:

Band Minutes Charge
The Birds 60 $200
The Monkeys 120 $400
the Pandas 60 $200

total Minutes: 240 Total charges $800

I'm having trouble with getting my output formatted correctly. We are just now getting into loops and the "Print Using" statement so I need to utilize them in my program. Any help would very much be appreciated...

Here is my code:

CLS
GOSUB initializeimages
GOSUB processdetail
GOSUB printtotal
END


'**************** Initialize print images***************
initializeimages:
LET H1$ = "Group Name Minutes Used charges "
LET d1$ = "\ \ #### ###.## "
LET T1$ = " Total Minutes:##### Total Charges: ####.##"
RETURN



'**************** Process Detail *************************
processdetail:
INPUT "Enter group name or 000 to quit"; nam$

DO UNTIL UCASE$(name$) = "000"
INPUT "Enter total minutes"; minutes
rate = 200 / 60
subtotal = rate * minutes
total = total + subtotal
INPUT "Enter group name or 000 to quit"; name$
PRINT USING d1$; nam$; minutes; total
LOOP
RETURN

'*************** Print totals *****************************
printtotal:
PRINT H1$
PRINT
PRINT USING T1$; minutes; total
RETURN

'*******************End of Program********************
DO
BEEP
PRINT " ASK TEACHER FOR HELP WITH HOMEWORK "
LOOP
sorry, I guess I misunderstood the purpose of the forum. I'll find a different website...
No no... Jusr ask you teacher first and if you are still totally dumbfounded come here.
From your definition of T1$, it appears that you're trying to put the text you want output inside of your format string. That's not the way PRINT USING works. Just the format specifiers go in the format string. Look up PRINT USING in the on-line help's index. (Press ALT-H in the IDE.)

And as for the rest of you, ah, c'mon. It's not like he just stated his homework assignment and asked someone to do it for him. He actually posted code, demonstrating that he actually is in fact interested in actually *doing* something. Smile
Quote:From your definition of T1$, it appears that you're trying to put the text you want output inside of your format string. That's not the way PRINT USING works. Just the format specifiers go in the format string. Look up PRINT USING in the on-line help's index. (Press ALT-H in the IDE.)

And as for the rest of you, ah, c'mon. It's not like he just stated his homework assignment and asked someone to do it for him. He actually posted code, demonstrating that he actually is in fact interested in actually *doing* something. Smile


I was just saying that he should ask his teacer first... But eh. Anyway.

This works
Code:
INPUT a
INPUT b
PRINT USING "a: # ---- b: #"; a; b
I get the impression that the regulars are overly sensitive to people coming here with homework assignments. I'm guessing that you probably have alot of new people come here and ask you to write their code for them. Please don't mistake me for someone who wants a free ride. I've been working on this for several hours, it's due first thing Monday morning. I think I have all the code, it's just not in the right order to give me the output. I thought maybe someone might actually look and see if I had made a simple oversight. After 10 years in the IT industry, I know that lots of people make oversights.
Sorry. I just was wonding if you had asked your teacher. Unlike some people... But now I see whats going on.
Thanks for the response Glenn. My problem is that I need to calculate the data and print it for each individual entry in the form of a list.

The Monkeys $400
The Pandas $200
etc

each band uses the same variable so I have to output that data before I go back to the top of the loop... I can't seem to figure out how to display a nice neat list of all the bands and their charges... very confusing
My apologies if I sounded harsh in my previous comment. I don't mean to attack the community as a whole, just those with the rotten attitude...
Pages: 1 2 3