Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon. Entire thread

help

Name: Anonymous 2011-04-04 7:42

print "please enter the retail price ";
$retailPrice=<STDIN>;
print "Please enter the transaction code ";
$transCode=<STDIN>;
chomp $transCode;
print "Please enter employee number ";
$empNum=<STDIN>;
if ($transCode eq "S")
{
$comm=$retailPrice*.05
}
else
{
if ($transCode eq "M")
{
$comm=$retailPrice*.07
}
else
{
if (transCode eq "L")
{
$comm=$retailPrice*.10
} #end if ($transCode eq "M")
} #end if ($transCode eq "M")
} #end if ($transCode eq "S")
print "Retail price is ". $retailPrice;
print "Commision is ". $comm;
print "Employee number is ". $empNum;

Name: Anonymous 2011-04-04 13:00

op here
that was my fix above BTW, i only started learning perl 4 weeks ago and i have never tried any language before. im well aware that there is probably better languages out there but this is the one the lecturers at my uni thought they should start us on.

i'm also more than aware that there are shorter ways to do this (elsif) but the way it is written was how i was a instructed to write it. it is ofcourse my fault for not including the brief given to us but in the end all i ask was why the last to print statements are on the same line.

Newer Posts
Don't change these.
Name: Email:
Entire Thread Thread List