Help me ... THANKS
You are trying to open a safe. It has a knob that you can turn in small steps. Above the knob is a number which changes as you turn the knob. Experimentation shows that the number increases for each step you turn the knob clockwise, and decreases for anti-clockwise. The numbers go from 0 to 37. There is also a handle to open the door.
You are given the following instructions to open the safe:
1. Turn the handle reset the lock. The knob will reset to 0.
2. Turn the knob 58 steps clockwise.
3. Turn the knob 119 steps anti-clockwise.
4. Turn the knob 90 steps clockwise.
5. Turn the handle to open the door.
a) What number will be displayed above the knob after each step in the instructions? (1 mark)
b) A colleague tells you that turning the knob a full rotation (38 steps) does nothing. So, for example, turning the knob 40 steps clockwise is the same as turning the knob 2 steps clockwise. Modify the instructions to reduce the number of steps the knob turned to the minimum for each instruction, keeping the direction the same. (1 mark)
c) Consider the following problem: you have implemented a ring buffer to store some incoming data. You are using an array of 56 bytes, and each item of data is 8 bytes long. To add data you are using the following pseudo-code:
for j=0 to 7:
buffer[i + j] = newData[j]
i = (i + 8) % 56
Later, the data specification has changed to 9 bytes long, so you change your code as follows
for j=0 to 8:
buffer[i + j] = newData[j]
i = (i + 9) % 56
but the program is producing garbage. Explain what has gone wrong.
The data shows that number goes from 0 to 37 which implies that it is like a circular arrangement with 0-18 numbers on one side and 19-0 number on other side.
a) Number displayed above the knob
1) 0 as you are resetting the knob
2) 58 steps clockwise,
one full rotation - 38 steps so knob will display 58 - 38 = 20 display
3) 119 anticlockwise.
119-(38*3) = 119 - 114 = 5 anticlockwise from 20. It will display 15
4) 90 steps clockwise 90 - (38*2) = 14 steps clockwise from 15
It will display 29.
Opend for number = 29
b) As per values calculated above,
1. Turn the handle reset the lock. The knob will reset to 0.
2. Turn the knob 20 steps clockwise.
3. Turn the knob 5 steps anti-clockwise.
4. Turn the knob 14 steps clockwise.
5. Turn the handle to open the door.
c)i is not initialized to any value, i should be initialized to 0 before the for loop in both the cases
Help me ... THANKS You are trying to open a safe. It has a knob that...
Write the following program to be executed on the FPGA board. 1. Write a VHDL model for a code detector as shown in the Figure. The keypad is used to unlock a door. Pressing the start button followed by the sequence red-green-red-blue unlocks the door, no other sequence can open the door. Assume the clock is slowed down and each pressing of a button is detected once. For example when red is pressed it is only detected as pressed for...
Code in blue j. A tester class is needed. Also if you comment
that will help greatly. If you can help me I will give you a thumbs
up.
Declare a class ComboLock that works like the combination lock in a gym locker, as shown below. The lock is constructed with a combination—three numbers between 0 and 39. The reset method resets the dial so that it points to 0. The turnLeft and turnRight methods turn the dial by a...
Please I need help in C language, I am trying to modify the code per the below instructions, but I am getting errors. Can't fgure it out. The attempted code modification and data file is privided below, after the instructions. Thank you. Instructions: 1. First, add a function named printMsg that displays a message, a greeting, or an introduction to the program for the user. Add a statement that calls that function from the main function when your program starts....
Help due in a few hours I need to clean this up can you help me
clean up this code to accomplish the same task but with fewer
lines/ more elegantly.
Thank you!
My code for the function is below:
int is_valid_board(int board[9][9]) {
int array[10];
int array_box[10] = {0, 0, 0, 0, 0, 0, 0, 0, 0};
int i, j, k, x, y; //rows=i, columns =j
for (i=0; i<9; i++) {
//Reset test array
for (x = 0; x...
You are given a sample code that when edited/ improved/completed -will work as a producer consumer synchronized solution. In addition to the counter, you will implement a circular linked list as a buffer of size 200 that stores data items 0 or 1. The producer and consumer take *random* turns to produce and consume- *random* numbers of elements ( turning 1 to a 0 and visa-versa-each time, as discussed in class). After each turn of the producer and/or consumer, your...
This is an advanced version of the game tic tac toe, where the player has to get five in a row to win. The board is a 30 x 20. Add three more functions that will check for a win vertically, diagonally, and backwards diagonally. Add an AI that will play against the player, with random moves. Bound check each move to make sure it is in the array. Use this starter code to complete the assignment in C++. Write...
This is due in a few hours I don't know if I did this correctly
can you double check my code to see if my return statements are
fine and I follow the instructions accurately. Thank you!!!
Modify my code if anything return statement seems misplaced or
inaccurately called.
Here is my code:
int write_sudoku_board(const char file_name[ ], int board[9][9])
{
int number;
int i,j;
int a = 9;
FILE* fp = fopen("sudoku.txt", "w");
int count = 0;
for(i =...
File Home Insert Formulas Data Review View Help Open in Desktop App Tell me what you want to do Editing V 11 v B Av av v... Ev ak Merge v General y $ v leto 2 % 2 Ey av Øv ♡ Calibri AZ - for А 1 Use the Math Word Problem 5 steps. B C D E F G H I J K L M N 3 Carmela Cruz owns a small restaurant and collects 10% sales...
File Home Insert Formulas Data Review View Help Open in Desktop App Tell me what you want to do Editing Share Comments Ev 27v ov 5 ... v Calibri 11 7 B Av av v ... Ev alle Merge v General y $ v v O Du A8 for Α You can solve this one without using the Math Word Problem 5 steps. F G H I J K L M N O P 1 4 If your scores for...
5 Exercises Now that everything is working you can try the following exercises. To complete them you will need to refer to the documentation in Appendix A- The MiteASM Assembler and Appendix B - The MiteFPGA Processor. Write an assembly language program for an over counter for a cricket umpire. This should display a count on the 7-segment display. The count should increase by 1 when button 0 is 1. pressed. It should reset to 0 when button 1 is...