Back to Non-Emulation Help

Psuedocode Help (programming class)

Joel16OP
#1
well i have to work on a pseudo code on pascal, for my class
and its about a gym, i keep getting errors at compiling, can anyone help me out :lthis is how it is so far,
Please help ASAP, i need to turn my assignment in soon, thank you
Program Greatbodiesgym;

Var SessA,FeesD,FeesO,FeesP,RegMem,SpecMem,Regrate,SpecRate,Sum,Highest,Avg;

Num:array[1..6]

Begin

array size 6 <- namarray

array size 6 <-  SesA

array size 6 <- feesP

array size 6 <- stat

Regrate  <- 20

Specrate  <- 10

Regmem <- 150

Specmem <-75

For i := 1 to 6 do

Readln (namarray [i]);

                Readln (sesA [i]);

Readln (feesP [i]);

Readln (stat [i]);

Endfor;

I := 1

Sum := 0

Highest := 0

While I <= 6

If status [i] := ‘R’ then feesD <-regmem+(SesA[i]*regrate)

Else feesD  <-specmem+(sesA[i])*specrate)

FeesO :=-feesD – feesP

Writeln (‘Fees Outstanding ‘ , FeesO);

Sum :=  sum +feesP [i]           

Writeln (‘Sum is ‘ , Sum);

 

write nam[i], stat[i], sessA[i], FeessP[i],FeesO[i],highest[i] ;

If feesD > 0 then highest <- feesD;

End while;

avg <- sum/6

writeln (‘avg’);

writeln (‘highest’);

Found = 'n';

Position <- 0;

i <- 1

Repeat

                If nam[i] = Tony King, then position <- 1

                found = 'y'

                i <- i+1

Until 1>6 or found = 'y'

If found = 'y' then

writeln (Nam[i],'was found in position ' location of array',)

else writeln ('not found', not found)

end.
SergeantMajorME
#2
Can't say I'm the best at pascal (my school taught C++)However, in this part:
For i := -1 to 6 doReadln (namarray [i]); Readln (sesA [i]);Readln (feesP [i]);Readln (stat [i]);Endfor;namarray is from 1-6, you're asking to find items -1 and 0?I'm not sure if this would throw compile errors, but it should be an error nonetheless.
Joel16OP
#3
[quote="SergeantMajorME"]Can't say I'm the best at pascal (my school taught C++)However, in this part:
For i := -1 to 6 doReadln (namarray [i]); Readln (sesA [i]);Readln (feesP [i]);Readln (stat [i]);Endfor;namarray is from 1-6, you're asking to find items -1 and 0?I'm not sure if this would throw compile errors, but it should be an error nonetheless.
[/quote]oh sorry
i meant
"For i := 1 to 6 do"
Showing posts 1–3 of 3 · This discussion is archivedBack to top