0

doing pascal at college need some help with this as it is doing my nut in this the program i have a company called brians building firm i have to put to screen a menu with 4 choices 1 min/max sales 2 average sales 3 attendance figers and 0 for quit these sales will appear on screen as a bar or table chart i have the problem were it says operhand types do not match operator here it highlights on the in bit of the code if you could help me i would appreciate it so much give me a shout at my email address cheers.

program get_option;
      begin
              repeat
                       writeln('viewing data');
                       writeln('press T for table of data');
                       writeln('press B for chart of data');
                       readln;
                       if not option in ['T','t','B','b']then
                       writeln('invalid option');
                       untill option in ['T','t','B','b']
                 end{repeat}
          end

the whole program code will be attached.
[Email snipped]

Edited by pyTony: fixed formating

Attachments
program build;
{brian colston}
uses crt;
const
max=20;
var
     attendance:array[1..max] of integer;
         index:integer;
       numdays:integer;
       highest:integer;
        lowest:integer;
       average:real;
       counter:integer;
count1,count2,count3,count4,count5:integer;
        option:char;
        choice:char;
    month_file:text;

procedure table_output;
          begin
               clrscr;
               gotoxy(25,8);
               textcolor(green);
               writeln('brians building firm');
               gotoxy(27,8);
               writeln('table');
               gotoxy(28,8);
               writeln('0 < 500',count1);
               gotoxy(29,0);
               writeln('500 < 1000',count2);
               gotoxy(30,1);
               writeln('1000 < 1500',count3);
               gotoxy(31,1);
               writeln('1500 < 2000',count4);
               gotoxy(32,0);
               writeln('2000 < 2500',count5);
               gotoxy(33,0);
               writeln('press 0 to quit');
               readkey;
               end;

procedure bar_output;
begin
               clrscr;
               gotoxy(25,8);
               textcolor(white);
               writeln('brians building firm');
               gotoxy(27,8);
               writeln('0< 500');
           for counter:= 1 to count1 do
               readln;
               gotoxy(28,0);
               writeln('500<1000');
           for counter:= 2 to count2 do
               readln;
               gotoxy(29,0);
               writeln('1000<1500');
           for counter:= 3 to count3 do
               readln;
               gotoxy(30,1);
               writeln('1500<2000');
           for counter:= 4 to count4 do
               readln;
               gotoxy(31,0);
               writeln('2000<2500');
           for counter:= 5 to count5 do
               readln;
           end;{for}

procedure get_option;
          begin
               repeat
                     writeln('viewing data');
                     writeln('press T for Table of data');
                     writeln('press B for Bar chart of data');
                     readln;
                     if not option in['T','t','B','b'] then
                            writeln('invalid option');
                     until  option in['T','t','B','b']
            end;

procedure act_on_option;
    begin
          case option of
           'T','t':writeln('table_output');
           'B','b':writeln('bar_output');
          end;{case}
      end;

procedure calc_freq;
    begin
          count1:=0;
          count2:=0;
          count3:=0;
          count4:=0;
          count5:=0;
          for(index):=attendance[1..max]array numdays do
                  if attendance[index]<500 then
                           count1 = count1 + 1
                  else if attendance[index]< 1000 then
                           count2 = count2 + 1
                  else if attendance[index]< 1500 then
                           count3 = count3 + 1   then
                  else if attendance[index]< 2000 then
                           count4 = count4 + 1
                  else
                           count5 = count5 +1
                  end{if}
          end;{for}
      end;
procedure display_grouped;
                     begin
                          writeln('calc_freq');
                          writeln('exec_sub_menu');
                       end;
procedure display_minmax;
          begin
               clrscr;
               gotoxy(25,8);
               textcolor(Green);
               highest=0;
               lowest=32000;
               for index from 1 to numdays do
                   if sales[index]>highest then
                             highest = attendance[index]
                   end;{if}
                   if sales[index]<lowest then
                             lowest = attendance[index]
                   end;{if}
               end;{for}
               writeln('maximum sales');
               writeln('minimum sales');
           end;


procedure display_average;
          begin
               clrscr;
               gotoxy(25,8);
               textcolor(green);
               total=0;
               for index from 1 to numdays do
                   total=total+attendance[index]
               end;{for}
               average = total/numdays;
               writeln('display average daily attendance is,'average');
          end;

procedure act_on_choice;
     begin
          case choice of
                        writeln'1':minmax;
                        writeln'2':average;
                        writeln'3':grouped;
                        writeln'0':quit;
               end;{case}
       end;
procedure get_choice;
     begin
          repeat
               clrscr;
               gotoxy[25,8];
               textcolor(green);
               writeln('Brians building firm');
               writeln('month_file_stats');
               writeln('main_menu');
               writeln('1' minmax attendance');
               writeln('2' average attendance');
               writeln('3' grouped data');
               writeln('0' exit');
               accept choice
               if not choice in['0','1','2','3']then
                      writeln('error invalid choice');
               end;{if}
          until choice in['0','1','2','3'];
     end;
procedure processs_choice;
begin
      clrscr;
      gotoxy(25,8);
      textcolor(green);
      writeln('brian's building firm');
      readln;
      case choice of
      gotoxy(25,8);
      1.list staff and_sales;
      gotoxy(25,8);
      2.list highest_and_lowest_names_and_sales;
      gotoxy(25,8);
      3.list average_sales_and_above;
      gotoxy(25,8);
      4.chart_menu;
      0.quit;
      end;{case}
end;


procedure exec_menu;
begin
      clrscr;
      gotoxy(25,8);
      textcolor(green);
      writeln('brian building firm');
      gotoxy(25,10);
      writeln('this procedure will display menu');
      gotoxy(25,12);
      writeln('press 0 to_return to_main_menu');
      readkey;
end;

procedure get_attendance;
begin
     writeln('month_file');
     while not EOF(month_file)and index<=max do
           read month_file into attendance[index]
           index=index + 1
     end{while}
     numdays = index-1
     close month_file;
end;


begin
     writeln('month_file_from disk(F:pascal\month_file));
     readln;
     repeat
     writeln('display main menu');
     until choice:=quit;
     end{repeat}
end.
2
Contributors
1
Reply
2
Views
11 Years
Discussion Span
Last Post by Jackrabbit
This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.