Use the functions char toUpper(char) to check if a char is a lowercase alphabetic value. If it is, return the uppercase equivalent. If it isn’t, return the original char.
Assignment: Functions
void printBanner() – This function should open the file “banner.txt” in the same directory as the program, and print it’s contents to the terminal. It does not depend on any other functions.
Assignment: Functions
double s_to_d(string) – Converts a decimal number saved as a string to a decimal number saved as a float. Follows the given steps.
1. Create a double accumulator.
2. Find the index i of the decimal point (‘.’).
1. If no decimal point exists, set i to the length of the string.
3. Iterate over each character in the string with the iterator j.
1. If i – j is positive,
1. Pass the current character into c_to_i(char)
2. raise 10 to the power of the i – j – 1 with the myPow(int, int) function.
3. multiply these two results.
4. Add this result to the accumulator.
2. else if i – j is negative,
1. Pass the current character into c_to_i
2. raise 10 to the power of i – j.
3. multiply these two results.
4. Add this result to the accumulator.
4. Return the accumulator.
Assignment: Functions
char toUpper(char) – checks if a char is a lowercase alphabetic value. If it is, return the uppercase equivalent. If it isn’t, return the original char. Depends on no other functions.
string toUpper(string) – iterates over each character in the string and capitalizes it with the toUpper(char) function. Depends on the toUpper(char) function.
string fixNum(string) – returns a string with the following replacements made to the string argument:
Before: After:
O 0
I 1
E 3
S 5
aa 7
int c_to_i(char letter) – Checks if a char is numeric. If it is, return the integer equivalent. If it is not, return -1. Depends on no other functions.
double myPow(int, int) – Returns the first argument raised to the power of the second argument. (Be careful, this function should work for all positive and negative integers).
Assignment:
void printBanner() – This function should open the file “banner.txt” in the same directory as the program, and print it’s contents to the terminal. It does not depend on any other functions.
void showMenu() – This function should print a menu to display the following options:
1. Enter an input file
2. Enter an output file
3. Clean input file
4. Quit
It does not depend on any other functions.
string getInputFile() – prompts the user for an input file name. Returns the user’s choice as a string. This function does not depend on any other functions.
string getOutputFile() – prompts the user for an output file name. Returns the user’s choice as a string. This function does not depend on any other functions.
Consider a system with 13 dedicated devices of the same type and all jobs currently running on this system require a maximum of three devices to complete their execution but they each run for long periods of time with just two devices and request the remaining one only at the very end of the run. Assume that the job stream is endless and that your operating system’s device allocation policy is a very conservative one: No job will be started unless all the required drives have been allocated to it for the entire duration of its run. Explain what are the minimum and maximum numbers of devices that may be idle as a result of this policy.