2. Notice that the main program is initiated like a function:
Is the main program a function? If so, how is it used like a function by other programs? Give examples
3. Show how you might write a "case" statement using only the "if" statement instead of an actual case statement. Hint: Nested if statements. Explain your code
4. How would you error check the users' input to make sure the input was a number, letter, or string?
(In your final IA program you will prompt the user to select a currency to be converted. They will have the options of picking one of five currencies.)
Please enter a '1' for Canada Dollars
Please enter a '2' for Aus Dollars
Please enter a '3' for Japan Yen
Please enter a '4' for Euros
Please enter a '5' for British Pound
How would I know if the user entered an 'A' for example instead of a '1'?
1. What are the advantages and disadvantages of using functions, in your software code, in a software development project? Give some examples.
- Functions are building blocks in any software development. Without functions a program would look like one big function which implements everything needed by the program. In this case:
- Testing and debugging would be very challenging
- Reading and understanding the code would be almost impossible
Using functions eliminates these drawbacks.
The only disadvantage of using functions would be their excessive usage if any. One should introduce functions judiciously.
Some times one may introduce a function, which will be called only once - that is fine, as long as, the function represents a logical unit of implementation. For instance, in ...
The expert examines computer programming code functions. THe main program initiated like a function is determined.