Datafiles
Author |
Message |
Jessica359
|
Posted: Thu Apr 03, 2008 12:59 pm Post subject: Datafiles |
|
|
Alright here anoter assignment that I am not sure what to do like the idea is there but there's something that won't click. "The little lightbulb won't go off"
Assignment Datafiles: sn, open, close, eof
York region Police want a list of those criminals who have been convicted of Theft, Homicide, and Arson. The file created should contain the Name, Offence and Conviction Date of each criminal. The offences are to be listed as letter codes T for theft, A for Arson, etc. The output to screen should list the offences writtenout in full, i.e., Y.R.P.D. Criminal Listings
Its like I get is but I don't... mayby rewording it might work or mayby tips on what to do.
Thanks |
|
|
|
|
|
Sponsor Sponsor
|
|
|
Tallguy
|
Posted: Thu Apr 03, 2008 1:01 pm Post subject: RE:Datafiles |
|
|
actually i'm as losyt as you are jess, when is this program due? |
|
|
|
|
|
Jessica359
|
Posted: Thu Apr 03, 2008 1:17 pm Post subject: RE:Datafiles |
|
|
where starting next week on it but i want to get ahead |
|
|
|
|
|
BigBear
|
Posted: Thu Apr 03, 2008 1:56 pm Post subject: Re: Datafiles |
|
|
Are u creating a program that someone can enter people into a datafile or just create a datafile. A data file can be a text file that can be read by a program or written to by a program. Usually data files for turing programs have a .tu extension.
If you need to create a program that can be used to enter names into the datafile then first open the data file code: | var fn: int
open:fn, "DataFile.tu", put
%the put represents you want to put information in the data file
%Use get when you want to get information from the DataFile (close : fn will have to be used)
|
Then prompt the user for name, crime etc and use
put : fn , "stuff to be put in DataFile
to put it in the DataFile
Hope this helps |
|
|
|
|
|
Nick
|
Posted: Thu Apr 03, 2008 2:23 pm Post subject: RE:Datafiles |
|
|
bigbear, you should only name Turing units with the extension .tu, text files should have the extension .txt, does this change anything? no but it's easier for someone else to understand what the file is for |
|
|
|
|
|
BigBear
|
Posted: Thu Apr 03, 2008 4:31 pm Post subject: Re: Datafiles |
|
|
Yes a text file should have a .txt file extension, I was trying to say you can use a text file but most people use .tu. Thanks for correcting my mistake though. |
|
|
|
|
|
that-guy
|
Posted: Thu Apr 03, 2008 5:06 pm Post subject: Re: Datafiles |
|
|
Well I don't exactly feel like creating this whole program at the moment, but I will try to walk you through it step by step in good old English. If you still don't understand, let me know and I'll post the code for it.
What you are being asked to do is as follows:
- Prompt the user to input the Name, Offense and Conviction Date of each criminal.
- Save this information to a file.
- Save the offenses as only letters (only get the first letter of the offense)
- Read from the file, and when it gets to the offense part, use a series of if statements to say, for example..
if line = "T" then
put "Theft"
end if
- Display all the contents necessary.
I guess what i just wrote might be a bit hard to understand, and I don't know if I'm totally right about what you have to do, but this is how I am understanding it. If you have any questions about what I said, feel free to ask. |
|
|
|
|
|
Jessica359
|
Posted: Fri Apr 04, 2008 9:58 am Post subject: RE:Datafiles |
|
|
kk thanks i'll try it out! |
|
|
|
|
|
Sponsor Sponsor
|
|
|
|
|