Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #file: daily_needs_store.ps1
- #
- Write-Host ("`n{0,29}" -f "Affordable Daily Needs")
- Write-Host "This Program will prompt for 10 items."
- Write-Host "Enter quantity of each item purchased."
- $TaxRate = 8.25
- [float]$breadCount = Read-Host ("{0,-45}" -f "How many loaves of Bread (`$1.75 each)")
- [float]$milkCount = Read-Host ("{0,-45}" -f "How many Gallons of Milk (`$3.29 each)")
- [float]$chipsCount = Read-Host ("{0,-45}" -f "How many Bags of Chips (`$4.19 each)")
- [float]$potatoesCount = Read-Host ("{0,-45}" -f "How many Pounds of Potatoes (`$1.49 each)")
- [float]$bananasCount = Read-Host ("{0,-45}" -f "How many Pounds of Bananas (`$0.49 each)")
- [float]$beefCount = Read-Host ("{0,-45}" -f "How many Pounds of Beef (`$5.29 each) ")
- [float]$tomatoesCount = Read-Host ("{0,-45}" -f "How many Pounds of Tomatoes (`$0.99 each)")
- [float]$applesCount = Read-Host ("{0,-45}" -f "How many Pounds of Apples (`$1.29 each)")
- [float]$batteriesCount = Read-Host ("{0,-45}" -f "How many 2-packs of AA Batteries (`$2.39 each)")
- [float]$vitaminCount = Read-Host ("{0,-45}" -f "How many Bottles of Vitamin (`$4.89 each)")
- Write-Host ("{0,-50}" -f "===================================")
- Write-Host ("{0,29}" -f "Affordable Daily Needs")
- Write-Host ("{0,28}" -f "4715 San Pedro Avenue")
- Write-Host ("{0,29}" -f "San Antonio, TX 78217")
- Write-Host ("{0,27}" -f "Phone: 210-128-1919")
- Write-Host ("{0,-50}" -f "-----------------------------------")
- [float]$total = 0.0;
- [float]$totalTax = 0.0;
- [float]$subTotal = 0.0;
- $breadCost = $breadCount * 1.75
- $subTotal = $subTotal + $breadCost
- $milkCost = $milkCount * 3.29
- $subTotal = $subTotal + $milkCost
- $chipsCost = $chipsCount * 4.19
- $subTotal = $subTotal + $chipsCost
- $potatoesCost = $potatoesCount * 1.49
- $subTotal = $subTotal + $potatoesCost
- $bananasCost = $bananasCount * 0.49
- $subTotal = $subTotal + $bananasCost
- $beefCost = $beefCount * 5.29
- $subTotal = $subTotal + $beefCost
- $tomatoesCost = $tomatoesCount * 0.99
- $subTotal = $subTotal + $tomatoesCost
- $applesCost = $applesCount * 1.29
- $subTotal = $subTotal + $applesCost
- $batteriesCost = $batteriesCount * 2.39
- $subTotal = $subTotal + $batteriesCost
- $totalTax = $totalTax + ($batteriesCost * (1 + ($TaxRate/100)) - $batteriesCost)
- $vitaminCost = $vitaminCount * 4.89
- $subTotal = $subTotal + $vitaminCost
- $totalTax = $totalTax + ($vitaminCost * (1 + ($TaxRate/100)) - $vitaminCost)
- $total = $subTotal + $totalTax
- Write-Host ("{0,-10} {1,4} {2,11} {3,6}" -f "Item", "Qty", "Price/Unit", "Cost" )
- Write-Host ("{0,-50}" -f "-----------------------------------")
- Write-Host ("{0,-10} {1,4:N1} {2,9} {3,8:N2}" -f "Bread", $breadCount, "`$1.75", $breadCost )
- Write-Host ("{0,-10} {1,4:N1} {2,9} {3,8:N2}" -f "Milk", $milkCount, "`$3.29", $milkCost )
- Write-Host ("{0,-10} {1,4:N1} {2,9} {3,8:N2}" -f "Chips", $chipsCount, "`$4.19", $chipsCost )
- Write-Host ("{0,-10} {1,4:N1} {2,9} {3,8:N2}" -f "Potatoes", $potatoesCount, "`$1.49", $potatoesCost )
- Write-Host ("{0,-10} {1,4:N1} {2,9} {3,8:N2}" -f "Beef", $beefCount, "`$5.29", $beefCost )
- Write-Host ("{0,-10} {1,4:N1} {2,9} {3,8:N2}" -f "Tomatoes", $tomatoesCount, "`$0.99", $tomatoesCost )
- Write-Host ("{0,-10} {1,4:N1} {2,9} {3,8:N2}" -f "Apples", $applesCount, "`$1.29", $applesCost )
- Write-Host ("{0,-10} {1,4:N1} {2,9} {3,8:N2}" -f "Batteries", $batteriesCount, "`$2.39", $batteriesCost )
- Write-Host ("{0,-10} {1,4:N1} {2,9} {3,8:N2}" -f "Vitamins", $vitaminCount, "`$4.89", $vitaminCost )
- Write-Host ("{0,-50}" -f "-----------------------------------")
- Write-Host ("{0,-10} {1,23:c2}" -f "Subtotal", $subTotal)
- Write-Host ("{0,-10} {1,22:c2}" -f "Tax `@ 8.25`%", $totalTax)
- Write-Host ("{0,-50}" -f "-----------------------------------")
- Write-Host ("{0,-10} {1,23:c2}" -f "Total", $total)
- Write-Host ("{0,-50}" -f"===================================")
- Write-Host "Sales Clerk: John Doe"
- Write-Host "Counter#: 7"
- Write-Host "Date:"(Get-Date)
Add Comment
Please, Sign In to add comment