# Computer Science

## Corpoarate Assets Risk Summary

ECE 175: Computer Programming for Engineering Applications Homework Assignment 6

Due: Tuesday March 12, 2019 by 11.59 pm Conventions: Name your C programs as hwxpy.c where x corresponds to the homework number and y corresponds to the problem number. For example, the C program for homework 6, problem 1 should be named as hw6p1.c. Write comments to your programs. Programs with no comments will receive PARTIAL credit. For each program that you turn in, at least the following information should be included at the top of the C file:

– Author and Date created – Brief description of the program: – input(s) and output(s) – brief description or relationship between inputs and outputs

Submission Instructions: Use the designated Dropbox on D2L to submit your homework. Submit only the .c files.

Problem 1 (15 points) Write a program that returns the minimum value and its location, max value and its location and average value of an array of integers. Your program should call a single function that returns that min and its location, max and its location and mean value of the array. Print the results in the main function (not within the array_func function). See sample code execution below. The declaration of this function is given below:

void array_func (int *x, int size, int *min_p, int *minloc_p, int *max_p, int *maxloc_p, double *mean_p)

/* x is a pointer to the first array element size is the array size min_p is a pointer to a variable min in the main function that holds the minimum minloc_p is a pointer to a variable minloc in the main function that holds the location where the minimum is. max_p is a pointer to a variable max in the main function that holds the maximum maxloc_p is a pointer to a variable maxloc in the main function that holds the location where the maximum is. mean_p is a pointer to a variable mean in the main function that holds the mean */

Declare the following array of integers within the main function: Sample code execution:

int data_ar[] = { -3, 5, 6, 7, 12, 3, 4, 6, 19, 23, 100, 3, 4, -2, 9, 43, 32, 45, 32, 2, 3, 2, -1, 8 }; int data_ar2[] = { -679,-758,-744,-393,-656,-172,-707,-32,-277,-47,-98,-824,-695, -318,-951,-35,-439,-382,-766,-796,-187,-490,-446,-647}; int data_ar3[] = {-142, -2, -56, -60, 114, -249, 45, -139, -25, 17, 75, -27, 158, -48, 33, 67, 9, 89, 33, -78, -180, 186, 218, -274};

2

Problem 2 (20 points): A barcode scanner verifies the 12-digit code scanned by comparing the code’s last digit to its own computation of the check digit calculated from the first 11 digits as follows:

1. Calculate the sum of the digits in the odd-numbered indices (the first, third, …, ninth digits) and multiply this sum by 3.

2. Calculate the sum of the digits in the even-numbered indices (the 0th, second, … tenth digits).

3. Add the results from step 1 and 2. If the last digit of the addition result is 0, then 0 is the check digit. Otherwise, subtract the last digit of the result from 10 to calculate the check digit.

4. If the check digit matches the last digit of the barcode, the barcode is valid.

Write an interactive C program that prompts the user to enter the 12 digits of a barcode separated by spaces. The program should store the digits in an integer array (-10 points if the array is NOT used in your program), calculate the check digit, and compare it to the last digit of the barcode. If the digits match, output with the message “barcode is validated.” If not, output with the message “error in barcode.” See sample code execution below: Note: loop structure should be used to access the array in step 1 and 2 above. Sample code execution (Red entered by a user)

Enter 12-digit barcode (separate each digit by space) 0 7 9 4 0 0 8 0 4 5 0 1 sum of digits in the odd-numbered indices = 16 sum of digits in the even-numbered indices = 21 sum from the first 11 digits = 69 barcode is valid Continue (q/Q to quit): y Enter 12-digit barcode (separate each digit by space) 0 1 1 1 1 0 8 5 6 8 0 7 sum of digits in the odd-numbered indices = 15 sum of digits in the even-numbered indices = 16 sum from the first 11 digits = 61 error in barcode Continue (q/Q to quit): y Enter 12-digit barcode (separate each digit by space) 0 1 1 1 1 0 8 5 6 8 2 7 sum of digits in the odd-numbered indices = 15 sum of digits in the even-numbered indices = 18 sum from the first 11 digits = 63 barcode is valid Continue (q/Q to quit): y Enter 12-digit barcode (separate each digit by space) 0 2 4 0 0 0 1 6 2 8 6 9 sum of digits in the odd-numbered indices = 16 sum of digits in the even-numbered indices = 13 sum from the first 11 digits = 61 barcode is valid Continue (q/Q to quit): q

For the barcode 0 7 9 4 0 0 8 0 4 5 0 1 => sum of odd = 7 + 4 + 0 + 0 + 5 = 16 => sum of even = 0 + 9 + 0 + 8 + 4 + 0 = 21 => sum from first 11 digits = 16*3 + 21 = 69 Since the last digit of 69 is 9 (not 0), check digit = 10 – 9 = 1 Since 1 (from the line above) = the last digit of the barcode => valid barcode

3

Problem 3 (35 points): Write an interactive C program that lets a user play a game of Hangman 1) Your program gets the secret word (7 letters in each word) by calling the given function:

void get_word(char word[]) { char WORD[][8] = { “program”, “puzzles”, “squeeze”, “circuit”, “devoted”, “journey”, “version”, “totally”, “respect” }; int i, num; num = (rand() % 9); for (i = 0; i sum of odd = 7 + 4 + 0 + 0 + 5 = 16 => sum of even = 0 + 9 + 0 + 8 + 4 + 0 = 21 => sum from first 11 digits = 16*3 + 21 = 69 Since the last digit of 69 is 9 (not 0), check digit = 10 – 9 = 1 Since 1 (from the line above) = the last digit of the barcode => valid barcode

3

Problem 3 (35 points): Write an interactive C program that lets a user play a game of Hangman 1) Your program gets the secret word (7 letters in each word) by calling the given function:

void get_word(char word[]) { char WORD[][8] = { “program”, “puzzles”, “squeeze”, “circuit”, “devoted”, “journey”, “version”, “totally”, “respect” }; int i, num; num = (rand() % 9); for (i = 0; i < 7; i++) //exclude NULL word[i] = WORD[num][i]; }

Suggestion: During the time that you implement your code, pick one word to test your code and hard-code it in your main program, i.e. char word[7] = "squeeze"; After your code works, call the get_word function to randomly pick a secret word. 2) In your main program, include the followings (so that the rand() function in get_word works correctly)

#include // enable use of rand() #include // enable use of time()

and srand((int)time(0));

3) Initially the program prints on the screen the number of letters of the word to be guessed. This is in the form of successive stars (see sample code execution on the next page).

The player makes a guess on the letters belonging to the secret word one by one. At each step, the program prints on the screen the letters that have been guessed, and the number of wrong guesses. The program terminates when either

a) all letters have been guessed correctly (the player wins) or b) 7 guesses have been made (the player loses).

Your program must be modular. Create at least TWO meaningful functions that abstract details such as printing the word after a letter guess is attempted or searching for a letter within a word.

Suggestion: Use another array, guessed, to keep track of the solution so far. Initialize all elements of guessed to the ‘*’ symbol. Each time a letter in word is guessed correctly, replace the corresponding ‘*’ in guessed with that letter.

4

Sample code execution for word squeeze Red entered by a user Lab 6 Assignment (30 points) – you will complete this during the week of March 11-15, 2019

Let’s play Hangman. The secret word is: ******* Guess a letter: e e was found 3 times in the secret word ***ee*e Guess a letter: t t is not in the secret word, You have 6 tries left. ***ee*e Guess a letter: z z was found 1 times in the secret word ***eeze Guess a letter: a a is not in the secret word, You have 5 tries left. ***eeze Guess a letter: q q was found 1 times in the secret word *q*eeze Guess a letter: s s was found 1 times in the secret word sq*eeze Guess a letter: y y is not in the secret word, You have 4 tries left. sq*eeze Guess a letter: u u was found 1 times in the secret word squeeze Congratulations! You found the secret word: squeeze

Let’s play Hangman. The secret word is: ******* Guess a letter: a a is not in the secret word, You have 6 tries left. ******* Guess a letter: t t is not in the secret word, You have 5 tries left. ******* Guess a letter: s s was found 1 times in the secret word s****** Guess a letter: u u was found 1 times in the secret word s*u**** Guess a letter: x x is not in the secret word, You have 4 tries left. s*u**** Guess a letter: o o is not in the secret word, You have 3 tries left. s*u**** Guess a letter: m m is not in the secret word, You have 2 tries left. s*u**** Guess a letter: w w is not in the secret word, You have 1 tries left. s*u**** Guess a letter: k k is not in the secret word, You have 0 tries left. s*u**** Game over! The secret word was: squeeze

#include // enable use of rand() #include // enable use of time()

and srand((int)time(0));

3) Initially the program prints on the screen the number of letters of the word to be guessed. This is in the form of successive stars (see sample code execution on the next page).

The player makes a guess on the letters belonging to the secret word one by one. At each step, the program prints on the screen the letters that have been guessed, and the number of wrong guesses. The program terminates when either

a) all letters have been guessed correctly (the player wins) or b) 7 guesses have been made (the player loses).

Your program must be modular. Create at least TWO meaningful functions that abstract details such as printing the word after a letter guess is attempted or searching for a letter within a word.

Suggestion: Use another array, guessed, to keep track of the solution so far. Initialize all elements of guessed to the ‘*’ symbol. Each time a letter in word is guessed correctly, replace the corresponding ‘*’ in guessed with that letter.

4

Sample code execution for word squeeze Red entered by a user Lab 6 Assignment (30 points) – you will complete this during the week of March 11-15, 2019

Let’s play Hangman. The secret word is: ******* Guess a letter: e e was found 3 times in the secret word ***ee*e Guess a letter: t t is not in the secret word, You have 6 tries left. ***ee*e Guess a letter: z z was found 1 times in the secret word ***eeze Guess a letter: a a is not in the secret word, You have 5 tries left. ***eeze Guess a letter: q q was found 1 times in the secret word *q*eeze Guess a letter: s s was found 1 times in the secret word sq*eeze Guess a letter: y y is not in the secret word, You have 4 tries left. sq*eeze Guess a letter: u u was found 1 times in the secret word squeeze Congratulations! You found the secret word: squeeze

Let’s play Hangman. The secret word is: ******* Guess a letter: a a is not in the secret word, You have 6 tries left. ******* Guess a letter: t t is not in the secret word, You have 5 tries left. ******* Guess a letter: s s was found 1 times in the secret word s****** Guess a letter: u u was found 1 times in the secret word s*u**** Guess a letter: x x is not in the secret word, You have 4 tries left. s*u**** Guess a letter: o o is not in the secret word, You have 3 tries left. s*u**** Guess a letter: m m is not in the secret word, You have 2 tries left. s*u**** Guess a letter: w w is not in the secret word, You have 1 tries left. s*u**** Guess a letter: k k is not in the secret word, You have 0 tries left. s*u**** Game over! The secret word was: squeeze

 Asset Under Review: Customer Realtionship Management System Financial Loss Legal Impacts Embarrassment Probability – Impact Risk Score Possible Safeguards Safeguard Cost Unauthorized Disclosure 0 0 0 0 0 Unauthorized Modification 0 0 0 0 0 Unavailability 0 0 0 0 0 Unauthorized Destruction 0 0 0 0 0 Unauthorized Access 0 0 0 0 0 Assessment Analysis Summary: Asset Under Review: Supply Chain Management System Financial Loss Legal Impacts Embarrassment Probability – Impact Risk Score Possible Safeguards Safeguard Cost Unauthorized Disclosure 0 0 0 0 0 Unauthorized Modification 0 0 0 0 0 Unavailability 0 0 0 0 0 Unauthorized Destruction 0 0 0 0 0 Unauthorized Access 0 0 0 0 0 Assessement Analysis Summary: Asset Under Review: Employee Training System Financial Loss Legal Impacts Embarrassment Probability – Impact Risk Score Possible Safeguards Safeguard Cost Unauthorized Disclosure 0 0 0 0 0 Unauthorized Modification 0 0 0 0 0 Unavailability 0 0 0 0 0 Unauthorized Destruction 0 0 0 0 0 Unauthorized Access 0 0 0 0 0 Assssement Analysis Summary: Asset Under Review: Enterprise Data Center Financial Loss Legal Impacts Embarrassment Probability – Impact Risk Score Possible Safeguards Safeguard Cost Fire 0 0 0 0 0 Water Damage 0 0 0 0 0 Production Environment Unavailability 0 0 0 0 0 Development Environment Unavailability 0 0 0 0 0 Loss of Facilities Power 0 0 0 0 0 Primary Network Area Storage Device Unavailabity 0 0 0 0 0 Theft of Computing Equipement 0 0 0 0 0 Unauthorized Access into EDC 0 0 0 0 0 Assessment Analysis Summary: Complete a qualitiative risk assessment and summary analysis for the each of the corpoarate assets using the predefined risk tables above and cooresponding refernce table on the reference tab in the workbook.

## Occupation Analysis

 Asset Under Review: Corporate Financial Data Vulnerability Total Occupation Unauthorized Access Unauthorized Modification Unauthorized Disclousure Distruction Chief Executive Officer 0 Chief Financial Officer 0 Chief Information Systems Officer 0 Chief Technology Officer 0 Executive Secretary 0 Director of Engineering 0 VP Finance & Accounting 0 VP Human Resources 0 Senior Accountatnts -CPA 0 Junior Accountants 0 Director of Telecommunications 0 Director of Enterprise Applications 0 Senior Application Developer 0 Junior Application Devloper 0 Database Administrator 0 Network Administrator 0 Production Supervisor 0 Manager of Facilities Maintenance 0 Helpdesk Technician 0 Shipping Clerk 0 Risk Level Value Greatest Risk 6 Great Risk 5 Moderate Risk 4 Limited Risk 3 Low Risk 2 No Risk 1 Completet the occupation analysis Table above and then evaluate the results and answer the quetsions below How is this analysis Useful? Which occupations pose the highest risks to unauthorized modification to corpoarte financial data? Which occupations pose the least risks to unauthorized modification to corpoarte financial data? What safegauards would you implement to help prevent the unauthorized authorization of corporate finainical data? Are there other positions or occupations not examined in this analysis that should be included in this analysis?

## Decision Tree

 CRM Decision Tree Diagarm Examine the decisoon treet diagarem above; next complete each of the decision trree branch analysis using the tables below; evaluate the final results and answer the question as to your recommnedation for the best option Custom Development Branch 1 Cost High Moderate Low Branch Total Value In-House Development Probability Value Total Probability Value Total Probability Value Total \$10,000,000 0.10 \$12,000,000 \$1,200,000 \$10,000,000 \$0 0.70 \$0 \$1,200,000 -\$8,800,000 Branch 2 Cost High Moderate Low Outsource Development Probability Value Total Probability Value Total Probability Value Total \$9,700,000 \$0 0.60 \$0 \$6,000,000 \$0 \$0 -\$9,700,000 COTS Branch 1 Cost High Moderate Low Branch Total Value On-Premise COTS Probability Value Total Probability Value Total Probability Value Total \$7,500,000 \$15,000,000 \$0 \$0 0.20 \$0 \$0 -\$7,500,000 Branch 2 Cost High Moderate Low Hosted COTS Probability Value Total Probability Value Total Probability Value Total \$6,500,000 0.80 \$0 \$0 0.10 \$0 \$0 -\$6,500,000 Which option would provide the best overall value and why? * Note: one of the branch values should resullt in a negative number.

## References

 Financial Loss Valuation Score Threat Vulnerability Work Table Less than \$2,000 1 Impact Between \$2K and \$20K 2 Low Medium High Between \$20K and \$50K 3 Probability High 3 6 9 Between \$50K and \$100K 4 Medium 2 5 8 Between \$100K and \$300K 5 Low 1 4 7 Between \$300K and \$500K 6 Between \$500K and \$1M 7 Between \$1M and \$5M 8 Between \$5M and \$10M 9 Between \$10M and \$30M 10 Between \$30M and \$100M 11 Greater Than \$100M 12 Legal Implication Valuation Score Under \$5K 1 Between \$5K and \$10K 4 Between \$10K and \$50K 5 Between \$50K an \$1M and/or CIO liable for prosecution 8 Over \$1M and/or Officers and/or Directors Liable 10 Enterprise Embarrassment Valuation Score Embarrasment restricted to within the project of work site 1 Embarrassment spread to other work areas of operating group or division 2 Embarrassment spread throughout the enterprise 3 Public made aware thorugh local press 5 Adverse national press 7 Stcok proce impacted 10 Priority Score Low 1 Low to Medium 2 Medium 3 Medium to High 4 High 5 Annual Loss Multiplier Table Occurrence Frequency Multplier Never 0.000 Once in 300 Years 0.003 Once in 200 Years 0.005 Once in 100 Years 0.010 Once in 50 Years 0.020 Once in 25Years 0.040 Once in 10 Years 0.100 Once in 5 Years 0.200 Once in 2 Years 0.500 Yearly 1.000 Twice a Year 2.000 Once a Month 12.000 Once a Week 52.000 Once a Day

Order now and get 10% discount on all orders above \$50 now!!The professional are ready and willing handle your assignment.

ORDER NOW »»