Computer Forums

Member Login

Remember Me? Sign Up! | Forgot Password
 
Slogan
 
Closed Thread
Old 04-23-2008, 11:27 AM   #1 (permalink)
StealthTools's Avatar
 
Hardware/VB.net/Anti-vir

Join Date: Mar 2008

Location: TN - Intel, Samsung, and NVIDIA 4 EvR!

Posts: 515

StealthTools is on a distinguished road

Send a message via MSN to StealthTools
Default QBasic Problem/Code

Chapter 9: Arrays and Searching and Sorting

Level 2, Problem 3
Due Date: Tuesday, April 29, 2008

Level 2, Problem 3 (Klingon Prisoners)

TASK

Create a flowchart for a program that allows the user to enter the name, ship, and prison cell number for prisoners in the Klingon prison colony. The data should be stored in three parallel arrays, and the arrays should be alphabetized by prisoner name. The user should be able to display information about a particular prisoner when his or her name is entered.

Use QBasic to write a program that allows the user to enter the name, ship, and prison cell number for prisoners in the Klingon prison colony. The data should be stored in three parallel arrays, and the arrays should be alphabetized by prisoner name. The user should be able to display information about a particular prisoner when his or her name is entered.
Your program should include the following:

·
Correct use of three parallel arrays
·Use of binary search to locate prisoners by name
·Correct, formatted output


I am not kidding this is what it really says, lol

The Klingons have captured Spock, science officer of the U.S.S. Enterprise. Captain Kirk has broken into their prison colony to free him. He has reached the computer that possesses information concerning all of the prisoners, including their cell numbers. Write a program to prompt the user to enter the following data into the program. The data should be stored in all three parallel arrays:

Prisoner Ship Cell#
Kanobi Falcon 328
Spock Enterprise 562
Yoda None 122
Mudd Pleasure Dome 222
Khan Botany Bay 009
Jetson Astrofly 468
Rogers Galaxy 2 727
Koeing Alpher 999
Adama Galactic 987
Who Tardis 585

Alphabetize the data by name, and display information regarding a prisoner when his or her name is entered. Use a binary search routine in your program to speed Captain Kirk's search for Spock.



Hey.. That is the homework I have to do... I am stressed out because I have high-school work to do over this.. I will get back to this post later today.. I will need help on this program I believe.. or at least someone yo walk me through it.. I don't know how to code an array or nothing, lol ... at lunch at school right now.. I know some of you guys are just itching for a problem to work on, lol.. I was like that but It turned out a change of lifestyle can throw you off balance.

I am only taking QBasic because it was a requirement for taking Visual Basic.... and guess what... Where I live now... it ISN'T!!! now I am taking 2 college classes and 4 high-school classes.. help meh please, lol

Tomorrow - 4/24/08 I will post some code I will create for this program....

When I do post the code I will probably need someone to walk me through some of it..

Thanks for your help

Last edited by StealthTools; 04-23-2008 at 08:20 PM.
StealthTools is offline  
Old 04-23-2008, 12:03 PM   #2 (permalink)
 
Software Developer

Join Date: Mar 2006

Location: Columbus, OH

Posts: 569

jaeusm is on a distinguished road

Default Re: QBasic Problem/Code

Post what code you have so far, and we can help from there. If you have specific questions, post them as well.
jaeusm is offline  
Old 04-24-2008, 03:32 PM   #3 (permalink)
StealthTools's Avatar
 
Hardware/VB.net/Anti-vir

Join Date: Mar 2008

Location: TN - Intel, Samsung, and NVIDIA 4 EvR!

Posts: 515

StealthTools is on a distinguished road

Send a message via MSN to StealthTools
Question Re: QBasic Problem/Code

Here is what I have so far in regards to the program I have to create...

I am wondering if when Name$ or the name of the prisoner is sorted alphabetically if it will switch the names around leaving the
cell numbers and ship names behind making them be with another prisoners name.

I am also wondering on how to make a freakin binary seach for this program, lol

Hope what I have works.. probably doesn't..

Help Meh Pl0x!

Code:
'*** This program displays information reguarding ***
'*** A prisoner  when his or her name is entered.  ***


'*** This procedure prompts the user to  enter the name ***
'*** of the prisoner, the ane of the prisoner's ship    ***
'*** and the prisoners cell number.                     ***

CLS

DIM Nam$(1 TO 10), Ship$(1 TO 10), Cell(1 TO  10)

FOR Count = 1 TO 10
   INPUT " Enter the name of the prisoner:",  Nam$(Count)
  PRINT
   INPUT " Enter the name of the prisoner's ship:",  Ship$(Count)
  PRINT
   INPUT " Enter the cell number where the prisoner  is held:", Cell(Count)
  PRINT
NEXT  Count

CLS


'*** This procedure uses the  bubble sort to alphabetically sort the array Nam$ ***

Final = 9
Flag =  1

'*** Execute loop until no exchanges are made ***

DO WHILE Flag  = 1
Flag = 0
FOR Count = 1 TO Final
   '*** If names are out of order,  switch them ***
  IF Nam$(Count) > Nam$(Count+1) THEN
   SWAP  Nam$(Count), Nam$(Count+1)
   Flag = 1      '*** Reset Flag, indicating a  switch
  END IF
 NEXT Count
Final = Final -  1
LOOP


'*** This procedure prompts the user to  enter the name of a prisoner ***
'*** and displays information about that  prisoner                    ***

PRINT
PRINT
INPUT  "Enter the name of the prisoner you wish to view information  about:",
PRINT
PRINT
Thanks for any help anyone may be able to provide.

Last edited by StealthTools; 04-24-2008 at 03:46 PM.
StealthTools is offline  
Old 04-27-2008, 07:18 PM   #4 (permalink)
StealthTools's Avatar
 
Hardware/VB.net/Anti-vir

Join Date: Mar 2008

Location: TN - Intel, Samsung, and NVIDIA 4 EvR!

Posts: 515

StealthTools is on a distinguished road

Send a message via MSN to StealthTools
Default Re: QBasic Problem/Code

Problem solved... Thanks to QBasic.com
StealthTools is offline  
 
Closed Thread

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
a very old computer + qbasic & parallel port = Controlled LEDs? Hiiii Hardware Troubleshooting 0 01-08-2008 09:44 AM
QBASIC Modem sir nerdalot Programming Discussions 13 05-18-2007 02:31 AM