In: Computer Science
write program in Linux (virtual box) that will sell shoes in different prices (adidas,nike,puma) + delivery fee
*get costumer's address
*how many the customer order the shoes
*Calculate total invoice
*display the invoice to tell the user how much the order will cost
(note: take a picture with comments of the input and output) thank you
NOTE: I have completed answers for your question along with
explanation. Please check and let me know if you have any
questions. I will revert back within 24 hours. Thanks for your
patience.
Code:
#!/bin/bash
delivery_cost=300
adidas_cost=2000
nike_cost=2500
puma_cost=1500
echo "Enter customer address? "
read cust_addr
echo "Enter number of Adidas shoes you want to buy? "
read adidas_shoes
echo "Enter number of Nike shoes you want to buy? "
read nike_shoes
echo "Enter number of puma shoes you want to buy? "
read puma_shoes
adidas=`expr $adidas_shoes \* $adidas_cost`
nike=`expr $nike_shoes \* $nike_cost`
puma=`expr $puma_shoes \* $puma_cost`
total_cost=`expr $adidas + $nike + $puma`
total=`expr $total_cost + $delivery_cost`
id=`echo $$`
dat=`date`
echo
"=============================================================================================================================="
echo -e "\t\t\t\tINVOICE"
echo
"=============================================================================================================================="
echo -e "BILL TO"
echo -e "$cust_addr"
echo -e "SHIP TO"
echo -e "$cust_addr"
echo -e "\nINVOICE#\tUS-${id}\t\t\t\t\tINVOICE DATE:\t$dat"
echo
"=============================================================================================================================="
echo -e "\tINVOICE TOTAL\t\t\t\t\t\t$total"
echo
"=============================================================================================================================="
echo -e "QTY\tDESCRIPTION\tUNIT PRICE\tAMOUNT"
echo -e "\n"
echo -e "1\tAdidas Shoes\t$adidas_cost\t\t$adidas"
echo -e "2\tNike Shoes\t$nike_cost\t\t$nike"
echo -e "3\tPuma Shoes\t$puma_cost\t\t$puma"
echo -e "\n\n"
echo -e "\t\t\tSUBTOTAL: \t$total_cost"
echo -e "\t\t\tDelivery fee: \t$delivery_cost"
Code output screenshot: