I would like to develop a stock control program for my end year project.
Am still a novice in programming and I have come through baptism of fire in my endevour to develop one to play checkers. The other students have handed over there projects and now here am i totally racing with the deadline which is 15/10/2005.
I would be gratefull if oneone there asist by coding a simple database program.For any program e,g stock control of a bookshop,or voting registration and voting exercise,student registration.
The programs should be able to print the days reoprts eg total sales
I have not written my proposal for any project
Thanks
Comments
: Am still a novice in programming and I have come through baptism of fire in my endevour to develop one to play checkers. The other students have handed over there projects and now here am i totally racing with the deadline which is 15/10/2005.
: I would be gratefull if oneone there asist by coding a simple database program.For any program e,g stock control of a bookshop,or voting registration and voting exercise,student registration.
: The programs should be able to print the days reoprts eg total sales
: I have not written my proposal for any project
: Thanks
:
No one is going to do your work for you. We will help you out if you need. For curiousity, how far did you get on your checkers game? Maybe that's still salvagable.
Phat Nat
: : Am still a novice in programming and I have come through baptism of fire in my endevour to develop one to play checkers. The other students have handed over there projects and now here am i totally racing with the deadline which is 15/10/2005.
: : I would be gratefull if oneone there asist by coding a simple database program.For any program e,g stock control of a bookshop,or voting registration and voting exercise,student registration.
: : The programs should be able to print the days reoprts eg total sales
: : I have not written my proposal for any project
: : Thanks
: :
:
: No one is going to do your work for you. We will help you out if you need. For curiousity, how far did you get on your checkers game? Maybe that's still salvagable.
:
: Phat Nat
:
:
The project lecturer disapproved the other games program which after all had stalled.
Few people can do work for anyone.But am pleading for assistance because am completely beaten and running out of time.We acces the computer lab twice a week one hour each lesson and I don't own a computer to code my project.
Someone help.
: Few people can do work for anyone.But am pleading for assistance because am completely beaten and running out of time.We acces the computer lab twice a week one hour each lesson and I don't own a computer to code my project.
: Someone help.
:
First off, are you using Turbo Pascal for DOS/Windows or Free Pascal, etc.
Secondly, what do you want your program to do? If you want help, you're going to need to take charge. Choose what your stock program is going to be used for and what it will require. Make an attempt at it and post as far as you get. PPL here will help you along. You still have over 10 days. Is there no other computer that you can get access to? Library? ask the instructor for extra lab time? Sometimes you can use a spare computer when another class is in session. There's always a way.
Anyways, hopefully I see a post again soon with a destination and at least an attempt at the code. I'm not trying to sound rude, but know that I work 40+ hrs a week and lots of extra-cirricular activites. I don't mind dropping an hour or two down to help someone, but I'm not going to spend every spare breathe trying to write somebody else's project by the due date. Give it a try and I'll put some time in to help out.
Phat Nat
here you go and good luck
program menuchoice;
uses crt;
var
choice:char;
procedure openfiles;
begin
{allocation of all data files}
end;
procedure closefiles;
begin
{shut down and perhaps backup datafiles}
end;
procedure newcust;
begin
writeln ('this is where you enter a customers details');
readln;
end;
procedure editcust;
begin
writeln ('this is where you edit a customers details');
readln;
end;
procedure exit;
begin
writeln ('this is where you shut down files and get a log off message');
readln;
end;
{start of main prog}
begin
{the main programme}
openfiles;
repeat
clrscr;
gotoxy(30,10);
writeln('menu options');
gotoxy(25,12);
writeln('A Add new customer') ;
gotoxy(25,14);
writeln('E Edit customer');
gotoxy(25,16);
writeln('X eXit');
readln(choice);
case choice of
'A' :newcust;
'B' :editcust;
'X' :exit;
{NOTE UPPER CASE USE SHIFT}
end;
until choice='X';
closefiles;
end.
Mormally as I program and I arreneously enter a string instead of an integer,or real the program collapses. Loosing all the information. What could actually be done to save this.
:
: Mormally as I program and I arreneously enter a string instead of an integer,or real the program collapses. Loosing all the information. What could actually be done to save this.
:
You should already be decided on your project. Time is ticking. Don't worry too much about advantages/disadvantages of each, just get a start (especially with the timeline).
Save your work continuously. If you are using TP (at least newer versions), just hit F2. I have a habit of saving too much. I don't see it save, so I usually hit it 2-4 times without even thinking after every couple of lines. A Little excessive, but takes only a split second.
Good luck,
Phat Nat
variable expected an the programs give an error message and crashes.I want the program to continue running.
: variable expected an the programs give an error message and crashes.I want the program to continue running.
:
Without seeing your code, things get confusing, but I think I know what you're doing.
I'm going to take a guess that you are using READ/READLN like this:
[code]
VAR
Year : Word;
Begin
Write('Enter year : ');
ReadLn(Year);
End.
[/code]
In this case, if the user enters a character or non-number, the program will crash because it is looking for a number.
There are a few ways around this, but I'll just give one for now.
[code]
VAR
S : String;
Year : Word;
Error : Integer;
Begin
Repeat
Write('Enter year : ');
ReadLn(S);
Val(S,Year,Error);
Until Error = 0;
End.
[/code]
This will continue to ask the user for the year until they enter a number (without crashing).
Phat Nat
: : variable expected an the programs give an error message and crashes.I want the program to continue running.
: :
:
: Without seeing your code, things get confusing, but I think I know what you're doing.
: I'm going to take a guess that you are using READ/READLN like this:
:
:
: [code]
: VAR
: Year : Word;
:
: Begin
: Write('Enter year : ');
: ReadLn(Year);
: End.
: [/code]
:
: In this case, if the user enters a character or non-number, the program will crash because it is looking for a number.
: There are a few ways around this, but I'll just give one for now.
:
: [code]
: VAR
: S : String;
: Year : Word;
: Error : Integer;
:
: Begin
: Repeat
: Write('Enter year : ');
: ReadLn(S);
: Val(S,Year,Error);
: Until Error = 0;
: End.
: [/code]
:
: This will continue to ask the user for the year until they enter a number (without crashing).
:
: Phat Nat
:
: Thanks
I have a big problem which I dont know if it lies with the compiler, I am using turbo pascal ver6.
I need to read some data as I save them in a file,I therefore have a loop of repeat until.
During the first pass of the loop I succesfully read the data.But from the second pass the readln(data) statement is not recognised at all.By press F8 key I clearly see it not recognised.The line is executed yes but the command is not recognised.Why was it then reconised in the first pass. I tend to think its not in the program logic because the line is executed as I use F8 but it does not give me the chance to enter my data.Is it a compiler problem. I have asked my lecturer but he was also beaten.
What I mean is this the statement does not wait for me to enter data;
I would appreciate if someone there assists.
: I need to read some data as I save them in a file,I therefore have a loop of repeat until.
: During the first pass of the loop I succesfully read the data.But from the second pass the readln(data) statement is not recognised at all.By press F8 key I clearly see it not recognised.The line is executed yes but the command is not recognised.Why was it then reconised in the first pass. I tend to think its not in the program logic because the line is executed as I use F8 but it does not give me the chance to enter my data.Is it a compiler problem. I have asked my lecturer but he was also beaten.
: I would appreciate if someone there assists.
:
Check your data file, it might be corrupt data. Otherwise post that loop to show up how you coded it. That way one of us might see some error.
[b][red]This message was edited by capaprodigy at 2005-10-24 4:7:26[/red][/b][hr]
: : I have a big problem which I dont know if it lies with the compiler, I am using turbo pascal ver6.
: : I need to read some data as I save them in a file,I therefore have a loop of repeat until.
: : During the first pass of the loop I succesfully read the data.But from the second pass the readln(data) statement is not recognised at all.By press F8 key I clearly see it not recognised.The line is executed yes but the command is not recognised.Why was it then reconised in the first pass. I tend to think its not in the program logic because the line is executed as I use F8 but it does not give me the chance to enter my data.Is it a compiler problem. I have asked my lecturer but he was also beaten.
: : I would appreciate if someone there assists.
: :
: Check your data file, it might be corrupt data. Otherwise post that loop to show up how you coded it. That way one of us might see some error.
:
Here is the proram. Inside the repeat until loopt the line
readln(request.description); does not wait me to enter data after the second pass
program africanhighlands(input,output);
uses crt,printer,dos;
const
title1='AFRICAN HIGHLANDS PRODUCE COMPANY';
type dates=record
day,month,year:word
end;
type requesty=record
name,dept,description,approval,reqno:string;
qtyin,qtyout,unicost,totalcost:real;
datein,dateout:dates;
end;
type register=record
name:string;
code:integer;
end;
var i,y,x,posy,t:integer;
day,month,year,time:word;
purchase,request:requesty;
rqfile:file of requesty;
files:file of register;
product,prod:register;
CH:char;
title2:string;
BEGIN
assign(files,'master.edu');
getdate(year,month,day,time);
title2:='STORES REQUISITION FORM ';
{$I-}
reset(files)
{$I-};
i:=ioresult;
if i=0 then
begin
writeln (' NAME DEPARTMENT');
writeln;
writeln(' DATE REQ NO;');
writeln;
writeln(' DESCRITION AND SPECIFICATION QUANTITY UNIT COST TOTAL COST');
writeln(' OF ITEM BOUGHT');
textcolor(green);
Gotoxy(12,6);readln(request.name);
Gotoxy(50,6);readln(request.dept);
Gotoxy(12,8);write(day,'/',month,'/',year);
request.dateout.day:=day;request.dateout.month:=month;request.dateout.year:=year;
Gotoxy(44,8);readln(request.reqno);
y:=11;
repeat
y:=y+1;
write('press Q to quit');
textcolor(green);
gotoxy(2,y);readln(request.description);
reset(files);
repeat
read(files,product);
until (eof(files)) or (request.description=product.name);
if request.description=product.name then
begin
assign(rqfile,product.name);
gotoxy(35,y);readln(request.qtyin);
gotoxy(50,y);readln(request.unicost);
request.totalcost:=(request.qtyin*request.unicost);
gotoxy(63,y);
writeln( request.totalcost);
gotoxy(2,28);textcolor(white);write('if satisfied press U to update');
ch:=readkey;
gotoxy(2,28);write(' ');
if (ch='U') or (ch='u') then
seek(rqfile,sizeof(rqfile));write(rqfile,request);
textcolor(white);
write('press Q to quit');
end
else
writeln('the product is not registered');
gotoxy(2,26);write('press Q to quit');
ch:=READKEY;
gotoxy(2,28);write(' ');
request.dept:='';request.name:=''; request.approval:='';request.reqno:='';
request.qtyin:=0;request.qtyout:=0;request.unicost:=0;
request.totalcost:=0;
request.dateout.day:=day; request.dateout.month:=month;
request.dateout.year:=year;
until (ch='Q') or (ch='q');
write('APPROVED');
end
else
writeln('the product is not registered');
readln;
end.
: : : I need to read some data as I save them in a file,I therefore have a loop of repeat until.
: : : During the first pass of the loop I succesfully read the data.But from the second pass the readln(data) statement is not recognised at all.By press F8 key I clearly see it not recognised.The line is executed yes but the command is not recognised.Why was it then reconised in the first pass. I tend to think its not in the program logic because the line is executed as I use F8 but it does not give me the chance to enter my data.Is it a compiler problem. I have asked my lecturer but he was also beaten.
: : : I would appreciate if someone there assists.
: : :
: : Check your data file, it might be corrupt data. Otherwise post that loop to show up how you coded it. That way one of us might see some error.
: :
: Here is the proram. Inside the repeat until loopt the line
: readln(request.description); does not wait me to enter data after the second pass
:
: program africanhighlands(input,output);
: uses crt,printer,dos;
: const
: title1='AFRICAN HIGHLANDS PRODUCE COMPANY';
: type dates=record
: day,month,year:word
: end;
: type requesty=record
: name,dept,description,approval,reqno:string;
: qtyin,qtyout,unicost,totalcost:real;
: datein,dateout:dates;
: end;
: type register=record
: name:string;
: code:integer;
: end;
: var i,y,x,posy,t:integer;
: day,month,year,time:word;
: purchase,request:requesty;
: rqfile:file of requesty;
: files:file of register;
: product,prod:register;
: CH:char;
: title2:string;
: BEGIN
: assign(files,'master.edu');
:
: getdate(year,month,day,time);
: title2:='STORES REQUISITION FORM ';
:
: {$I-}
: reset(files)
:[b] {$I-};[/b]
: i:=ioresult;
: if i=0 then
: begin
:
: writeln (' NAME DEPARTMENT');
: writeln;
: writeln(' DATE REQ NO;');
: writeln;
: writeln(' DESCRITION AND SPECIFICATION QUANTITY UNIT COST TOTAL COST');
: writeln(' OF ITEM BOUGHT');
: textcolor(green);
: Gotoxy(12,6);readln(request.name);
: Gotoxy(50,6);readln(request.dept);
: Gotoxy(12,8);write(day,'/',month,'/',year);
: request.dateout.day:=day;request.dateout.month:=month;request.dateout.year:=year;
: Gotoxy(44,8);readln(request.reqno);
: y:=11;
: repeat
: y:=y+1;
: write('press Q to quit');
: textcolor(green);
: gotoxy(2,y);readln(request.description);
: reset(files);
: repeat
: read(files,product);
: until (eof(files)) or (request.description=product.name);
: if request.description=product.name then
: begin
: assign(rqfile,product.name);
: gotoxy(35,y);readln(request.qtyin);
: gotoxy(50,y);readln(request.unicost);
: request.totalcost:=(request.qtyin*request.unicost);
: gotoxy(63,y);
: writeln( request.totalcost);
: gotoxy(2,28);textcolor(white);write('if satisfied press U to update');
: ch:=readkey;
: gotoxy(2,28);write(' ');
: if (ch='U') or (ch='u') then
: seek(rqfile,sizeof(rqfile));write(rqfile,request);
: textcolor(white);
:
: write('press Q to quit');
: end
: else
: writeln('the product is not registered');
: gotoxy(2,26);write('press Q to quit');
: ch:=READKEY;
: gotoxy(2,28);write(' ');
: request.dept:='';request.name:=''; request.approval:='';request.reqno:='';
: request.qtyin:=0;request.qtyout:=0;request.unicost:=0;
: request.totalcost:=0;
: request.dateout.day:=day; request.dateout.month:=month;
: request.dateout.year:=year;
: until (ch='Q') or (ch='q');
: write('APPROVED');
:
:
: end
: else
: writeln('the product is not registered');
: readln;
:
:
: end.
I would need to see your data file, but I'm guessing that you wrote your data file with a text editor. If I am right, then you're problem is that you are reading it as a TYPED file, not a TEXT file. Look at the bolded line above. You are continuing to keep your IO errors suppressed. Turn this on {$I+} and I bet you will get an error 100. Currently, any entries in your data file must have the name starting with a byte telling how long the name is and must be padded to 256 bytes, even if the name is only 5 letters long. I think that on your first pass, it is reading pretty much your whole data file as the first entry and then when it tries to read the second entry, the file is too short.
Hope this helps, if not, post your data file and I'll look again,
Phat Nat