Thursday, December 5, 2019
A1 script win213 free essay sample
You work for a medium size wholesale book publisher as the system administrator. This year management has decided, at the last minute, to sell books at its annual book conference. The company as a rule does not sell its books retail, consequently management does not want to purchase an off the shelve retail sales program. Rather, you have been assigned the task of writing a PowerShell text-based program calledLearnName_SalesProgram. ps1 which will do the following. Allow the sales clerk to the following at the console: 1. Enter the book title ââ¬âdata type string. If the user enters a null string, the program should beep and redisplay the needed value 2. Enter a one sentence description of the book ââ¬â data type string 3. Enter the bookââ¬â¢s ID number. Code numbers are alpha-numeric (e. g. ROM482,SCI233,BUS400). If the user enters a numeric value, the program should prompt for alphanumeric 4. Enter the list price of the book with a dollar sign and decimal format ââ¬âdata type decimal 5. We will write a custom essay sample on A1 script win213 or any similar topic specifically for you Do Not WasteYour Time HIRE WRITER Only 13.90 / page If the user does not enter a numeric value the program should prompt for a numeric value 6. Calculate the harmonized tax rate (HST) of 12% (list price X . 12 = tax payable) ââ¬â data type constant. Display the tax payable and total purchase price for the book to the customer. (tax + list price = purchase price)- data type decimal 7. Output the above information to a file called BookSalesConference2014. txt in the following 8. Optional: include a running total called ââ¬Å"Total Book Sales:â⬠which is saved to the file 9. The file format should look like the following: ______________________________________ Title of Book: Description: Code Number: List Price: Tax Payable: Purchase Price: _______________________________________ Total Book Sales: (optional) Set-Variable TaxRate -Option Constant -value . 12 if ( (Test-Path . \BookSalesConference2014. txt) -ne ââ¬Å"Trueâ⬠){ New-Item -Type File . \BookSalesConference2014. txt } Clear-Host [string]$Title = Read-Host ââ¬Å"Book Titleâ⬠while ( $Title -eq ââ¬Å"â⬠) { [console]::beep(1000,500) $Title = Read-Host ââ¬Å"Please Enter Book Title Againâ⬠} [string]$Description = Read-Host ââ¬Å"Book Descriptionâ⬠[string]$CodeNmeber = Read-Host ââ¬Å"Code Numberâ⬠while ( $CodeNmeber -match ââ¬Å"^\d+$â⬠) { $CodeNmeber = Read-Host ââ¬Å"The Code Nmubers Are Alpha-numeric. Please Enter Againâ⬠} [string]$InputPrice = Read-Host ââ¬Å"List Price ââ¬Å" while ( $InputPrice -notmatch ââ¬Å"^\$[0-9]+(\. [0-9]{0,2})? $â⬠) { $InputPrice = Read-Host ââ¬Å"The Prices Are Dollar Sign Plus Numeric. Please Enter Againâ⬠} [Decimal]$ListPrice=$InputPrice. Remove(0,1) [Decimal]$Tax=$ListPrice * $TaxRate [Decimal]$PurchasePrice=$ListPrice+$Tax Write-Host ââ¬Å"Tax Payable: $â⬠$Tax Write-Host ââ¬Å"Purchase Price: $â⬠$PurchasePrice Write-Output ââ¬Å"________________________________________________________________â⬠. \BookSalesConference2014. txt
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment
Note: Only a member of this blog may post a comment.