Question

POWERSHELL: Write Multiple Functions in a script call ConversionFunctions.ps1 The first function ...

POWERSHELL:

Write Multiple Functions in a script call ConversionFunctions.ps1 The first function script ConvertToFeet($meters) is given as an example. Please complete ConvertToFahrenheit, ConvertTocelsius, ConvertToMiles, ConvertToKilometers ConversionFunctions.ps1

Function Script:ConvertToFeet($meters)

{

# Convert meters into to Feet

# 1 meter = (1 * 3.28) feet "$meters meters equals $($meters * 3.28) feet“ }

#end ConvertToFeet

Function Script:ConvertToFahrenheit($celsius)

{

# Convert celsius into Fahrenheit

# 1 celsius = ((1.8 * 1) + 32) fahrenheit "write your answer here" }

#end ConvertToFahrenheit

Function Script:ConvertTocelsius($fahrenheit)

{

# Convert fahrenheit into celsius

"write your answer here"

}#end ConvertTocelsius


Function Script:ConvertToMiles($kilometer)

{

# Convert kilometer into miles

# 1 kilometer = (1 *.6211) miles

"write your answer here"

}#end convertToMiles


Function Script:ConvertToKilometers($miles)

{

# Convert miles to kilometers

"write your answer here"

} #end convertToKilometers

0 0
Add a comment Improve this question Transcribed image text
Answer #1

ANSWER:

1. Function Script:ConvertToFahrenheit($celsius)

{

# Convert celsius into Fahrenheit

# 1 celsius = ((1.8 * 1) + 32) fahrenheit

"$celsius celsius equals $(($celsius*1.8) + 32) fahrenheit “

} #end ConvertToFahrenheit

2. Function Script:ConvertTocelsius($fahrenheit)

{

# Convert fahrenheit into celsius

# 1 fahrenheit = ((1 - 32) * 5/9) celsius

"$fahrenheit fahrenheit equals $(($fahrenheit - 32) * 5/9) fahrenheit “

} #end ConvertTocelsius

3. Function Script:ConvertToMiles($kilometer)

{

# Convert kilometer into miles

# 1 kilometer = (1 * 0.6211) miles

"$kilometer kilometer equals $($kilometer* 0.6211) miles“

} #end convertToMiles

Add a comment
Know the answer?
Add Answer to:
POWERSHELL: Write Multiple Functions in a script call ConversionFunctions.ps1 The first function ...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • 1. In Python, Write a function to convert inches into yards, feet and inches. The functions...

    1. In Python, Write a function to convert inches into yards, feet and inches. The functions should take one parameter, 'inches', and print out the number of yards, feet, and inches equivalent to the value of the argument. Call the function after prompting the user to enter the number of inches. Don't forget to convert the input to an 'int'. 2. In Python,Write a function to convert celsius to fahrenheit. The function should return a value, which you should assign...

  • Write a PowerShell script. Make sure to: Comment your script by including your name, date, and...

    Write a PowerShell script. Make sure to: Comment your script by including your name, date, and short description what the script does The script receives two arguments/parameters, first one should be a string and the second one an integer number. Both should be passed to the script as (positional) arguments/parameters Check if there are two passed parameters Check if passed parameters are as expected (check if first is string and secondis integer). You can use param() here. Displays on the...

  • Write a single C++ program that performs the following conversion (The modulus divide will help you...

    Write a single C++ program that performs the following conversion (The modulus divide will help you get the remainder as shown in class) 39 / 12 = 3 and 39 % 12 = 3, so 3 feet 3 inch(es) Height conversion 1 meter = 39 inches 12 inches = 1 foot Ask/Prompt the user to enter in the height in meters, convert and output the result in feet and inches Example 1 meters as input should produce 3 feet (foot)...

  • Assume that you run the following script: ConvertToMeters.ps1 Function Script:ConvertToMeters($feet) { "$feet feet equals $($feet*.31) meters"...

    Assume that you run the following script: ConvertToMeters.ps1 Function Script:ConvertToMeters($feet) { "$feet feet equals $($feet*.31) meters" } #end ConvertToMeters What will be the exact output of the above code if you call the function with a parameter of 20? a. 20 feet equals 62 meters b. 20 feets equal 6.2 meters c. 20 feet equals .31 meters d. 20 feet equals 6.2 meters

  • Write a Python program that can convert a Fahrenheit temperature to Celsius, or vice versa. The...

    Write a Python program that can convert a Fahrenheit temperature to Celsius, or vice versa. The program should use two custom functions, f_to_c and c_to_f, to perform the conversions. Both of these functions should be defined in a custom module named temps. Custom function c_to_f should be a void function defined to take a Celsius temperature as a parameter. It should calculate and print the equivalent Fahrenheit temperature accurate to three decimal places. Custom function f_to_c should be a value-returning...

  • FOR PYTHON Write a Python program that can convert a Fahrenheit temperature to Celsius, or vice...

    FOR PYTHON Write a Python program that can convert a Fahrenheit temperature to Celsius, or vice versa. The program should use two custom functions, f_to_c and c_to_f, to perform the conversions. Both of these functions should be defined in a custom module named temps. Custom functionc_to_f should be a void function defined to take a Celsius temperature as a parameter. It should calculate and print the equivalent Fahrenheit temperature accurate to three decimal places. Custom function f_to_c should be a...

  • Task 10: Creating functions In Windows PowerShell, you can declare functions. Functions are reusable pieces of...

    Task 10: Creating functions In Windows PowerShell, you can declare functions. Functions are reusable pieces of code that can be called as many times as you want after you declare them. In this step, you will declare a function, learn about using different types of parameters, and specify default values for these parameters. 1. In the Windows PowerShell ISE, press CTRL+N. 2. In the script pane, type the following code. function Get-Soup ( [switch] $please, [string] $soup = "chicken noodle"...

  • Write a program in C++ that gives the temperature of earth at a depth. It must...

    Write a program in C++ that gives the temperature of earth at a depth. It must be in C++ and follow the information below: Problem description Write a program to take a depth in kilometers inside the earth as input data; calculate and display the temperature at this depth in both degrees Celsius and degree Fahrenheit. The formulas are: Celsius temperature at depth in km: celsius = 10 x depth(km) + 20 Convert celsius to fahrenheit: fahrenheit = 1.8 x...

  • Please write individual functions solving each of the following problems: Print your name Print numbers 1...

    Please write individual functions solving each of the following problems: Print your name Print numbers 1 → 10 Print numbers N → M, where N and M are parameters to the function .Calculate and return a base B to an exponent E. B and E should be parameters to the function Convert Celsius to Fahrenheit Convert Fahrenheit to Celsius Take a numeric score as a parameter and return the associated letter grade Note, the functions that perform calculations should NOT...

  • Using Functions: Conversion Program: Write a program that perform conversions that we use often. Program should...

    Using Functions: Conversion Program: Write a program that perform conversions that we use often. Program should display the following menu                                                             Welcome to the Conversion Program                                                 =============================== Fahrenheit to Celsius Miles to kilometers Liters to Gallons Exit from the program You should implement this program using functions and your program need to have following functions void displayMenu() double fahrenheitToCilsuis(double fTemp) double milesToKilometers(double miles) double litersToGallons(doube liters)

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT