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
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started