#!/usr/bin/perl

@majors=("CS", "ECE", "ME", "Business", "Art", "Physics"); 
@profs=("MM", "ER", "DD", "MC", "GP", "JW", "MG", "GH", "MW", "NH", "BC");

open (student, "> student.dat") || die "problem with opening sample.dat to load data";

for ($i=0; $i <= 100; $i++) {
  $name = "A" . $i;
  $major = int (rand ($#majors + 1));
  $advisor = int (rand ($#profs + 1));
  print student $name . "," . $majors[$major] . "," . $profs[$advisor] . "\n";
}

close (student);

open (prof, "> professor.dat") || die "problem with opening sample.dat to load data";

for ($i=0; $i <= $#profs; $i++) {
  $name = $profs[$i];
  $salary = 70000 + int (rand (10)) * 10000;
  print prof $name . ",CS," . $salary . "\n";
}

close (prof);


#close b;

