#!/usr/bin/perl -w #cash register and print receipt program my (@items, %qty, %price); #User input here print "Please enter your first and last name\n"; chomp (my $name = ); print "Please enter your state sales tax in percentage (i.e. 7.75)\n"; chomp (my $tax = ); $taxrate = $tax / 100; # enter loop to capture customer information here my $continue='Y'; while ($continue eq 'Y'){ print "Please enter an item or product name\n"; chomp ($itemname = ); push @item, $itemname; print "Please enter the quantity of the item\n"; chomp ($itemquantity = ); $qty{$itemname} = $itemquantity; print "Please enter the price of the item (no \$ please)\n"; chomp ($itemprice = ); $price{$itemname} = $itemprice; print "Would you like to add another item? - Y or N\n"; chomp ($continue = ); } # process subtotal and print receipt output here foreach $item (@item) { print "Item: $item\n"; $q_item = $qty{$item}; print "Quantity: $qty{$item}\n"; $p_item = $price{$item}; print "Price: \$$price{$item}\n"; $itemtotal = $q_item * $p_item; print "Item total: \$$itemtotal\n"; $subtotal += $itemtotal; print "Your current subtotal is: \$$subtotal\n"; } #print totals and tax here print "Purchase Subtotal: $subtotal\n"; print "Sales Tax Rate: $tax\n"; my $totaltax = $subtotal * $taxrate; print "Total Sales Tax = \$$totaltax\n"; my $totalamount = $subtotal + $totaltax; print "The total amount of this sale is: \$$totalamount\n"; #print the customer name and current date and time print "\n"; print "Customer: $name\n"; print "\n"; my $now = localtime time; print "Current Date and Time: $now\n";