Question: Write a program that has two command line arguments. One argument describes a filename and the other is related to the verbosity of the application.
Write a program that has two command line arguments. One argument describes a filename and the other is related to the verbosity of the application.
1. Argument -f is required and it is used to give a filename for the application. It needs a value.
If this argument isn't present, print out No file specified! (use the -f argument) and stop the execution of the application
2. Argument -v is optional and it has no value
If -v argument is not given, the program prints the full value of the - f argument
If the -v argument is given, the program prints out the value of the - f argument without the file extension
3. The arguments can be given in any order.
4. Examples
dotnet run -- -f file.txt -v prints file
dotnet run -- -f file.txt prints file.txt
dotnet run -- -v -f file.txt prints file
5. Misc
You can assume the filename is always in the format . so there's no need to check if that's the case.
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
