package EmployeeList;
use diagnostics;
use strict;
use warnings;
sub new{
my ($class) = @_;
my $self = bless {
EmployeeList => []
}, $class;
return $self;
}
sub get_EmployeeList{
my $self = shift;
return $self->{EmployeeList};#does not seem to work at all, no idea why
}
sub set_EmployeeList {
my ($self, $new_EmployeeList ) = @_;
$self->{EmployeeList } = $new_EmployeeList;#also does not work at all
}
sub print_EmployeeList{
my $self = shift;
return "Employee info: $self->{EmployeeList}" #Does not even come close to working
}
sub average_hourly_wage{#not even sure where to begin, don't know how to initialize or access the hash at this point
}
sub respond_to_query{#again no idea, any help would be great, 20$ or more if you really need it
}
1;
####
#!/usr/bin/perl
use strict;
use warnings;
use Employee;
use EmployeeList;
print "Enter the name of the file to open: ";
my $input_file = ;
chomp $input_file;
open(my $file_handle, "<", $input_file) or die "failed to open < input_file: $!\n";
my @obj_array = ();
while (my $row = <$file_handle>){
my @splitrow = split ' ', $row;
my $Employee1 = Employee->new({
name =>$splitrow[0],
hourlywage =>$splitrow[1],
hours =>$splitrow[2]
});
print $Employee1->print_Employee();
push @obj_array, $Employee1;
}
####
package Employee;
use strict;
use warnings;
sub new{
my ($class, $args) = @_;
my $self = bless {
name=> $args->{name},
hourlywage => $args->{hourlywage},
hours => $args->{hours}
}, $class;
}
sub print_student{
my $self = shift;
return "Employee info: name: $self->{name} hours: $self->{hours} wage: $self->{hourlywage}\n"
}
1;