• 100% Satisfaction Guarantee
Ingo U, Software Engineer
Category: Homework
Satisfied Customers: 755
Experience:  Over 25 years experience in software development. Expert in Microsoft .Net, C#, C++, VB, SQL
44076068
Ingo U is online now

# 1.Assume that a program contains the following declarations:

### Customer Question

1.Assume that a program contains the following declarations:
char c = ’\1’; short s = 2; int i = -3; long m = 5; float f = 6.5f; double d = 7.5;
Give the value and the type of each expression listed below.
(a) c * i (b) s + m (c) f / c (d) d / s (e) f - d (f) (int) f
2. The Hogwarts School was so happy with your math helper program that they referred you to a security firm! This security firm creates pin code door lockers like you see in the movies. They now need help to design an algorithm that will power the authentication system. The algorithm they want to validate codes is pretty weak, but it should work in the following way:
• It first checks if the pin code entered is four digits. If not, the code is invalid.
• It then checks if each digit within the four-digit pin is odd. If not, the code is invalid.
• If five consecutive invalid pins are entered, the system locks out and reports an intruder.
Therefore, codes 1234 and 357 are invalid because the former has even numbers (i.e., 2 and 4), and the latter is less than four digits. A valid pin code could be 1357 because it has exactly four digits. In addition, all of its four digits (i.e., 1, 3, 5, and 7) are odd.
(a) After creating a flowchart for the algorithm, save it as “l7 pin code.rap” and attach it to your online submission. The following shows an example of running the flowchart.
Enter pin code (attempt 1): 12 Code 12 is invalid!
Enter pin code (attempt 2): 1234 Code 1234 is invalid!
Enter pin code (attempt 3): 1375 Code 1375 is success!
The following shows another example:
Enter pin code (attempt 1): 12 Code 12 is invalid!
Enter pin code (attempt 2): 0999 Code 999 is invalid!
Enter pin code (attempt 3): 1278 Code 1278 is invalid!
Enter pin code (attempt 4): 1274 Code 1274 is invalid!
Enter pin code (attempt 5): 1272 Code 1272 is invalid!
Suggestion: Add a subchart CheckCode to help improving the readability of the flowchart.
3. Algorithm implementation with C programming language
(a) Write an equivalent C program that follows the “l7 pin code.rap” structure and accom- plishes what the flowchart does.
(b) Save your program to a file named “l7 pin code.c”, and attach the file to your online submission.
4. Write the following function:
double inner product(double a[], double b[], int n);
The function should return a[0] * b[O] + a[l] * b[l] + ... + a[n-l] * b[n- l]. Save the program in a file named as a4 inner.c, and submit the file as your solution to this question.
Submitted: 1 year ago.
Category: Homework
Expert:  Ingo U replied 1 year ago.

Hello,

welcome to the site. I'm examining your questions.

By when do you need this done?
Thanks,

-Ingo U

Expert:  Ingo U replied 1 year ago.

In the meantime, here is part 1:

http://dl.dropbox.com/u/7895834/Q1.txt?dl=0

and part 2:

http://dl.dropbox.com/u/7895834/l7%20pin%20code.rap?dl=0

Expert:  Ingo U replied 1 year ago.

Hi,
just following up, were you able to use my solution?
Please feel free to post any additional questions, comments or concerns you may have regarding this issue.

If you're not yet satisfied with the result, please let me know what is missing.
I will do my best to make it right for you.

Otherwise, please don't forget to rate my service - I don't get paid for my work until your rating is received.

Regards,
Ingo U

Expert:  Ingo U replied 1 year ago.

Hi,
just following up, were you able to use my solution?
Please feel free to post any additional questions, comments or concerns you may have regarding this issue.

If you're not yet satisfied with the result, please let me know what is missing.
I will do my best to make it right for you.

Otherwise, please don't forget to rate my service - I don't get paid for my work until your rating is received.

Regards,
Ingo U

Expert:  Ingo U replied 1 year ago.

Hi,
just following up, were you able to use my solution?
Please feel free to post any additional questions, comments or concerns you may have regarding this issue.

If you're not yet satisfied with the result, please let me know what is missing.
I will do my best to make it right for you.

Otherwise, please don't forget to rate my service - I don't get paid for my work until your rating is received.

Regards,
Ingo U

Expert:  Ingo U replied 1 year ago.