For many people, it is back-to-school time. This time of years always makes The Chairman nostalgic, so he has commissioned a new set of PowerShell scripting challenges. These tasks are aimed at beginner level PowerShell scripters, with a few bonuses targeted toward intermediate users. Although everyone is welcome and encouraged to try their hand.
You need to create simple PowerShell functions to meet the following goals. Each task should result in a separate function.
- Given 2 lengths of a right triangle, calculate the missing length. You will need to let the user specify which sides (traditionally A,B and C) of the triangle they are specifying.
- Calculate the area of a circle with a given diameter.
- Calculate the volume of a sphere with a given diameter.
- Calculate the volume of a cylinder from a given diameter and height.
- Calculate the factorial of an integer.
For those of you with a bit more PowerShell experience, your functions should include parameter validation and error handling. Your function should have an option to write a rich object to the pipeline. For example, the first challenge might have you write an object with properties of A, B, and C. Finally, you should be able to create a simple module with a manifest.
As with all challenges, please submit links to your work in the comments and not the code itself.
And it is OK to ask your kids for help. 😉