Health Hazards
May 10, 2020
Engaging with Inuit knowledge of environmental change in the climatological research
May 11, 2020
Show all

3 functions in PowerShell

1)    Write a function called Get-DecimalNumber which will do the following:
    Test if the file conversions.csv exists, and if not display a warning message, create it and suppress all output to the console
    Validate user input as an integer (1-255) has been entered. If incorrect input is given display a message and exit.
    Convert the decimal input to hexadecimal and binary using string methods and display the result
    Send the output to a hash table and append to conversions.csv

2)Write a function called Get-HexadecimalNumber which will to the following:

    Test if the file conversions.csv exists, and if not display a warning message, create it and suppress all output to the console
    Validate user input that as a hexadecimal number beginning with “0x” (0x2A). If incorrect input is given display a message and exit.
    Remove the “0x” from input and convert to decimal and binary. Display the result
    Send the output to a hash table and append to conversions.csv

3)    Write a function called Get-BinaryNumber which will to the following:

    Test if the file conversions.csv exists, and if not display a warning message, create it and suppress all output to the console
    Validate user input that a binary number, string of 0’s and 1’s, was entered. If incorrect input is given display a message and exit.
    Convert the binary input to decimal and hexadecimal and display the result
   
    Send the output to a hash table and append to conversions.csv

Leave a Reply

Your email address will not be published. Required fields are marked *