Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
too many bugs
#1
Help!!...Its like, every program i code, there end up being too many bugs!!

This program its long but please help me shows too many errors and im finding it hard to debug it.
Can you help me please.

This program is of A Music Store.
THe User has an option to Input weather he wants :
1: CD or Cassette
After This he can input if he wants
2: English or Hindi [I come from India, where Hindi is like, damn common]

3:Then All The Genres Show up and he has to choose which one.

4:Then all the albums show up and according to the number inputted it gets saved in a file "cart.dat" and keeps asking you if you want to buy any more music.
5: Once you say no, It prints the entire bill slong with the album youve purchased
6: It ends the program Smile


Heres the code [Doubt It will Fit] :




Code:
10 CLS
11 WHILE MM$ = "Y"
20 REM **Menu**
30 PRINT "Welcome To Janesh's Music Store"
40 PRINT "1:Buy A Record"
60 PRINT "2:Buy Music Accesories"
70 INPUT "Your Choice"; C
80 ON C GOSUB 1000, 3000



1000 REM **Intro To Buying**
1010 CLS
1020 PRINT "At Janesh's Music Store, You Get A Step By Step Easy Menu To"
1030 PRINT "Access And Buy Your Faviorate Music"
1045 PRINT "All You Have To Do Is Feed In The Number And Let My Program"
1046 PRINT "Do The Rest"
1048 PRINT
1049 PRINT "Please Press A Key To Continue"
1050 SLEEP

1053 WHILE YN$ = "Y"
1054 CLS
1055 REM **CD Or Cassette**
1056 PRINT "Do You Wish To Purchase A"
1057 PRINT "1: CD"
1058 PRINT "2: Cassette"
1059 INPUT CDCASSETTE


1060 CLS
1061 REM **Hindi Or English**
1062 PRINT "Do You Want"
1063 PRINT "1: An English Record"
1064 PRINT "2: A Hindi Record"
1065 INPUT HINENG
1066 ON HINENG GOSUB 1400, 2500
1067 OPEN "cart.dat" FOR OUTPUT AS #1
1068 WRITE #1, RECORDNAME$, ARTIST$, COST
1069 INPUT "Any More Purchases[Y/N]"; YN$
1070 IF YN$ = "N" THEN
1071 CLS
1072 PRINT "Go Back To Main Menu ?"
1073 INPUT MM$
1074 IF MM$ = "N" Then END
1075 WEND
1080 WEND
1081 CLOSE #1


1100 REM **PRINTING THE BILL**
1101 CLS
1102 OPEN "cart.dat" FOR INPUT AS #1
1103 WHILE NOT EOF(1)
1104 INPUT #1, RECORDNAME$, ARTIST$, COST
1105 LET FINALCOST = COST + FINALCOST
1106 PRINT RECORDNAME$; "By :- "; ARTIST$; "For Rs."; COST
1107 WEND
1108 PRINT "Final Cost ="; FINALCOST
1109 CLOSE #1
1110 PRINT "Hope You Had A Good Time"
1111 PRINT "Goodbye"
1112 PRINT "Press A Key To Exit The Program"
1113 SLEEP
1114 KILL "cart.dat"
1115 CLOSE #1
1116 END






1400 REM **English Genre**
1401 CLS
1402 PRINT "Please Choose The Genre Of Music You Like To Buy"
1403 PRINT "1: Pop"
1404 PRINT "2:Rock"
1405 PRINT "3:Rap/RNB"
1406 PRINT "4:Classics"
1407 INPUT ENGGENRE
1408 ON ENGGENRE GOSUB 1500, 1800, 2100, 2200
1409 IF CDCASETTE = 1 THEN LET COST = 400 ELSE LET COST = 125
1450 RETURN




1500 REM **English Pop**
1501 CLS
1502 PRINT "Please Select The Album You Wish To Purchase"
1503 PRINT "1:This is Me...Then     -JLo"
1504 PRINT "2:Escape     -Enrique Iglesias"
1505 PRINT "3:Beyonce     -Beyonce"
1506 PRINT "4:Nsync     -Nsync"
1507 PRINT "5:Oops I Did It Again     -Britney Spears"
1508 INPUT ENGPOP
1509 IF ENGPOP = 1 THEN LET RECORDNAME$ = "This is Me...Then": LET ARTIST$ = "JLo"
1510 IF ENGPOP = 2 THEN LET RECORDNAME$ = "Escape": LET ARTIST$ = "Enrique Iglesias"
1511 IF ENGPOP = 3 THEN LET RECORDNAME$ = "Beyonce": LET ARTIST$ = "Beyonce"
1512 IF ENGPOP = 4 THEN LET RECORDNAME$ = "Nsync": LET ARTIST$ = "Nsync"
1513 IF ENGPOP = 5 THEN LET RECORDNAME$ = "Oops I Did It Again": LET ARTIST$ = "Britney Spears"
1514 RETURN



1800 REM **English Rock**
1801 CLS
1802 PRINT "Please Select The Album You Wish To Purchase"
1803 PRINT "1:St. Anger     -Mettalica"
1804 PRINT "2:Meteora     -Linkin Park"
1805 PRINT "3:Results May Vary     -Limp Bizkit"
1806 PRINT "4:Steal This Album     -System Of A Down"
1807 PRINT "5:Greatest Hits     -Guns 'N Roses"
1808 INPUT ENGROCK
1809 IF ENGROCK = 1 THEN LET RECORDNAME$ = "St. Anger": LET ARTIST$ = "Mettalica"
1810 IF ENGROCK = 2 THEN LET ROCORDNAME$ = "Meteora": LET ARTIST$ = "Linkin Park"
1811 IF ENGROCK = 3 THEN LET RECORDNAME$ = "Results May Vary": LET ARTIST$ = "Limp Bizkit"
1812 IF ENGROCK = 4 THEN LET RECORDNAME$ = "Steal This Album": LET ARTIST$ = "System Of A Down"
1813 IF ENGROCK = 5 THEN LET RECORDNAME$ = "Greatest Hits": LET ARTIST$ = "Guns 'N Roses"
1814 RETURN


2100 REM **English Rap**
2101 CLS
2102 PRINT "Please Select The Album You Wish To Purchase"
2103 PRINT "1:The Eminem Show     -Eminem"
2104 PRINT "2:50 Cent     -50 Cent"
2105 PRINT "3:Pain Is Love     -Ja Rule"
2106 PRINT "4:Straight Outta Compton     -NWA"
2107 PRINT "5:Paid The Cost To Be The Boss     -Snoop Dogg"
2108 INPUT ENGRAP
2109 IF ENGRAP = 1 THEN LET RECORDNAME$ = "The Eminem Show": LET ARTIST$ = "Eminem"
2110 IF ENGRAP = 2 THEN LET RECORDNAME$ = "50 Cent": LET ARTIST$ = "50 Cent"
2111 IF ENGRAP = 3 THEN LET RECORDNAME$ = "Pain Is Love": LET ARTIST$ = "Ja Rule"
2112 IF ENGRAP = 4 THEN LET RECORDNAME$ = "Striaght Outta Compton": LET ARTIST$ = "NWA"
2113 IF ENGRAP = 5 THEN LET RECORDNAME$ = "Paid The Cost To Be The Boss": LET ARTIST$ = "Snoop Dogg"
2114 RETURN


2200 REM **English Classics**
2201 CLS
2202 PRINT "Please Select The Album You WishTo Purchase"
2203 PRINT "1:#1     -The Beatles"
2204 PRINT "2:Greatest Hits     -Elvis Prestly"
2205 PRINT "3:5th Symphony     -Beethovan"
2206 PRINT "4:Greatest Hits     -The BeeGees"
2207 PRINT "5:ABBA     -Abba"
2208 INPUT ENGCLA
2209 IF ENGCLA = 1 THEN LET RECORDNAME$ = "#1": LET ARTIST$ = "The Beatles"
2210 IF ENGCLA = 2 THEN LET RECORDNAME$ = "Greatest Hits": LET ARTIST$ = "Elvis Prestly"
2211 IF ENGCLA = 3 THEN LET RECORDNAME$ = "5th Sumphony": LET ARTIST$ = "Beethovan"
2212 IF ENGCLA = 4 THEN LET RECORDNAME$ = "Greatest Hits": LET ARTIST$ = "The BeeGees"
2213 IF ENGCLA = 5 THEN LET RECORDNAME$ = "ABBA": LET ARTIST$ = "Abba"
2214 RETURN





2500 REM **Hindi Genre**
2501 CLS
2502 PRINT "Please Choose The Genre Of Music You Would Like To Buy"
2503 PRINT "1: Indi Pop"
2504 PRINT "2: Bollywood"
2505 PRINT "3: Ghasals"
2506 PRINT "4: Classics"
2507 INPUT HINGENRE
2508 ON HINGENRE GOSUB 2600, 2700, 2800, 2900
2509 IF CDCASETTE = 1 THEN LET COST = 150 ELSE LET COST = 40
2510 RETURN

2600 REM **Indi Pop**
2601 CLS
2602 PRINT "Please Select The Album You Wish To Purchase"
2603 PRINT "1: DJ Doll     -DJ Doll"
2604 PRINT "2: Remixes     -RD Burman"
2605 PRINT "3: Chadti Jawani Remix     -Various Artists"
2606 PRINT "4: Remixes     -Asha Bhosle"
2607 PRINT "5: Romanov IndiPop Tracks     -Various Artists"
2608 INPUT HINPOP
2609 IF HINPOP = 1 THEN LET RECORDNAME$ = "DJ Doll": LET ARTIST$ = "DJ Doll"
2610 IF HINPOP = 2 THEN LET RECORDNAME$ = "Remixes": LET ARTIST$ = "RD Burman"
2611 IF HINPOP = 3 THEN LET RECORDNAME$ = "Chadti Jawani Remix": LET ARTIST$ = "Various Artists"
2612 IF HINPOP = 4 THEN LET RECORDNAME$ = "Remixes": LET ARTIST$ = "Asha Bhosle"
2613 IF HINPOP = 5 THEN LET RECORDNAME$ = "Romanov IndiPop Tracks": LET ARTIST$ = "Various Artists"
2614 RETURN



2700 REM **Bollywood**
2701 CLS
2702 PRINT "Please Select The Album You Wish To Purchase"
2703 PRINT "1:Boom     -The Sountrack"
2704 PRINT "2:Chalte Chalte     -The Sountrack"
2705 PRINT "3:Saathiya    -The Soundtrack"
2706 PRINT "4:Hollywood Bollywood     -The Soundtrack"
2707 PRINT "5:Mumbai Matinee     -The Soundtrack"
2708 INPUT HINBOL
2709 IF HINBOL = 1 THEN LET RECORDNAME$ = "Boom"
2710 IF HINBOL = 2 THEN LET RECORDNAME$ = "Chalte Chalte"
2711 IF HINBOL = 3 THEN LET RECORDNAME$ = "Saathiya"
2712 IF HINBOL = 4 THEN LET RECORDNAME$ = "Hollywood Bollywood"
2713 IF HINBOL = 5 THEN LET RECORDNAME$ = "Mumbai Matinee"
2714 LET ARTIST$ = "The Soundtrack"
2715 RETURN


2800 REM **Ghassals**
2801 CLS
2802 PRINT "Please Select The Album You Wish To Purchase"
2803 PRINT "1:Greatest Ghasals     -Jagjit Singh"
2804 PRINT "2:Silsiley     -Jagjit Singh"
2805 PRINT "3:Chants Of India     -Pundit Ravi Shankar"
2806 PRINT "4:Songs Of The River     -Various Artists"
2807 PRINT "5:Songs Of The Sea     -Various Artists"
2808 INPUT HININS
2809 IF HININS = 1 THEN LET RECORDNAME$ = "Greatest Ghasala": LET ARTIST$ = "Jagjit Singh"
2810 IF HININS = 2 THEN LET RECORDNAME$ = "Silsiley": LET ARTIST$ = "Jagjit Singh"
2811 IF HININS = 3 THEN LET RECORDNAME$ = "Chants Of India": LET ARTIST$ = "Pundit Ravi Shankar"
2812 IF HININS = 4 THEN LET RECORDNAME$ = "Songs Of The River": LET ARTIST$ = "Various Artists"
2813 IF HININS = 5 THEN LET RECORDNAME$ = "Songs Of The Sea": LET ARTIST$ = "Various Artists"
2814 RETURN



2900 REM **Classics**
2901 PRINT "Please Select The Album You Wish To Purchase"
2902 PRINT "1: Classics     -R D Burman"
2903 PRINT "2: Memories     -Asha Bhosle"
2904 PRINT "3: 60's Hits     -Various Artists"
2905 PRINT "4: 70's Hits     -Various Artists"
2906 PRINT "5: 80's Hits     -Various Artists"
2907 INPUT HINCLA
2908 IF HINCLA = 1 THEN LET RECORDNAME$ = "Classics": LET ARTIST$ = "R D Burman"
2909 IF HINCLA = 2 THEN LET RECORDNAME$ = "Memories": LET ARTIST$ = "Asha Bhosle"
2910 IF HINCLA = 3 THEN LET RECORDNAME$ = "60's Hits": LET ARTIST$ = "Various Artists"
2911 IF HINCLA = 4 THEN LET RECORDNAME$ = "70's Hits": LET ARTIST$ = "Various Artists"
2912 IF HINCLA = 5 THEN LET RECORDNAME$ = "80's Hits": LET ARTIST$ = "Various Artists"
2913 RETURN



3000 REM **Accesories**
3001 WHILE YNN$ = "Y"
3010 PRINT "Please Select An Item You Want To Buy"
3020 PRINT "1:Walkman"
3030 PRINT "2:Diskman"
3040 PRINT "3:Speakers"
3050 PRINT "4:CD Cleaner"
3060 INPUT ACC
3070 IF ACC = 1 THEN LET ACC$ = "Walkman": LET COST = 1000
3080 IF ACC = 2 THEN LET ACC$ = "Diskman": LET COST = 2000
3090 IF ACC = 3 THEN LET ACC$ = "Speakers": LET COST = 4000
3100 IF ACC = 4 THEN LET ACC$ = "CD Cleaner": LET COST = 100
3110 OPEN "acc.dat" FOR OUTPUT AS #1
3120 WRITE #1, ACC$, COST
3130 INPUT "Do You Want To Purchase Any More Accesories ?"; YNN$
3140 WEND
4150 REM **Bill For Accesories**
4160 CLS
4170 OPEN "acc.dat" FOR INPUT AS #1
4180 WHILE NOT EOF(1)
4190 LET FINALCOST = COST + FINALCOST
4200 PRINT ACC$, "For Rs."; COST
4201 WEND
4210 PRINT "Final Cost = "; FINALCOST
4220 PRINT "Please Press A Key To Go Back To Main Menu"
4230 SLEEP
4240 RETURN

Wow, it did fit! Lol..
Now please run it and see if it works. [Doubt it]
If it doesn't can you debug it for me please!!!
Reply
#2
Suggestions:

1) Use only labels that you need, and label them descriptively. (no number labels!)

2) Use lowercase for variable (string integer etc) names.

3) Instead of REM use '.

4) Use SELECT CASE or an array instead of the multiple IF statements...

5) Get rid of LET...

Also, you should check on your spelling in the code. IT SUCKS!
Peace cannot be obtained without war. Why? If there is already peace, it is unnecessary for war. If there is no peace, there is already war."

Visit www.neobasic.net to see rubbish in all its finest.
Reply
#3
[sarcasm]
thanks for the help
[/sarcasm]
Reply
#4
If you at least get rid of the line numbers (where is remline where you need it?), I'll help...
Peace cannot be obtained without war. Why? If there is already peace, it is unnecessary for war. If there is no peace, there is already war."

Visit www.neobasic.net to see rubbish in all its finest.
Reply
#5
ok fine i got rid of them, now get to the help already!
Reply
#6
Quote:ok fine i got rid of them, now get to the help already!

You shouldn't take insult. Your code does, in fact look like Spaghetti code
http://www.wikipedia.org/wiki/Spaghetti_code
written in apple BASIC
http://www.applefritter.com/apple1/basic/
Try to learn about structured progamming
http://acweb.colum.edu/users/rcourington...uprog.html

I took considerable effort to try to give you guidance in the beginner's forum. You post this crap in the programming help forum. People here are happy to help, but when you post crap, are offered advice, then refuse to consider that, indeed your code is so crappy that it's not worth revising...it's a loss. Start over with a better plan. There are no less than 15 people here who could write your program for you in an hour's time. To get decent results, I speculate that it will take *you* substantially longer. If you want help, ask *and* listen to what people have to offer. If you want someone else to do your work for you, and you are not really interested in learning how to program, then hire a programmer to do the work for you.

I don't often post with a hostile tone, but...well...you deserve it.

Here's a hint. Don't hard code your data in print statements. It's foolish. Put your data (eg album info) in a file, then have your program read and and display the data contained in the file. That way, you can get the program working, then just update the file as needed...only modifying the program to add *features*, not more data.
Reply
#7
Code:
ok fine i got rid of them, now get to the help already!

Post the program without all the extra line numbers. (try to edit your first post)

I was actually going to rewrite the code, but with the line numbers, instead of 15 minutes it would have taken me considerably longer.
Peace cannot be obtained without war. Why? If there is already peace, it is unnecessary for war. If there is no peace, there is already war."

Visit www.neobasic.net to see rubbish in all its finest.
Reply
#8
nah, i got it

P.S :- Dont get so pissed off for such small things man!!take it easy!!
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)