Pascal

Moderators: None (Apply to moderate this forum)
Number of threads: 4106
Number of posts: 14016

This Forum Only
Post New Thread
Single Post View       Linear View       Threaded View      f

Report
psuedo code to pascal help plz Posted by chevy560 on 26 Mar 2012 at 7:54 PM
really need help with converting this psuedocode to pascal
COUNTYOGMFEE = 0
COUNTAERMFEE = 0
COUNTGYMMFEE =0
COUNTYOG = 0
COUNTAER = 0
COUNTGYM =0
YOGATTEND_FEE =0
AERATTEND_FEE =0
GYMATTEND_FEE =0
YOGMFEETOT = 0
AERMFEETOT = 0
GYMMFEETOT = 0


PRINT “ENTER YOUR NAME. TO STOP DATA ENTRY,TYPE STOP:”
READ NAME
WHILE NAME <> “STOP” DO
PRINT “ENTER THE PROGRAM ENROLLED EITHER GYM, YOGA OR
AEROBIC”
READ PROGRAMS
PRINT “ENTER MEMERSHIP FEE FOR THE MONTH”
READ MEM_FEE
PRINT “ENTER MONTHLY ATTENDANCE FEE FOR THE MONTH”
READ ATTEND_FEE
IF MEM_FEE = 1000 THEN
MEM = “REGULAR”

ELSE
MEM= "SPECIAL"
ENDIF

IF PROGRAMS = “YOGA”' AND MEM_FEE = 1000 THEN
COUNTYOGMFEE = COUNTYOGMFEE +1
ELSE
IF PROGRAMS = “AEROBIC” AND MEM_FEE = 1000 THEN
COUNTAERMFEE = COUNTAERMFEE +1
ELSE
IF PROGRAMS = “GYM” AND MEM_FEE = 1000 THEN
COUNTGYMMFEE = COUNTGYMMFEE +1
ENDIF
ENDIF
ENDIF






IF PROGRAMS = “YOGA” THEN
COUNTYOG =COUNTYOG+1
YOGATTEND_FEE = YOGATTEND_FEE + ATTEND_FEE
YOGMFEETOT = YOGMFEETOT + MEM_FEE
ELSE
IF PROGRAMS = “AEROBICS” THEN
COUNTAER =COUNTAER+1
AERATTEND_FEE = AERATTEND_FEE + ATTEND_FEE
AERMFEETOT = AERMFEETOT + MEM_FEE
ELSE
IF PROGRAMS = “GYM” THEN
COUNTGYM =COUNTGYM+1
GYMATTEND_FEE = GYMATTEND_FEE + ATTEND_FEE
GYMFEETOT = GYMFEETOT + MEM_FEE
ENDIF
ENDIF
ENDIF





PRINT “THE NAME OF THE MEMBER ENTERED IS”, NAME
PRINT “THE STATUS OF THE MEMBER”, MEM_STAT
PRINT “ATTENDANCE FEE”, ATTEND_FEE
PRINT “MEMBERSHIP FEE IS”, MEM_FEE
PRINT “THE PROGRAM THEY PAID FOR IS”, PROGRAMS
PRINT “ENTER YOUR NAME. TO STOP DATA ENTRY, TYPE: STOP”
READ NAME
ENDWHILE
YOGFEETOT = YOGMFEETOT + YOGATTEND_FEE
GYMFEETOT= GYMFEETOT + GYMATTEND_FEE
AERFEETOT= AERFEETOT + AERATTEND_FEE
PRINT “THE TOTAL NUMBER OF MEMBERS IN YOGA IS :”, COUNTYOG
PRINT “THE TOTAL NUMBER OF MEMBERS IN GYM IS:” ,COUNTGYM
PRINT “THE TOTAL NUMBER OF MEMBERS IN AEROBIC:” , COUNTAER
PRINT “THE TOTAL NUMBER OF MEMBERS WHO PAID FOR THEIR ATTENDANCE FEE IN YOGA:” , COUNTYOGMFEE
PRINT “THE TOTAL NUMBER OF MEMBERS WHO PAID FOR THEIR ATTENDANCE FEE IN GYM:” , COUNTGYMMFEE
PRINT “THE TOTAL NUMBER OF MEMBERS WHO PAID FOR THEIR ATTENDANCE FEE IN AEROBICS:” , COUNTAERMFEE


PRINT “THE TOTAL FEES PAID IN YOGA IS:”, YOGFEETOT
PRINT “THE TOTAL FEES PAID IN GYM:”, GYMFEETOT
PRINT “THE TOTAL FEES PAID IN AEROBICS:”, AERFEETOT

plz help just to pascal and a liil explanation
Report
Re: psuedo code to pascal help plz Posted by Actor21 on 27 Mar 2012 at 2:49 AM
program pseudo ;

var     { declare all variables }
   countyogfee    : integer ;
   countaerfee    : integer ;
   countgymfee    : integer ;
   countyog       : integer ;
   countaer       : integer ;
   countgym       : integer ;
   yogattend_fee  : integer ;
   aerattend_fee  : integer ;
   gymattend_fee  : integer ;
   yogfeetot      : integer ;
   aerfeetot      : integer ;
   gymfeetot      : integer ;

   mem_fee        : integer ;
   attend_fee     : integer ;

   name           : string ;
   programs       : string ;
   mem_stat       : string ;

begin
   countyogfee    := 0 ;     { initialize variables }
   countaerfee    := 0 ;
   countgymfee    := 0 ;
   countyog       := 0 ;
   countaer       := 0 ;
   countgym       := 0 ;
   yogattend_fee  := 0 ;
   aerattend_fee  := 0 ;
   gymattend_fee  := 0 ;
   yogfeetot      := 0 ;
   aerfeetot      := 0 ;
   gymfeetot      := 0 ;
   
   write ('enter your name. to stop data entry,type stop: ') ;
   readln (name) ;
   while name <> 'stop' do begin
      write ('enter the program enrolled either gym, yoga or aerobic ') ;
      readln (programs) ;
      write ('enter memership fee for the month ') ;
      readln (mem_fee) ;
      write ('enter monthly attendance fee for the month ') ;
      readln (attend_fee) ;
      if mem_fee = 1000 then
         mem_stat := 'REGULAR'
      else
         mem_stat := 'SPECIAL' ;
      
      if (programs = 'yoga') and (mem_fee = 1000) then
         countyogfee := countyogfee + 1
      else if (programs = 'aerobic') and (mem_fee = 1000) then
         countaerfee := countaerfee + 1
      else if (programs = 'gym') and (mem_fee = 1000) then
         countgymfee := countgymfee + 1 ;
      
      if programs = 'yoga' then begin
         countyog       := countyog + 1 ;
         yogattend_fee  := yogattend_fee + attend_fee ;
         yogfeetot      := yogfeetot + mem_fee
      end
      else if programs = 'aerobics' then begin
         countaer       := countaer + 1 ;
         aerattend_fee  := aerattend_fee + attend_fee ;
         aerfeetot      := aerfeetot + mem_fee
      end
      else if programs = 'gym' then begin
         countgym       := countgym + 1 ;
         gymattend_fee  := gymattend_fee + attend_fee ;
         gymfeetot      := gymfeetot + mem_fee
      end ;
      
      writeln ('the name of the member entered is ', name) ;
      writeln ('the status of the member ', mem_stat) ;
      writeln ('attendance fee ', attend_fee) ;
      writeln ('membership fee is ', mem_fee) ;
      writeln ('the program they paid for is ', programs) ;
      writeln ('enter your name. to stop data entry, type: stop ') ;
      readln (name)
   end ;
   
   yogfeetot   := yogfeetot + yogattend_fee ;
   gymfeetot   := gymfeetot + gymattend_fee ;
   aerfeetot   := aerfeetot + aerattend_fee ;

   writeln ('the total number of members in yoga is : ', countyog) ;
   writeln ('the total number of members in gym is: ' ,countgym) ;
   writeln ('the total number of members in aerobic: ' , countaer) ;
   writeln ('the total number of members who paid for their attendance fee in yoga: ' , countyogfee) ;
   writeln ('the total number of members who paid for their attendance fee in gym: ' , countgymfee) ;
   writeln ('the total number of members who paid for their attendance fee in aerobics: ' , countaerfee) ;
   
   writeln ('the total fees paid in yoga is: ', yogfeetot) ;
   writeln ('the total fees paid in gym: ', gymfeetot) ;
   writeln ('the total fees paid in aerobics: ', aerfeetot)
end.




 

Recent Jobs