Write a multithreaded program that calculates various
statistical values for a list of numbers. This program will be
passed a series of numbers on the command line and will then create
three separate worker threads. One thread will determine the
average of the numbers, the second
will determine the maximum value, and the third will determine the
minimum value. For example, suppose your program is passed the
integers
90 81 78 95 79 72 85 The program will report
The average value is 82 The minimum value is 72 The maximum value is 95
The variables representing the average, minimum, and maximum values will be stored globally. The worker threads will set these values, and the parent thread will output the values once the workers have exited. (We could obviously expand this program by creating additional threads
that determine other statistical values, such as median and standard deviation.) (You can use Java or C)
In: Computer Science
- You (Eve) have intercepted two ciphertexts: c1 = 1111100101111001110011000001011110000110
c2 = 1111101001100111110111010000100110001000
You know that both are OTP ciphertexts, encrypted with the same
key. You know that either c1 is an encryption of alpha and c2 is an
encryption of bravo or c1 is an encryption
of delta and c2 is an encryption of gamma (all converted to binary
from ascii in the standard way). Which of these two possibilities
is correct, and why? What was the key k?
In: Computer Science
Arduino Uno code, Please explain what does this code do?
unsigned long ms_runtime;
int one_ms_timer;
//define all timers as unsigned variables
unsigned long timer1 = 0; // timer1 increments every 100ms =
0.1s
const int USER_LED_OUTPUT = 13;
const int USER_BUTTON_INPUT = 2;
void setup()
{ // initialize the digital pin as an output.
pinMode(USER_LED_OUTPUT, OUTPUT);
pinMode(USER_BUTTON_INPUT, INPUT);
Serial.begin(9600);
}
void loop()
{ // run loop forever
static int state, old_state,counter;
timers();
// logic for state change
if(state == 0)
{ if(digitalRead(USER_BUTTON_INPUT) == 1)
{ if(timer1 > 5)
state = 1;
}
else
timer1 = 0;
}
else if(state == 1)
{ if(digitalRead(USER_BUTTON_INPUT) == 0)
{ if(timer1 > 5)
state = 0;
}
else
timer1 = 0;
}
// execute commands based on state
if (state == 1)
digitalWrite(USER_LED_OUTPUT, HIGH);
else if (state == 0)
digitalWrite(USER_LED_OUTPUT, LOW);
// monitor and print changed of state
if(old_state != state)
{ counter++;
Serial.print("counter = ");
Serial.println(counter);
old_state = state;
}
}
void timers(void)
{
int i;
if(millis() > (ms_runtime + 1))
{ ms_runtime = ms_runtime + 1;
one_ms_timer++;
}
else if( ms_runtime > millis())
ms_runtime = millis();
if(one_ms_timer > 99)
{ timer1++;
one_ms_timer = 0;
}
}
In: Computer Science
1) You must implement a recursive Quicksort algorithm that will read integers from the attached MyList.txt file. Your algorithm must sort the list(integers)in ascending order.
2)You must implement a recursive Mergesort algorithm that will
read integers from the attached MyList.txt file. Your algorithm
must sort the list(integers)in ascending order.
My List.txt Values
7
3
4
1
4
4
9
9
4
8
4
5
3
9
2
3
7
0
6
4
4
5
0
1
9
2
1
7
4
7
8
7
8
3
6
3
5
9
7
3
7
8
8
2
5
9
1
2
7
2
0
1
7
5
4
3
0
5
9
2
0
7
8
9
8
4
8
2
9
2
2
1
1
5
7
5
7
5
8
7
3
2
7
8
0
1
5
1
7
6
9
2
9
6
3
9
2
6
0
5
8
9
7
5
3
5
4
2
4
5
7
7
6
9
7
1
9
4
2
9
1
1
6
4
6
5
7
3
5
1
6
8
5
9
3
5
In: Computer Science
Consider a real-life business situation and discuss under what circumstances you would consider using the MERGE statement. In addition to detail explanation, provide an SQL example to merge at least three tables. Your example should be unique (do not use textbook and/or internet examples).
In: Computer Science
Make one program in c++
Implement the Point class composed of an ordered pair (?, ?). Redefine the operators in your Point class Calculate the coefficients of a Linear Regression ? = ?? + ? with next data for x and y. x y 46 4.7 72 12.3 59 6.5 56 5.9 54 6.6 70 10.3 68 8.4 48 4
In: Computer Science
Enter a Letter grade: B-
The numeric value is 2.7
Test Cases:
B- (should print 2.7)
A+ (should print 4.0)
B+ (should print 3.3)
C (should print 2.0)
F+ (should print 0.0)
G (should print “no such grade”)
Python, keep it simple
In: Computer Science
Test Cases:
Enter name: Jorge
Enter wage: 9.25
Enter hours: 10
Total pay is: $92.50
Enter name: John
Enter wage: 20.00
Enter hours: 50
Total pay is: $1100 ($800 + $300 overtime)
python, keep it simple
In: Computer Science
The goal of Java program implemented as part of this assignment
is to build an
Inventory Management System, from here on referred to as IMS, for a
bookstore.
You will need to do the following tasks:
Requirement-1 – Create 3 different Arrays (15 pts)
(a) Create an array named items that will hold the following item
names (strings)
- Pen
- Pencil
- Eraser
- Marker
- Notepad
(b) Create a second array named quantity, that will hold
corresponding quantities
for items in the items array above. This will be populated through
user inputs.
For each input you get from the user, be sure to check it is a
number > 0. If
not, continue to ask the user for the right number.
Hint: User the handy-dandy Scanner to read user input, the if-else
construct to
validate user input and the loop to repetitively ask for user input
should you
get an unacceptable value
(c) Create a third array named price, that will hold price-per-item
for the items
stored in the first array. The price point for each item should
also come from
the user. For example, a notepad could be priced at $1.47, eraser
at $0.76 etc.
As in the above case, for each price point input you get from the
user, be sure
to check it is a number > 0. If not, continue to ask the user
for the right
number for the item price.
The message, for example, could look like “Please enter price for a
Notebook”
(d) Based on the type of data that needs to be stored in the
above-mentioned
arrays, be sure to use the correct data type
Requirement-2 –Create Operations for an Inventory Manager
role
(a) Show Functions List
Once the above data points have been correctly created, you will
now need to
build the functional points (operations) for this IMS. But before
we do that, we
need tell the user about operations that are available to be
invoked by the
user, as part of this IMS. The 5 operations of the IMS are as
follows. So, display
these operations to the user and ask the user to enter the letter
for the
operation that the user wants to run.
- Print Inventory (p)
- Check for Low Inventory (c)
- Highest/Lowest value inventory Items (h)
- Total Inventory Value (t)
- Exit System (e)
Sample output should look something like the following:
Welcome to IMS. Please select a function from the following:
Print Inventory (p)
Check for Low Inventory (c)
Highest/Lowest value inventory Items (h)
Total Inventory Value (t)
Exit System (e)
(b) PrintInventory (15 pts)
This operation should print inventory, starting with the header, in
the
following format
Item_Name Quantity Price Total_Inventory_Value
Eraser 14 $.95 $13.30
Notebook 10 $1.47 $14.70
….
Note:
The last column will show a computed value (price * quantity) for
the item
At the end of this operation, go back to displaying the 5
operations that user
can choose from, as in (a) above
(c) checkForInventory
This operation checks for items that have quantity less than 5, and
then prints
them in the same format as in (b) above. For example:
Items with quantity less that 5:
Item_Name Quantity Price Total_Inventory_Value
Notebook 7 $1.47 $10.29
Marker 4 $1.02 $4.08
….
….
At the end of this operation, go back to displaying the 5
operations that user
can choose from, as in (a) above
(d) highestAndLowestValueItems
This operation finds the highest, and lowest, value item(s) in
inventory,
computed by multiplying the quantity with the price for that item,
and then
prints them in the same format as in (b) above.
Highest Inventory Value Items:
Item_Name Quantity Price Total_Inventory_Value
Notebook 7 $1.47 $10.29
Marker 4 $1.02 $4.08
….
Lowest Inventory Value Items:
Item_Name Quantity Price Total_Inventory_Value
Pencil 4 $.74 $2.96
Marker 2 $1.02 $2.04
….
At the end of this operation, go back to displaying the 5
operations that user
can choose from, as in (a) above
(e) totalInventoryValue
This operation simply prints the Grand Total value of the entire
inventory. This
will essentially be the summation of all individual total values of
each item in
the inventory
At the end of this operation, go back to displaying the 5
operations that user
can choose from, as in (a) above
(f) exit
This operation simply exits the program
In: Computer Science
1. Explain how IPv4 route decisions are made. Provide at least two examples.
2. Review an IPv4 header and discuss the different fields and what each field does.
3. Compare and contrast the major differences between IPv4 and IPv6. Your write-up should include the following details:
In: Computer Science
1. For all of the following words, if you move the first letter to the end of the word and then spell the word backwards, you get the original word:
banana dresser grammar potato revive uneven assess
Write a program that gets a word from the keyboard and determines whether it has this property. treat uppercase and lowercase letters alike. That means that poTato also has this property.
2. Write a program that generates a random number (between 1 and 10 inclusive) 100 times. Output the total number of 1s, 2s, ….10s.
Code language is Java. using JGrasp to code
In: Computer Science
Programming language= In Java and Oracle Sql
You are required to develop a simple HR application for a small
accounting firm that wishes
to keep track of all the employees at the firm; storing details
about their salary, phone numbers
and Date of Birth. The firm has many departments and there are 5 to
20 employees in each
department. The department information includes department name,
description and total
number of employees in that department. The company also provides
vehicles for some of its
employees. An employee maybe allocated one car. To ensure timely
maintenance of vehicle,
the company would like to store the following details of the
vehicle: make, model,
next_maintenance_date.
Each employee has a position (manager, accountant, administrator,
clerk, etc.). Various
allowances are allocated to each position. For example, the
managers have fuel allowance,
house allowance, social allowance and managers allowance. On the
other hand, the
administrators have house allowance and social allowance. Clerks
have social allowance and
uniform allowance. The name and description of each allowance needs
to be stored.
The HR system keeps track of all Projects in the organization. Each
department is assigned to
one or more project. Project can be assigned to one or more
department (Interdisciplinary
projects).
Each HR Employee has his own credentials to login into the system
to manipulate the database.
The HR credentials are stored in a table (Login). You will also
need a table to store transactions
(Transaction Date/Time and User Name).
The system must store employees’ grades. Each employee will have a
grade (Example A, B,
C). The grade should have a predefined salary range.
You need to have the following constraints in your system: The
employee’s salary should be
between the grade range (Example: Grade A - Salary between
30000-50000). Employee’s
phone number and Date of Birth should not be empty. Vehicle next
maintenance is within 6
month of current date. Each position should not exceed the
predefined allowances.
Part A:
Include the following before drawing the ERD:
a. Write the business rules.
b. Identify all Entities and attributes
c. Identify Primary key and Foreign Key in each table/Entity
d. Identify the Relationships between Entities.
e. Resolve any M:N relationship between the entities.
Part B:
Draw the ERD using any Data Modelling Software.
Part C:
Create the SQL script to create tables and insert at least five
record in each table.
Part D:
The System must provide the following functionalities:
1- Login Screen with a Username and Password for HR Employees only.
Username and
password must be retrieved from a table.
2- Add a new Employee.
3- Remove (Drop) an Employee. Retrieve employee by ID and then
perform transaction.
4- Update employee’s salary.
5- Calculate the total amount of allowances. Need to enter Employee
ID to retrieve data.
6- The system must fire a SQL trigger whenever adding a new
employee. The trigger
must store the following information (Date/Time transaction and the
Username)
7- The System must provide the following reports:
7-1- Employee History (Include: Employee Name, Department Name,
Position).
7-2- Vehicle History (Include: Employee Name, Vehicle Model).
7-3- List Employee’s allowances. Need to enter Employee ID to
retrieve data.
Part E:
Create the Screens using Java Swing Windows Builder
Grading:
Task Percentage
Develop ERD 30%
SQL Script 10%
1 10%
2,3,4,5 20%
6,7 20%
GUI 10%
Important:
1. Submitting Due Date: 25th of April 2020.
2. The grade for the project is 10 points distributed as
follows:
2.1 Project (ERD + SQL Script (Schema) + Java Application source
code + Report)
(80%)
2.2 Discussion and project demo (20%):
3. Copying and/or plagiarism (-100%)
4. Program does not compile (-50%)
5. In case of late submission, (-10%) for each day of delay.
6. No Teamwork effort (-20).
7. Each group can have two to three students.
8. Include all work in one ZIP file
(Student1_Student2_Student3.zip)
In: Computer Science
Create using Java
Description: Palindrome -- According to
wikipedia "A palindrome is a word, phrase, number
or other sequence of units that can be read the same way in either
direction"
Write a application that can determine if a 5 digit number you
input is a palindrome. If the number is a palindrome then print
"The number is a palindrome." If it is not then print "The number
is NOT a palindrome"
Make sure to use an array
//-----------------------------------
// This is the good version pseudocode
// create string sInput
//
// prompt for input
//
// create char array (cArray) and assign
sInput.toCharArray()
//
// loop to check for palindrome (set i = 0, j =
sInput.length()-1, check to see if i != j; increment i, decrement
j)
// check to see if current array
values are !=
// print not a
palindrome
// return
// end of loop
// print is a palindrome
//------------------------------
In: Computer Science
Given the following variable declarations: const size_t n = 50; Write the declaration of an array of pointers to n memory blocks containing 16-bit signed integer values. Use 'x' for the name of the variable. (Don't forget the semi-colon at the end of the declaration!)
In: Computer Science
Use text and diagrams.
Describe the Linux Ext format?
What are the component parts?
How is it organized?
In: Computer Science