Posted by alhaji on Monday, September 10, 2012 at 11:47pm.
.
maybe you can work with this as a model
@p = ();
$st = 0;
for ($i=1 ; $i <= 3 ; $i++) {
print "Price of item #$i: ";
$v = <STDIN>; chomp $v;
$p[$i] = $v;
$st += $v;
}
$tax = $st * 0.06;
$total = $st + $tax;
print "\nItem Price\n";
for ($i=1 ; $i <= 3 ; $i++) {
printf "%4d %12.2f\n",$i,$p[$i];
}
printf "%s\n","-"x17;
printf "subtotal: %7.2f\ntax: %12.2f\ntotal: %10.2f\n",$st,$tax,$total
sample run:
perl jiskha1.pl
Price of item #1: 1763.2
Price of item #2: .85
Price of item #3: 12
Item Price
1 1763.20
2 0.85
3 12.00
-----------------
subtotal: 1776.05
tax: 106.56
total: 1882.61
Related Questions
Programming in c++ - Write a program in c++ that inputs a number [1-12] from the...
computers - Which of the following operating system types is used in medical ...
computer science - write a program that prompts the user to input three numbers...
Computer Science - 1.Write an Assembly program that reads in a number of cents. ...
computer science - Write a program that prompts the user to input three numbers...
computer science - Write an Assembly program to determine the price of a car ...
CIS 115 - I need help with the visual logic flowchart for the following problem...
programming logic - The program will accept user input to store the student'...
programming - Using Raptor, create a condition loop that will ask the user for ...
programming - write a program that maintains two parallel arrays. after th ...
For Further Reading