Qbasicnews.com
March 29, 2020, 08:26:00 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 [2]
  Print  
Author Topic: Help with a problem please, I'm stuck  (Read 4733 times)
whitetiger0990
__/--\__
*****
Posts: 2964



WWW
« Reply #15 on: June 07, 2003, 03:10:57 PM »

I looked at it again... Here...

Code:
CLS
GOSUB initializeimages
GOSUB processdetail
GOSUB printtotal
END


'**************** Initialize print images***************
initializeimages:
INPUT "How many bands?", hmb
LET h1$ = "Group Name Minutes Used charges "
LET d1$ = "Band: &  Time: ####  Charge: ###.##"
LET T1$ = " Total Minutes:#####   Total Charges: #####.##"
DIM min(hmb)
DIM char(hmb)
DIM band$(hmb)
RETURN



'**************** Process Detail *************************
processdetail:
a = 1
DO
INPUT "Enter group name or 000 to quit"; name$
IF UCASE$(name$) = "000" THEN EXIT DO
INPUT "Enter total minutes"; minutes
rate = 200 / 60
subtotal = rate * minutes
total = total + subtotal
mint = mint + minutes
 band$(a) = name$
 min(a) = minutes
 char(a) = subtotal
a = a + 1
IF a > hmb THEN EXIT DO
LOOP
RETURN

'*************** Print totals *****************************
printtotal:
PRINT
PRINT
FOR i = 1 TO a - 1
 name$ = band$(i)
 minutes = min(i)
 subtotal = char(i)
 PRINT
 PRINT USING d1$; name$; minutes; subtotal
NEXT i
'PRINT h1$
PRINT
PRINT USING T1$; mint; total
RETURN

'*******************End of Program********************
Logged


[size=10]Back by popular demand!
I will byte and nibble you bit by bit until nothing remains but crumbs.[/size]
atomicfrog
New Member

Posts: 9


« Reply #16 on: June 07, 2003, 03:12:52 PM »

yep, thats the ticket! Problem is, my instructor hasn't touched on arrays yet. It goes way beyond the scope of the problem actually. I took a closer look and I think they want me to output each line individually THEN enter a new band instead of putting out a report. At the end, I will display a the total number of minutes and total charges.

Thanks to all who helped me, it is really appreciated.
Logged
whitetiger0990
__/--\__
*****
Posts: 2964



WWW
« Reply #17 on: June 07, 2003, 03:14:02 PM »

Do you mean like the first one i posted?
Logged


[size=10]Back by popular demand!
I will byte and nibble you bit by bit until nothing remains but crumbs.[/size]
atomicfrog
New Member

Posts: 9


« Reply #18 on: June 07, 2003, 03:30:40 PM »

Yes, more or less. I was reading too much into the question. Once i realized that I would need to use arrays to finish the problem, I went back and reread the question more closely. I'm saving the code you wrote though for future reference, because we will be learning about arrays in the next few weeks. heres my final code.


CLS
GOSUB initializeimages
GOSUB processdetail
GOSUB printtotal
END


'****************  Initialize print images***************
initializeimages:
   D1$ = "\          \    ####              ###.##    "
   T1$ = "    Total Minutes:#####    Total Charges: ####.##"
RETURN



'****************  Process Detail  *************************
processdetail:
   INPUT "Enter group name or 000 to quit"; nam$
 
      DO
         INPUT "Enter total minutes"; minutes
         rate = 200 / 60
         subtotal = rate * minutes
         total1 = total + minutes
         total = total + subtotal
         PRINT
         PRINT "Band Name       Minutes           Charges"
         PRINT USING D1$; nam$; minutes; total
         PRINT
         PRINT
         INPUT "Enter group name or 000 to quit"; nam$
         LOOP UNTIL UCASE$(nam$) = "000"
RETURN

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

'*******************End of program**************************







Thanks again for the help, it is very much appreciated...
Logged
whitetiger0990
__/--\__
*****
Posts: 2964



WWW
« Reply #19 on: June 07, 2003, 03:36:12 PM »

you made a mistake.
 \\
Prints first 'n' characters,  where n is the number of blanks between slashes + 2

IN you prog you have
Code:
\ \

This only takes the first tree letters in the string.
Use :

Code:
&

Prints entire string
Logged


[size=10]Back by popular demand!
I will byte and nibble you bit by bit until nothing remains but crumbs.[/size]
atomicfrog
New Member

Posts: 9


« Reply #20 on: June 07, 2003, 03:41:40 PM »

Actually, when I cut and paste the code into the reply window, it removed all the spaces. I actually have 14 spaces between the slashes. Our instructor wants us to use the slashes in these assignments, once we show an understanding of it, she will let us use "&"....  thanks for looking it over though  =)
Logged
whitetiger0990
__/--\__
*****
Posts: 2964



WWW
« Reply #21 on: June 07, 2003, 06:58:08 PM »

oh... gotcha[/b]
Logged


[size=10]Back by popular demand!
I will byte and nibble you bit by bit until nothing remains but crumbs.[/size]
Pages: 1 [2]
  Print  
 
Jump to:  

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