Create a program that determine the shipping cost for an order based on the following table:

From
$0.00
$20.00
$50.00
$75.00

To
$19.99
$49.99
$79.99
$1000.00

Price
$2.95
$3.95
$4.95
Free

2 answers

here's some perl. Modify to suit your needs:

@cost = (0.00,0.00,20.00,50.00,75.00);
@ship = (0.00,2.95,3.95,4.95,0.00);
while (1) {
print "Enter order amount: \$";
$c = <STDIN>;
for ($i = $#cost ; $i > 0 ; $i--) {
last if $c >= $cost[$i];
}
printf "Shipping: \$%4.2f\n",$ship[$i];
}
My teacher said this is not the right. Were doing Raptor Program.