Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Question You have been asked to build a \\software controller\" for a simple cop

ID: 3740698 • Letter: Q

Question

Question

You have been asked to build a software controller" for a simple copier with the

following parts:

(1) A cover that can be either open or closed;

(2) A counter with a display that holds a number between 0 and 9 (i.e., the copier can make at most 9 copies at a time);

(3) A start button and a stop button;

(4) a numeric keypad with numbers 0-9.

The copier functions as follows: (1) If the cover is open, the copier ignores the start button;

(2) If the cover is closed, and the start button is pressed, the copier starts making copies if the

counter holds a value greater than 0;

(3) the counter is decremented every time a copy is made;

(4) the copier stops when the counter reaches 0;

(5)If the stop button is pressed, the counter value is cleared to 0;

(6) When the copier is making copies, the input from the numeric keypad is ignored;

(7)If the copier is not making copies, pressing a key on the keypad causes the counter value to be

changed to the number on that key.

(8) If the cover is opened when the copier is making copies, the copier stops.

Assume that we have a device that can detects every copy that is made; the associated device

driver object will send out a message when this happens. Likewise the device driver for the keypad

can send out a message when a number is pressed. State any other reasonable assumptions that

you are making.

JAVA OBJECT ORIRNTED DESIGN

Explanation / Answer

#include<stdio.h>
int a[10] = {2,2,2,2,3,0,3,2,2,2};
int b[10][3] = {{4,6},{6,8},{7,9},{4,8},{0,3,9},{},{1,7,0},{2,6},{1,3},{2,4}};

int count(int curr,int n)
{
int sum = 0;
if(n==10)
return 1;
else
{
int i = 0;
int val = 0;
for(i = 0; i < a[curr]; i++)
{
val = count(b[curr][i],n+1);
sum += val;
}
return sum;
}
}

int main()
{
int n = 1;
int val = count(1,0);
printf("%d ",val);
}

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote