1. This forum is in read-only mode.

Psuedocode Help (programming class)

Discussion in 'Non-Emulation Help' started by Joel16, Dec 6, 2012.

  1. Joel16

    Joel16 Well-Known Member

    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 :l

    this is how it is so far,
    Please help ASAP, i need to turn my assignment in soon, thank you


    Code:
    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.
     
  2. SergeantMajorME

    SergeantMajorME Active Member

    Can't say I'm the best at pascal (my school taught C++)

    However, in this part:
    For i := -1 to 6 do

    Readln (namarray );

    Readln (sesA );

    Readln (feesP );

    Readln (stat );

    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.
     
  3. Joel16

    Joel16 Well-Known Member


    oh sorry
    i meant
    "For i := 1 to 6 do"