Design and implement a binary-encoded sequential circuit subject to the following specifications.
This circuit is going to be used to control access to security system. It has a single 2-bit wide input, called X = X1X0 that represents a key-pad that is capable of accepting numbers 0 to 3, representing digits of a passcode. It has a single 1-bit wide output, called F, that is attached to the disarming mechanism. The behavior is that if the correct passcode is entered (in the proper order) on X (where the rising edge of the clock represents ‘entering’ the each ‘digit’ of the passcode on X into the system), then the output, F, will be asserted to 1, otherwise, it outputs 0. The 3-digit passcode is 2,1,3. When implementing the binary encoded circuit, show both the minimum sum of product (MSOP) technique and equations.
In: Computer Science
Security should be a top concern for every network environment. This is especially true in a converged network. Many mission-critical services depend on this infrastructure. A security breach could cause devastating effects on the environment. All measures must be taken to reduce the risk of a security breach.
In 3–4 paragraphs, complete the following:
In: Computer Science
**Use Python 3.7.4 ***
1. Ask the user for the number of hours worked, salary per hour and compute their salary. They will make 1.5 times salary for every hour over 40.
2. Write a program that asks the user for red, green, and blue color mixture (3 inputs); all or nothing - you can decide how to do this (0/1), (0/255), (none/all), (...). Then based on the combination display the final color: (white - 111, red - 100, green - 010, blue - 001, cyan - 011, magenta - 101, yellow - 110, black - 000)
3. Write a program and asks user for a phone number with area code. Must be formatted like this, " (###)-###-#### " the program should say whether or not it is in the valid format.
In: Computer Science
Solve f(x) = x3 + 12x2 - 100x – 6 using false position with a = 5, b = 6, and es =0.5%. Show each step and create a table. Please be as detailed as you can.
In: Computer Science
Enhance your program from Exercise 20 by continuing to ask the user for the interest rate and loan amount. Then ask the user for the amount of principle they would like to payoff each month. Make sure that the user enters a positive number that is less than the loan amount. This means that the monthly payment will change from month to month. Use this information to produce a payment chart that will include as output the Payment (Month) Number, the Payment Amount (monthly amount + interest), and the interest for that month. Make sure to calculate the Payment Amount for the last month as the remaining Loan Amount + Interest. At the end of the payment chart, output the total interest paid.
Ask user for loan amount, interest rate and monthly principle payment.
Check to make sure the monthly principle payment is less than the loan amount.
Set month counter and total interest to zero
Repeat until loan amount is less than or equal principle payment
Calculate interest as loan amount * interest rate
Calculate payment as interest + principle payment
Add interest to total interest
Increment month counter
print the month counter, payment amount and interest
Subtract principle payment from loan amount
Calculate final interest = loan amount * interest rate
Calculate final payment = loan amount + final interest
increment the month counter
Add final interest to total interest
print the month counter, final payment and final interest
print the total interest
#include <iostream>
#include <iomanip>
using namespace std;
int main ()
{
double loanAmount;
double interestRate;
double interestRatePerMonth;
double monthlyPayment;
double paymentPrincipal;
int months;
cout << fixed << showpoint;
cout << setprecision(2);
cout << "Enter the loan amount: ";
cin >> loanAmount;
cout << endl;
cout << "Enter the interest rate per year:
";
cin >> interestRate;
cout << endl;
interestRatePerMonth = (interestRate / 100) /
12;
cout << "Enter the monthly payment:
";
cin >> monthlyPayment;
if (monthlyPayment <= loanAmount *
interestRatePerMonth)
{
cout << "Monthly
payment is too low. The loan cannot be repaid."
<< endl;
return 1;
}
months = 0;
while (loanAmount > 0)
{
paymentPrincipal =
monthlyPayment - (loanAmount * interestRatePerMonth);
loanAmount = loanAmount
- paymentPrincipal;
months++;
}
cout << "It will take " << months
<< " months to repay the loan."
<<
endl;
return 0;
}
In: Computer Science
In: Computer Science
Task 1.
For each table on the list, identify the functional dependencies. List the functional dependencies. Normalize the relations to BCNF. Then decide whether the resulting tables should be implemented in that form. If not, explain why. For each table, write the table name and write out the names, data types, and sizes of all the data items, Identify any constraints, using the conventions of the DBMS you will use for implementation. Write and execute SQL statements to create all the tables needed to implement the design.
Create indexes for foreign keys and any other columns that will be used most often for queries. Insert about five records in each table, preserving all constraints. Put in enough data to demonstrate how the database will function. Write SQL statements that will process five non-routine requests for information from the database just created. For each, write the request in English, followed by the corresponding SQL command. Create at least one trigger and write the code for it.
Tables / DDL and Insert Data have been provided below:
-- DDL to create the MS SQL tables for initial relational model
for Theater Group
CREATE DATABASE Theater;
CREATE TABLE Member(
memId INT,
dateJoined DATETIME,
firstname VARCHAR(15),
lastName VARCHAR(20),
street
VARCHAR(50),
city
VARCHAR(15),
state
CHAR(2),
zip
CHAR(5),
areaCode CHAR(3),
phoneNumber CHAR(7),
currentOfficeHeld VARCHAR(20),
CONSTRAINT Member_memId_pk PRIMARY
KEY(memid));
CREATE TABLE Sponsor(
sponID INT,
name
VARCHAR(20),
street
VARCHAR(50),
city
VARCHAR(15),
state
CHAR(2),
zip
CHAR(5),
areaCode CHAR(3),
phoneNumber CHAR(7),
CONSTRAINT Sponsor_sponId_pk PRIMARY
KEY(sponID));
CREATE TABLE Subscriber(
subID INT,
firstname VARCHAR(15),
lastName VARCHAR(20),
street
VARCHAR(50),
city
VARCHAR(15),
state
CHAR(2),
zip
CHAR(5),
areaCode CHAR(3),
phoneNumber CHAR(7),
CONSTRAINT Subscriber_subId_pk PRIMARY
KEY(subID));
CREATE TABLE Play(
title
VARCHAR(100),
author
VARCHAR(35),
numberOfActs SMALLINT,
setChanges
SMALLINT,
CONSTRAINT Play_title_pk PRIMARY
KEY(title));
CREATE TABLE Production(
year
SMALLINT,
seasonStartDate VARCHAR(7),
seasonEndDate VARCHAR(7),
title
VARCHAR(100),
CONSTRAINT Prod_year_seasStDate_pk primary
key(year, seasonStartDate),
CONSTRAINT Prod_title_fk FOREIGN KEY(title)
REFERENCES Play(title));
CREATE TABLE Performance(
datePerf
VARCHAR(7),
timePerf
VARCHAR(10),
year
SMALLINT,
seasonStartDate VARCHAR(7),
CONSTRAINT Performance_date_pk PRIMARY
KEY(datePerf,year),
CONSTRAINT Performance_yr_seasStart_fk FOREIGN
KEY(year,seasonStartDate) REFERENCES Production(year,
seasonStartDate));
CREATE TABLE TicketSale(
saleID INT,
saleDate DATETIME,
totalAmount DECIMAL(6,2),
perfDate VARCHAR(7),
perfYear SMALLINT,
subId INT,
CONSTRAINT TicketSale_ID_PK PRIMARY
KEY(saleId),
CONSTRAINT TicketSale_perfDate_fk FOREIGN
KEY(perfDate,perfYear) REFERENCES Performance(datePerf,year),
CONSTRAINT TicketSale_subId_fk FOREIGN
KEY(subId) REFERENCES Subscriber(subId));
CREATE TABLE DuesPayment(
memId INT,
duesYear SMALLINT,
amount
DECIMAL(5,2),
datePaid DATETIME,
CONSTRAINT DuesPayment_memId_year_pk PRIMARY
KEY(memid, duesyear),
CONSTRAINT DuesPayment_memId_fk FOREIGN
KEY(memid) REFERENCES Member(memid));
CREATE TABLE Donation(
sponId
INT,
donationDate DATETIME,
donationType VARCHAR(20),
donationValue DECIMAL(8,2),
year
SMALLINT,
seasonStartDate VARCHAR(7),
CONSTRAINT Donation_sponId_date_pk PRIMARY
KEY(sponId, donationDate),
CONSTRAINT Donation_sponId_fk FOREIGN
KEY(sponId) REFERENCES Sponsor(sponId),
CONSTRAINT Donation_year_seasStartDate_fk
FOREIGN KEY(year,seasonStartDate) REFERENCES Production(year,
seasonStartDate));
CREATE TABLE Ticket(
saleId
INT,
seatLocation VARCHAR(3),
price
DECIMAL(5,2),
seattype
VARCHAR(15),
CONSTRAINT Ticket_saleid_pk PRIMARY KEY(saleId,
seatLocation),
CONSTRAINT Ticket_saleid_fk FOREIGN KEY(saleid)
REFERENCES TicketSale(saleId));
CREATE TABLE Member_Production(
memId
INT,
year
SMALLINT,
seasonStartDate VARCHAR(7),
role
VARCHAR(25),
task
VARCHAR(25),
CONSTRAINT Mem_Prod_Id_year_seas_pk PRIMARY
KEY(memId, year, seasonStartDate),
CONSTRAINT Mem_Prod_memId_FK FOREIGN KEY (memid)
REFERENCES Member(memId),
CONSTRAINT Mem_Prod_yr_seasStartDate_fk FOREIGN
KEY(year,seasonStartDate) REFERENCES
Production(year,seasonStartDate));
INSERT DATA:
-- insert some records
INSERT INTO Member values(11111,'01-Feb-2015',
'Frances','Hughes','10 Hudson Avenue','New
Rochelle','NY','10801','914','3216789','President');
INSERT INTO Member values(22222,'01-Mar-2015', 'Irene','Jacobs','1
Windswept Place','New
York','NY','10101','212','3216789','Vice-President');
INSERT INTO Member values(33333,'01-May-2015', 'Winston', 'Lee','22
Amazon Street','New York','NY',
'10101','212','3336789',null);
INSERT INTO Member values(44444,'01-Feb-2015', 'Ryan','Hughes','10
Hudson Avenue','New
Rochelle','NY','10801','914','5556789','Secretary');
INSERT INTO Member values(55555,'01-Feb-2015', 'Samantha',
'Babson','22 Hudson Avenue','New
Rochelle','NY','10801','914','6666789','Treasurer');
INSERT INTO Member values(66666,'01-Feb-2015', 'Robert',
'Babson','22 Hudson Avenue','New
Rochelle','NY','10801','914','6666789',null);
INSERT INTO Sponsor values(1234, 'Zap Electrics', '125 Main
Street','New York','NY', '10101', '212','3334444');
INSERT INTO Sponsor values(1235, 'Elegant Interiors', '333 Main
Street','New York','NY', '10101', '212','3334446');
INSERT INTO Sponsor values(1236, 'Deli Delights', '111 South
Street', 'New Rochelle','NY','10801', '914','2224446');
INSERT INTO Subscriber values(123456, 'John','Smith','10
Sapphire Row', 'New Rochelle','NY','10801', '914','1234567');
INSERT INTO Subscriber values(987654, 'Terrence','DeSimone','10
Emerald Lane','New York','NY', '10101','914','7676767');
INSERT INTO Play values('Macbeth','Wm. Shakespeare', 3,6);
INSERT INTO Play values('Our Town','T. Wilder', 3,4);
INSERT INTO Play values('Death of a Salesman','A. Miller',
3,5);
INSERT INTO Production values(2015,'05-May', '14-May', 'Our
Town');
INSERT INTO Production
values(2014,'14-Oct','23-Oct','Macbeth');
INSERT INTO Performance values('05-May','8pm',2015,'05-May');
INSERT INTO Performance values('06-May','8pm',2015,'05-May');
INSERT INTO Performance values('07-May','3pm',2015,'05-May');
INSERT INTO Performance values('12-May','8pm',2015,'05-May');
INSERT INTO Performance values('13-May','8pm',2015,'05-May');
INSERT INTO Performance values('14-May','3pm',2015,'05-May');
INSERT INTO Performance values('14-Oct','8pm',2014,'14-Oct');
INSERT INTO Performance values('15-Oct','8pm',2014,'14-Oct');
INSERT INTO Performance values('16-Oct','3pm',2014,'14-Oct');
INSERT INTO Performance values('21-Oct','8pm',2014,'14-Oct');
INSERT INTO Performance values('22-Oct','8pm',2014,'14-Oct');
INSERT INTO Performance values('23-Oct','3pm',2014,'14-Oct');
INSERT INTO TicketSale
values(123456,'01-May-2015',40.00,'05-May',2015,123456);
INSERT INTO Ticket values(123456, 'A1',20.00,'orch front');
INSERT INTO Ticket values(123456, 'A2',20.00,'orch front');
INSERT INTO TicketSale
values(123457,'02-May-2015',80.00,'05-May',2015,987654);
INSERT INTO Ticket values(123457, 'A3',20.00,'orch front');
INSERT INTO Ticket values(123457, 'A4',20.00,'orch front');
INSERT INTO Ticket values(123457, 'A5',20.00,'orch front');
INSERT INTO Ticket values(123457, 'A6',20.00,'orch front');
INSERT INTO TicketSale
values(000001,'01-Oct-2014',40.00,'14-Oct',2014, 987654);
INSERT INTO Ticket values(000001, 'A1',20.00,'orch front');
INSERT INTO Ticket values(000001, 'A2',20.00,'orch front');
INSERT INTO TicketSale
values(000002,'9-Oct-2014',60.00,'14-Oct',2014,123456);
INSERT INTO Ticket values(000002, 'A1',20.00,'orch front');
INSERT INTO Ticket values(000002, 'A2',20.00,'orch front');
INSERT INTO Ticket values(000002, 'A3',20.00,'orch front');
INSERT INTO DuesPayment values(11111, 2015, 50.00,
'01-Jan-2015');
INSERT INTO DuesPayment values(22222, 2015, 50.00,
'15-Jan-2015');
INSERT INTO DuesPayment values(33333, 2015, 50.00,
'01-Feb-2015');
INSERT INTO DuesPayment values(44444, 2015, 50.00,
'30-Jan-2015');
INSERT INTO DuesPayment values(55555, 2015, 50.00,
'28-Jan-2015');
INSERT INTO Donation values(1234, '01-Mar-2015','sound
board',1250.00,2015,'05-May');
INSERT INTO Donation values(1235, '15-Apr-2015','cash',
500.00,2015,'05-May');
INSERT INTO Donation values(1236,
'05-May-2015','food',500.00,2015,'05-May');
INSERT INTO Donation values(1236,
'06-May-2015','beverges',200.00,2015,'05-May');
INSERT INTO Donation values(1236,
'07-May-2015','snacks',100.00,2015,'05-May');
INSERT INTO Member_Production
values(11111,2015,'05-May','Emily','sets');
INSERT INTO Member_Production values(22222,2015,'05-May','Mrs.
Webb','costumes');
-- DDL to delete all of the tables, use only if you need to
rebuild the DB
DROP TABLE Member_Production;
DROP TABLE Ticket;
DROP TABLE Donation;
DROP TABLE DuesPayment;
DROP TABLE TicketSale;
DROP TABLE Performance;
DROP TABLE Production;
DROP TABLE Play;
DROP TABLE Subscriber;
DROP TABLE Sponsor;
DROP TABLE Member;
DROP DATABASE Theater;
In: Computer Science
Create two files, file1.csv and file2.csv
Write the following information in file1.csv:
Apple 1.69 001
Banana 1.39 002
Write the following information in file2.csv:
Apple 1.69 001
Carrot 1.09 003
Beef 6.99 004
You have two files, both of the two files have some information about products: • Read these two files, find out which products exist in both files, and then save these products in a new file. You can use the two files you created in Lab 1 as an example. If you use file1.csv and file2.csv from Lab 1, the result file will be:
•Result file:
Apple 1.69 001
In: Computer Science
Please fix this python script, I keep getting a return outside function error and cannot get it to run:
def caesar(plainText, shift):
cipherText = ""
for char in plainText:
newChar = ord(char) + shift
if newChar > 128:
newChar = newChar % 128
finalChar = chr(newChar)
cipherText += finalChar
return cipherText
text = input("Enter a message: ");
s = input("Enter the distance value: ");
print (caesar(text, int(s)));
In: Computer Science
Create a complete java program called Week_Report. The program
must include two array structures, a string array called DaysOfWeek
and a double array called Temp_Values. Store in the DaysOfWeek
array the following values (Monday, Tuesday, Wednesday, Thursday,
Friday, Saturday, Sunday). Store in the Temp_Values array the
following (23.5, 34.0, 20.9, 45.7, 29.3, 34.5, 32.5). Using a for
loop structure output the values for the two arrays.
Day of the Week Temperature Values
Monday 23.5
Tuesday 34.0
Wednesday 20.9
Thursday 45.7
Friday 29.3
Saturday 34.5
Sunday 32.5
Names for the main program and the array structures are provided in the question.
JAVA Language to be used
In: Computer Science
In C, is "&" a operator or punctuator? (According to the info found online, I am still confused)
In: Computer Science
This homework will check your ability to declare and use classes and object, and how to use both Maps and sets in Java. The assignment will also serve as an introduction to Junit Testing.
Here is the general layout. Some more detailed instructions are also included below. Pay attention to the details and the naming conventions, since we will be running your code through testing code the grading team will develop. That code will require your method signatures to be consistent with these instructions.
Please call your project LegislatorFinder
inside your project, please have a package called LegislatorFinder
create your java files inside the LegislatorFinder package.
We will be simulating the system by which people can find who their legislators are:
There is a class called Legislator, with the following attributes: ▪ lastName ▪ firstName ▪ politicalParty ▪ Each of those attributes has getter and setter functions therefore, this class has the following methods: getLastName(), getFirstName, getPoliticalParty(), setFirstName(string), setLatName(string), setPoliticalParty(string) ▪ in addition, the class has two constructors: one with no arguments. One that takes arguments string, string, string
There is a class called LegislatorFinder ▪ this class has only one attribute, a TreeMap ▪ for methods, you should implement addLegislator(string state, Legislator l) ◦ if the state already exists in the TreeMap, it adds this legislator to the set the state maps to. ◦ If the state doe not exist in the TreeMap, it adds a new key:value pair to the map, with this legislator in the corresponding set. getLegislators(string state) ◦ returns the set of legislators from the given state. If there is no such state key in the map, returns an empty set. substituteLegislators(String state, Set newLegislators) ◦ substitutes the legislators for the indicated state with the one in newLegislators. If there was no such state key in the Map, it creates a new key:value pair. If there was a key:value pair for this state already, it substitutes the previous set of legislators with the one passed as an input parameter.
◦ Through JUnit tests, test the following operations: ▪ adding legislators, both for a state key that is already in the map, and for a state key not yet in the map. ▪ Retrieving legislators, both for a state key that is already in the map, and for a state key not yet in the map. ▪ Substituting the set of legislators for a given state for the following cases: the state was not previously being used as a key in the map. The key was being used as a key in the map.
(Need to implement a TreeMap method)
In: Computer Science
How have the events of 9/11/2001 influenced Disaster Recovery Planning (DRP)?
In: Computer Science
Design and write a Python 3.8 program that gives and grades a math quiz. The quiz will give 2 problems for each of the arithmetic operations: +, -, *, /, and %. First, two addition problems will be presented (one at a time) with random numbers between 1 and 20. Then two subtraction problems, multiplication, division and modulus. For division use // and do floor division; for example: for 10//3, the answer should be 3. For an example of the first problem: the program generates two random numbers (let's say num1 is 17 and num2 is 5), and prints out a statement of the problem as 17 + 5 =. The user will enter a correct answer or a wrong answer. If the answer is correct, a message will be printed and one will be added to the number of correct answers. Then the second addition problem is given and checked. Next, two subtraction problems will be given and checked, and so on.
Define a function for each of the 5 operations. Each function will display 2 problems (one at a time) to be solved. The call to each function should return the number of correct answers (0, 1, or 2). After calling all 5 functions in sequence, the main program will print out the total score of that quiz, and asks the user if he/she wants to take another quiz. The main program should keep calling the 5 functions in sequence as long as the user wants to take another quiz.
Insert a screenshot of the programs output
In: Computer Science
Define these 10 programming terms with their definitions related to Computer Science,
here are the ten terms to define.
IDE
syntax error
logic error
while & for looping (mention "end-of-file" looping)
algorithm
increment
decrement
accumulator
flowchart
pseudo code
In: Computer Science