Questions
You have been hired by a home security company to design and implement a home alarm...

You have been hired by a home security company to design and implement a home alarm system. The logic of the system is as follows: once the alarm system has been armed, it is to sound if the front door is opened, the back door is opened or either of two windows is opened (you can assume there are only two windows).

Design the necessary circuit to implement the situation described above. Your circuit should have five inputs (A = alarm, F = front door, B = back door, W1 = window 1 and W2 = window 2). A = 1 means the system is armed; A = 0 means it is disarmed. F = 1 means the front door is open; F = 0 means it is closed. (Similarly for the back door and the windows.) There should be one output, S. When S = 1 the alarm should sound; S = 0 means the alarm is silent. Please use these letters to indicate the inputs and the output so all projects are consistent.

Be CAREFUL to get the correct function for your five inputs before simplifying and designing the circuit. You should minimize the circuit. Your inputs and output should be labeled. You should submit a Microsoft Word document including the following items while ensuring that everything is laid out in a manner that is easy to follow (portrait or landscape is acceptable):

• Your name in the top left

• Drawing of your completed circuit including all appropriate labels.

You will need to practice your MS Word drawing, layering, and object management skills.

See below for common logic gate objects that can be reused in your document.

• Truth tables for the circuit (use Word table feature)

• Kmap for the circuit (use Word table feature)

• Details (show your work) on what was done to simplify the circuit

• A brief written summary (250 to 500 words) of the process you followed, decisions made in laying out the circuit, etc..

In: Computer Science

Climbing Stairs Bibi climbs stairs of a multi-leveled building. Every time Bibi climbs a set of...

Climbing Stairs

Bibi climbs stairs of a multi-leveled building. Every time Bibi climbs a set of stairs, she counts the steps starting from 1 to the number of steps in that particular set of stairs while climbing the stairs. For example if she climbs two set of stairs, the first containing 5 steps and the second containing 3 steps, she will say 1, 2, 3, 4, 5, 1, 2, 3 and the total number of steps would be 8. Find the number of steps that Bibi climbed in each set of steps.

Format Input:

The first line of the input contains an integer N, the number of numbers Bibi said. The second line of the input contains N integers Ai , the i-th number Bibi said. The given sequence of Ai will be a valid sequence, that means the whole input can be cut into sequences of 1, 2, . . . , X, where X is the number of steps in a set of stairs.

Format Output:

Print the number of steps that Bibi climbed for each set of steps, in the order of the input sequence, separated by single spaces. There is no leading and trailing spaces in the output.

Constraints

• 1 ≤ N ≤ 1, 000

• 1 ≤ Ai ≤ 1, 000

• The given sequence of Ai will be a valid sequence, that means the whole input can be cut into sequences of 1, 2, . . . , X, where X is the number of steps in a set of stairs.

Sample Input 1 (standard input):

8

1 2 3 4 5 1 2 3

Sample Output 1 (standard output):

5 3

Sample Input 2 (standard input):

10

1 2 1 1 2 3 4 1 2 3

Sample Output 2 (standard output):

2 1 4 3

Sample Input 3 (standard input):

5

1 2 3 4 5

Sample Output 3 (standard output):

5

Note The first sample is the example from the problem description.

In the second sample:

The first set of stairs have 2 steps, current sequence is ”1, 2”

second set have 1 steps, current sequence is ”1, 2, 1”

third set have 4 steps, current sequence is ”1, 2, 1, 1, 2, 3, 4”

last set have 3 steps, current sequence is ”1, 2, 1, 1, 2, 3, 4, 1, 2, 3”, just like the input

In the third sample, there is only one set of stairs which contains 5 steps.

*Note: Use C language and long long int (must be the same as the constraint)

In: Computer Science

Create a SavingsAccount class to store data of savers (account holders). Your class should match the...

Create a SavingsAccount class to store data of savers (account holders). Your class should match the following specifications.
1. Each instance of the class contains a private data member savingsBalance indicating the amount the saver currently has on deposit, saver’s name, saver’s CNIC, account number (this has to be unique) and a member to store saver status (if savingsBalance > 10000 then status changes to gold otherwise silver).
2. Class also has a data member annualInterestRate to store the annual interest rate which will be the same for all the savers.
3. Implement a default constructor with minimum savingsBalance of 100, and other fields as well. Also create a parameterized constructor if a customer wants to open an account with a different starting balance.
4. Provide member function calculateMonthlyInterest that calculates the monthly interest by multiplying the savingsBalance by annualInterestRate divided by 12; this interest should be added to savingsBalance.
5. Provide a recursive member function turnInToGold that returns the number of months a saver need to become gold member
6. Provide a member function modifyInterestRate that sets the annualInterestRate to a new value.
7. Provide a function that returns the total number of account holders with the bank.
8. Write main() to test class SavingsAccount . Instantiate two different objects of class SavingsAccount, s1 and s2, with balances of $2000.00 and $3000.00, respectively. Set the annualInterestRate to 3 percent. Then calculate the monthly interest and print the new balances for each of the savers. Then set the annualInterestRate to 4 percent, calculate the next Month’s interest and print the new balances for each of the savers. Also print the months it will take for both to become gold savers of bank.

In: Computer Science

Write a Java program which takes a String representing an arithmetic expression as an input and...

Write a Java program which takes a String representing an arithmetic expression as an input and displays whether or not the expression is balanced. If the expression is not balanced (i.e. the wrong # of parentheses or in the wrong order) it will display an error message. For Example: Input an expression: ( ( 2 + 4 ) * 2 ) Expression is balanced Input an expression: ( 5 * 7 – 6 ) ) Error: Expression is not balanced.... Implement a stack calculator using both a numbers and operations stack. Be sure to check that the expression is balanced before running it through the calculator.

In: Computer Science

Analyze the current trends of software crisis in a specific industry in relation to software engineering...

Analyze the current trends of software crisis in a specific industry in relation to software engineering principles, concepts and methodology

In: Computer Science

File has a format Name and number, the number represents power. The name and the (integer)...

File has a format Name and number, the number represents power. The name and the (integer) power are separated by some amount of space. Importantly, any line that begins with a hash '#' are comments and they need to be ingored. Write a program that reads from that file, and prints out only the name of the hero with the strongest power. That name should be capitalized (not uppercase, but capitalized, as in 'Galadriel')

Here is the heroes.txt

# DC heroes
# format: "name" "power"
# 57
# 83
hal 12
batman 48
grayson 14
cyclone 24
superman 38
luthor 15
joker 18
drake 33
wayne 42
rayner 18
# below heroes are additional heroes
arrow 22
kord 48
batwoman 37
supergirl 49
stargirl 24
darkseid 41
gardner 28
pennyworth 27
west 12
aquaman 47
kallor 45
arisia 36

What i have so far:

fn = open('heroes.txt')
count = 0

for z in fn:
line = z.strip()
  
if not '#' in line:
print(line.capitalize())
continue
po1 = line.find()
print(po1)
  
fn.close
  

In: Computer Science

Consider a 10Mbps Ethernet network consisting of 20 nodes interconnected by a bus topology with a...

Consider a 10Mbps Ethernet network consisting of 20 nodes interconnected by a bus topology with a single bridge placed in the approximate center of the network resulting in an equal umber of nodes on each side of the bridge.

  1. Briefly explain why collisions can/cannot occur.
  1. If two pairs of nodes attempted to communicate at the same time, discuss the throughput they can achieve.

In: Computer Science

Given a Syntax Directed Translation as follows. Production Semantic Rules L → E n L.val =...

Given a Syntax Directed Translation as follows.

Production

Semantic Rules

L → E n

L.val = E.val

E → E1 + T

E.val = E1 .val + T.val

E → T

E.val =T.val

T → T1 * F

T.val = T1.val x F.val

T → F

T.val = F.val   

F → ( E )        

F.val = E.val

F → digit

F.val = digit.lexval

Question

Create an annotated parse tree for the following statements

  1. a. (3+4) * (5+6)n
  2. b. 1*2*3*(4+5)n

In: Computer Science

Shapes2D Write the following four classes to practice using an abstract class and polymorphism. Submit all...

Shapes2D

Write the following four classes to practice using an abstract class and polymorphism. Submit all four classes.

Shape2D class

For this class, include just an abstract method name get2DArea() that returns a double.

Rectangle2D class

Make this class inherit from the Shape2D class. Have it store a length and a width as fields. Provide a constructor that takes two double arguments and uses them to set the fields. Note, the area of a rectangle is the length times the width.

Rectangle2D class

Also make this class inherit from the Shape2D class. Have it store a radius as a field. Provide a constructor that takes a double argument and uses it to set the field. Note, the area of a circle is PI times it's radius times it's radius.

Shape2DDriver class

Have this class provide a method named displayName() that takes an object from just any of the above three classes (you can't use an Object type parameter). Have the method display the area of the object, rounded to one decimal place.

In: Computer Science

Two computers have 7-stage fetch-execute cycles where branches are determined in stage 4. One computer is...

Two computers have 7-stage fetch-execute cycles where branches are determined in stage 4. One computer is not pipelined, and the other is pipelined. Assuming that tp = 1, answer the following questions when running a program with 50,000 instructions where 1,000 of the instructions are conditional branches and each branch, if taken, skips over 10 instructions.a.How much faster is the pipelined machine over the non-pipelined machine assuming that no branches are taken.b.How much faster is the pipelined machine over the non-pipelined machine assuming that all branches are taken.c.Bonus question: How many branches would the program have to have assuming every branch is taken (and every branch skips over 10 instructions) for the non-pipelined machine to execute the program in the same time as the pipelined machine?

In: Computer Science

There are 4 processes with different arrival time and service time. Process Arrival Service A 0...

There are 4 processes with different arrival time and service time.

Process

Arrival

Service

A

0

10

B

3

4

C

5

6

D

7

2


a. Use FCFS, RR(4), SPN, SRT, and HRRN to schedule them. Calculate the waiting time and turnaround time for each process and the average turnaround time for each algorithm.

b. Compare all the 5 algorithms. Considering the overhead time for each scheduling takes 1 time unit, which is the best? If the overhead takes 4 time units, which is the best?

In: Computer Science

Use R programming Language Q1. (a)Write a function called lowerTrim that takes 2 arguments: x and...

Use R programming Language

Q1.

(a)Write a function called lowerTrim that takes 2 arguments: x and trimBelow. This function takes the average of those values in x that are greater than the trimBelow. Make x a required argument and supply a default value for trimBelow of negative infinity.

First create some variable to be used for testing later.

x = 1:5
y = letters
z = list(a = 1:5, b = 1:10)

Now test your function with the following

lowerTrim(x)
lowerTrim(-10:5, trimBelow = 0)
lowerTrim(-10:5, -2)
lowerTrim(x = -10:5, trimBelow = Inf)

The return values should be: 3, 3, 2, and NaN, respectively

(b). Extend your function so that it takes a third parameter, which allows the caller to use a function other than mean() when calculating the lowerTrim. Call this argument sumFunc and give it a default value so that it operates like the original lowerTrim function. Call this revised function lowerTrim2

Check your function with the following calls:

lowerTrim2(-10:20, trimBelow = -5, median)
lowerTrim2(-10:20, trimBelow = 0, sumFunc = summary)

The return values should be 8 and the summary values of 1, 5.75 10.5, 10.5, 15.2, and 20.

(c) Modify your function to take in any argument through the ... argument and pass these arguments. Call this new function lowerTrim3.

And test your code with

lowerTrim3(x, sumFunc = sd)
lowerTrim3(-10:20, trimBelow = 0, sumFunc = quantile,
           probs = 0.99)
lowerTrim3(-10:20, trimBelow = 0, trim = 0.1)

The results should be 1.58, 19.8, and 10.5.

In: Computer Science

Java program that display ATM booth line by using data sturcture Queue.

Java program that display ATM booth line by using data sturcture Queue.

In: Computer Science

For Problems 1–4, using the STORES Database, formulate SQL queries, Hand in a listing of each...

For Problems 1–4, using the STORES Database, formulate SQL queries, Hand in a listing of each query and its output.

1. (10 Points) For each customer, list each stock item ordered, the manufacturer, the quantity ordered, and the total price paid. Include the following columns in the order given below:

From Customer Table:              Company

From Stock Table:                      Description

From the Manufact Table:        Manu_Name

From the Items Table:                                Quantity, Total Price

Order the output by Company and Description.

2. (10 Points) List all orders with a shipping date between December 25, 1999 and January 5, 2000. List the Order Number, Order Date, Customer company name, and Shipping Date. Order by Customer Company Name and Order Number.

3. (10 Points) Count the number of customers who do not have any orders placed.

4. (10 Points) List all customers who are ordering equipment whose description begins with ‘tennis’ or ‘volleyball’. List the Customer number, Stock number, and Description. Do not repeat any rows.

5. (15 Points) Use the following SQL CREATE commands to CREATE the following tables in your

User ID:

                                CREATE TABLE Professor

                                (Prof_ID                NUMBER(3) Constraint pk_Professor Primary Key,

                                Prof_Lname         VARCHAR2(15)                 NOT NULL,

                                Prof_Hiredate      DATE,

                                Prof_Sal                NUMBER(8,2),

                                Prof_Dept             CHAR(6)

                                );

                                CREATE TABLE Student

                                (Stu_ID                  NUMBER(4) Constraint pk_Student Primary Key,

                                Stu_Lname           VARCHAR2(15)                 NOT NULL,

                                Stu_Major            CHAR(6),

Stu_CredHrs         NUMBER(4),

                                Stu_GradePts       NUMBER(5),

                                Prof_ID                 NUMBER(3),

                                CONSTRAINT fk_Student_Prof_ID FOREIGN KEY(Prof_ID)

                                                REFERENCES Professor

                                );

Hand in: Print out of the Create commands, the system response and a DESCRIBE of the tables.

6. (15 Points) Insert the following data into the tables created above using SQL INSERT commands.

Professor Table:

Prof_ID

Prof_Lname

Prof_Hiredate

Prof_Sal

Prof_Dept

123

Hilbert

20-MAY-1992

58000.00

MATH

243

Newell

15-JUL-1997

65500.00

CMPSCI

389

Lessing

04-APR-1988

40250.00

ENG

Student Table:

Stu_ID

Stu_Lname

Stu_Major

Stu_CredHrs

Stu_GradePts

Prof_ID

2001

Parker

CMPSCI

52

160

243

2166

Smith

ENG

30

75

389

3200

Garcia

MATH

62

248

123

4520

Smith

CMPSCI

45

157

NULL

In: Computer Science

Develop a simple point-to-point Message communication system(Java Message Service) using ActiveMQ. Provide the necessary code.

Develop a simple point-to-point Message communication system(Java Message Service) using ActiveMQ. Provide the necessary code.

In: Computer Science