Questions
How would you implement smart/low cost flooding in a WSN? How would you know if nodes...

How would you implement smart/low cost flooding in a WSN? How would you know if nodes received the messages?

In: Computer Science

Extract an 8 × 8 patch from the image. To access to the (i, j)th pixel...

Extract an 8 × 8 patch from the image. To access to the (i, j)th pixel of the image, you can type Y(i,j). To access the an 8×8 patch at pixel (i, j), you can do Y(i:i+7, j:j+7) for some index i and j. Extract all the available 8 × 8 patches from the image, and store them as a 64 × K matrix where K is the number of patches. The following code will be useful.

for i=1:M-8

for j=1:N-8

z = Y(i+[0:7], j+[0:7]);

... % other steps; your job.

end

end

Here, M and N are the number of rows and columns of the image, respectively. No need to worry about the boundary pixels; just drop them.

Hint: Use the command reshape in MATLAB (and Python) to turn an 8 × 8 patch into a 64 × 1 column vector. Submit the first 2 columns and the last 2 columns of your data matrix.

In: Computer Science

Wireless Sensor Networks/Internet of Things Considering sensors and signal processing (based on in-class materials or your...

Wireless Sensor Networks/Internet of Things

Considering sensors and signal processing (based on in-class materials or your own knowledge if you have a background here) how would you determine if the entity in your sensor field was an elephant or a lion

In: Computer Science

Wireless Sensor Networks/Internet of Things Topic Quesiton 8 In wireless network snooping is possible. What are...

Wireless Sensor Networks/Internet of Things Topic

Quesiton 8

In wireless network snooping is possible. What are the positive aspects of snooping?

In: Computer Science

using python3 Write a Python program that lets a user search through the 'data.txt' file for...

using python3

Write a Python program that lets a user search through the 'data.txt' file for a given first name, last name, or email address, and print all the matches/results.

  • Prompt the user for which field to search, (f) for first name, (l) for last name, or (e) for email
    • data.txt entries are all formatted as: first_name, last_name, email, separated by TABS
  • Your program should not read the entire file into memory, it should read line by line, and only keep/save lines that match the search.
  • Your program should ignore case (e.g. 'eric' and 'Eric' are the same name)
  • When finished, your program should print out all the search results, in a table format.

Test your program.


In: Computer Science

Exercise 18: Running Ex. 16 You will write exercise 16 into a program and make it...

Exercise 18: Running Ex. 16 You will write exercise 16 into a program and make it run. Note that there are two parts, 16A and 16B. Type 16A into a program called Exercise16A and type 16B into a program called Exercise16B. Be sure label each section using comments. You may notice that additional code needs to be written for the program to run. For example, Section I assumed that an array was already declared and initialized. Here, you will have to declare and initialize an array with random values to test it.

Section A. Declare and initialize an array firstNames containing the following names: Jane, Jim, Beth, Mary, Sara, and Bob. Remember to choose the correct data type for the array elements.

Section B. Using a FOR loop, output the elements of the array firstNames so that they are displayed on the same line and separated by a space. Use .length to get the length of the array.


this is for java language

In: Computer Science

Consider the following languages: A = {w: |w| > k, where k is a constant integer}...

  1. Consider the following languages:
  • A = {w: |w| > k, where k is a constant integer}
  • B = {ε,0,1, 10, 001}
  • (The complement of A)
  • (The complement of B)
  1. (True/False)                    A is regular
  2. (True/False)                    B is regular
  3. (True/False)                     is regular
  4. (True/False)                      is regular  

2.  If A is regular, and  A  = A, then B must be not regular. True or False

3. Given three languages A, B, C where . If both A and B are regular, then C must be regular. True or False

Automata and Computation

In: Computer Science

1. You have landed your dream job working for Steve Evert. Unfortunately, Steve doesn't know anything...

1. You have landed your dream job working for Steve Evert. Unfortunately, Steve doesn't know anything about making solid business decisions. Your first assignment is to help educate Steve on the difference between transactional and analytical information and how he can use a digital dashboard to consolidate data and drill down into the details of data to help run his business.

2. Steve would also like you to create a document highlighting the five different types of artificial intelligence systems and how each system might help support making business decisions.

3. Why would the DoD use an event like the DARPA Grand Challenge or DARPA Robotic Challenge to further technological innovation?

4. Describe how autonomous vehicles and robots could be used by organizations around the world to improve business efficiency and effectiveness.

In: Computer Science

What does each letter in ACID stand for in the context of database transactions? Describe a...

What does each letter in ACID stand for in the context of database transactions? Describe a concrete example (i.e. a scenario) to illustrate the property the letter "I" refers to, in terms how it works or how it breaks in the example.

In: Computer Science

Reading code that you haven't written is a skill you must develop. Many times you are...

Reading code that you haven't written is a skill you must develop. Many times you are correcting this code that you didn't write so you have to 1) read the code, 2) find the errors, and 3) correct them.

You are going to correct a program that has several errors in it (specifically, one error per function).

  • You should begin by looking at what the expected output of the program should be for various inputs.
  • Then, run the code and identify the error that occurs.
  • Next, go to the code and correct the mistakes.
  • Run the code again to see if you did it correctly. Be sure to test with different inputs.
  • Record the error you found in the comment at the top of the function.
  • Repeat this until you have found all 4 errors

When the program is correct, it should have output like this:

Enter 3 test scores:
Enter your test score >  100
Enter your test score >  90
Enter your test score >  91

Wow! You scored 90 or above on all your exams!
Keep up the As!

Your test average is 93.66666666666667
You earned an A

# Describe the error found in this function:

#

def get_grade():

grade = input("Enter your test score > ")

return grade

# Describe the error found in this function:

#

def all_As(test1, test2, test3):

if test1 > 89:

if test2 > 89:

if test3 > 89:

print("Wow! ", end="")

print("You scored 90 or above on all your exams!")

print("Keep up the As!")

print()

# Describe the error found in this function:

#

def calc_average(test1, test2, test3):

return test1 + test2 + test3 / 3

# Describe the error found in this function:

#

def letter_grade(grade):

if grade >= 90:

print("You earned an A")

if grade >= 80:

print("You earned an B")

if grade >= 70:

print("You earned an C")

if grade >= 60:

print("You earned an D")

if grade < 60:

print("You earned an F")

from grades import (

all_As,

calc_average,

get_grade,

letter_grade

)

# THERE ARE NO ERRORS IN THE MAIN

# YOU DO NOT NEED TO CHANGE THE MAIN

#-----main-----

print("Enter 3 test scores:")

first_test = get_grade()

second_test = get_grade()

third_test = get_grade()

print()

all_As(first_test, second_test, third_test)

average = calc_average(first_test, second_test, third_test)

print("Your test average is",average)

letter_grade(average)

In: Computer Science

Create four classes named: Planet, solarSystem, Earth and Moon, 1. Think how to use inheritance in...

Create four classes named: Planet, solarSystem, Earth and Moon,
1. Think how to use inheritance in three classes
2. solarSystem has
Name, color, Diameter_Miles, dist_From_Sun and perimeter =(float) 3.14*Diameter_Miles;
3. Moon has the following attributes:
Name, color, Diameter_Miles, dist_From_Sun, surface_area = 4*3.14*Radius*Radius;
And volume = (4/3)*(3.14)*(Radius_Miles)*(Radius_Miles)*(Radius_Miles);
4. Planet has the following attributes:
Name, color, Diameter_Miles, dist_From_Sun and volume = (4/3)*(3.14)*(Radius_Miles)*(Radius_Miles)*(Radius_Miles);
5. Earth has the following attributes:
Name, color, Diameter_Miles, dist_From_Sun and volume = (4/3)*(3.14)*(Radius_Miles)*(Radius_Miles)*(Radius_Miles);
Every class has constructor to initialize the input variables and measurements Method that prints the following:
From the solarSystem Class consider the following inputs: name ="solar System", color="multi", Diameter_Miles=7500000000L, dist_From_Sun =3666000000L
The output should be:
Name Of The solarSystem : solar System
Colour Of The solarSystem : multi
Distance From the Sun : 3666000000 miles
Perimeter of the solarSystem : 2.35500012E10 miles
--------------------------------------
From the Planet Class consider the following inputs: name =" Earth ", color=" blue", Diameter_Miles=3959L, dist_From_Sun =93000000L
The output should be:
Name Of The Planet : Earth
Colour Of The Planet : blue
Distance From the Sun is : 93000000 miles
Volume Of The Planet : 1.9484360366806003E11 cubic units
From the Earth Class consider the following inputs: name =" Earth ", color=" blue", Diameter_Miles=3959L, dist_From_Sun =93000000L
The output should be:
Name Of The Planet : Earth
Colour Of The Planet : blue
Distance From the Sun is : 93000000 miles
Volume Of The Planet : 1.9484360366806003E11 cubic units
-----------------
From the Moon Class consider the following inputs: name =" Luna", color=" silvery ", Diameter_Miles=1740L, dist_From_Sun =238900L
The output should be:
Name Of The Moon : Luna
Colour Of The Moon : silvery
Distance From the Mother Planet : 238900 miles
Surface area Of The Moon : 3.8026656E7 km^2
---------------

Exercise: OOP- Inheritance
((((((. java ))))
Create four classes named: Planet, solarSystem, Earth and Moon,
1. Think how to use inheritance in three classes
2. solarSystem has
Name, color, Diameter_Miles, dist_From_Sun and perimeter =(float) 3.14*Diameter_Miles;
3. Moon has the following attributes:
Name, color, Diameter_Miles, dist_From_Sun, surface_area = 4*3.14*Radius*Radius;
And volume = (4/3)*(3.14)*(Radius_Miles)*(Radius_Miles)*(Radius_Miles);
4. Planet has the following attributes:
Name, color, Diameter_Miles, dist_From_Sun and volume = (4/3)*(3.14)*(Radius_Miles)*(Radius_Miles)*(Radius_Miles);
5. Earth has the following attributes:
Name, color, Diameter_Miles, dist_From_Sun and volume = (4/3)*(3.14)*(Radius_Miles)*(Radius_Miles)*(Radius_Miles);
Every class has constructor to initialize the input variables and measurements Method that prints the following:
From the solarSystem Class consider the following inputs: name ="solar System", color="multi", Diameter_Miles=7500000000L, dist_From_Sun =3666000000L
The output should be:
Name Of The solarSystem : solar System
Colour Of The solarSystem : multi
Distance From the Sun : 3666000000 miles
Perimeter of the solarSystem : 2.35500012E10 miles
--------------------------------------
From the Planet Class consider the following inputs: name =" Earth ", color=" blue", Diameter_Miles=3959L, dist_From_Sun =93000000L
The output should be:
Name Of The Planet : Earth
Colour Of The Planet : blue
Distance From the Sun is : 93000000 miles
Volume Of The Planet : 1.9484360366806003E11 cubic units
From the Earth Class consider the following inputs: name =" Earth ", color=" blue", Diameter_Miles=3959L, dist_From_Sun =93000000L
The output should be:
Name Of The Planet : Earth
Colour Of The Planet : blue
Distance From the Sun is : 93000000 miles
Volume Of The Planet : 1.9484360366806003E11 cubic units
-----------------
From the Moon Class consider the following inputs: name =" Luna", color=" silvery ", Diameter_Miles=1740L, dist_From_Sun =238900L
The output should be:
Name Of The Moon : Luna
Colour Of The Moon : silvery
Distance From the Mother Planet : 238900 miles
Surface area Of The Moon : 3.8026656E7 km^2
---------------

In: Computer Science

a)The decimal equivalent of the signed 2’s complement 8-bit binary number 11010101B is ______________. b)The decimal...

a)The decimal equivalent of the signed 2’s complement 8-bit binary number 11010101B is ______________.

b)The decimal equivalent of the unsigned 8-bit hex number 0B4H is ______________.

c)The value of the expression ‘H’ – ‘B’ is less than / equal to / greater than that of the expression ‘L’ – ‘C’.

d)If the .data segment contains declarations

                        A    BYTE      2 DUP (‘a’), ‘+’

B    BYTE      3 DUP (‘b’), 0

C    BYTE      4 DUP (‘c’), ‘–’

D    BYTE      5 DUP (‘d’), 0

then the instruction

                              input     A, D, 6

will display a Windows dialog box with title _______________________________.

f)If eax = 302B59A1H, and ebx = 700CD37DH, then the instruction

                             add ax, bx

will leave the value ______________________________ in the eax register.

In: Computer Science

Hey guys, So it seems like I made a slight error in my program. So one...

Hey guys,

So it seems like I made a slight error in my program. So one of the requirement for this program is not to show any negatives shown as a output, however my program showed some negative numbers. I was wondering if someone could look over my program and find the error and maybe give it a tweak. I don't want to change my program because I worked so hard for it. Anyway here the assignment at the bottom is my code. Thanks in advance:

In this program, you are to store information about sales people and their individual sales from a company. You are to store the first name and quantity sold for each transaction.

You are to allow records to be stored for sales transactions. In fact, you need to ask the user for the total possible number of sales.

You are to allow data entry of 0 to maximum number of transaction. You are to store in the computer the income for each person for each transaction. No negative sales permitted. Here are the rules for calculating income:

  • The person makes 5 dollars for each item for the first five items sold.
  • The person makes 10 dollars for each item for the next 5 items sold.
  • The person makes 25 dollars for each item for the next 500 items sold.
  • The person makes 35 dollars for each item sold after the 510th item sold.

The income for a person is progressive. He or she makes money for the first 5 items sold + money from the next 5 items sold + money for the next 500 items sold + the money for any other sale.

The program will have three options: * Record a new sale, * Show income from each existing sales transaction, * Quit

Example output

Name          Total Items Sold              Total Income

Tom            1                                  $5.00

Mary            5                                  $25.00

Willie           7                                  $35.00

Jack            511                               $12,610

My code:

#include <stdio.h>

#include <string.h>

#include <stdlib.h>

float incomePower(int itemSold){

  

float incomes;

  

int numbers = 4;

  

int breakpoints[] = {0, 5, 5+5, 5+5+500};

  

float rates[] = {5.0, 10.0, 25.0, 35.0};

  

for (int roc = 0; roc < numbers; roc++) {

if (itemSold <= breakpoints[roc]) {

break;

}

  

if ( roc < numbers - 1 && itemSold >= breakpoints[roc + 1]) {

  

incomes += rates[roc] * (breakpoints[roc + 1] - breakpoints[roc]);

  

} else {

incomes += rates[roc] *(itemSold - breakpoints[roc]);

}

}

  

return incomes;

}

int main(){

  

int megaSale = 0, roc = 0, arrayPointer = 0;

  

printf("\nThe total income of sales of each Person\n");

  

printf("\nEnter the maximum number of sales: \n");

scanf("%d", &megaSale);

  

char names[megaSale][100];

  

int itemsold[megaSale];

  

float totalincome[megaSale];

  

while (1) {

  

int choice;

  

printf("Choose:");

scanf("%d", &choice);

  

switch (choice) {

case 1:

printf("Enter the name of sales person");

scanf("%s", names[arrayPointer]);

  

printf("Enter the number of sale of %s: ", names[arrayPointer]);

scanf("%d", &itemsold[arrayPointer]);

totalincome[arrayPointer] = incomePower(itemsold[arrayPointer]);

  

arrayPointer += 1;

break;

  

case 2:

printf("\nName\t\tTotal Items Sold\t\tTotal Income");

  

for (roc = 0; roc <arrayPointer; roc++) {

  

printf("\n%s\t\t\t%d\t\t\t%.2f\n", names[roc], itemsold[roc], totalincome[roc]);

  

}

break;

  

case 3:

exit(0);

break;

  

default:

printf("Invalid entry");

}

}

  

  

return 0;

}

In: Computer Science

Discuss in 500 words or more federated architecture in cloud systems. Remember that this is a...

Discuss in 500 words or more federated architecture in cloud systems. Remember that this is a cloud class not a database class

Note-Check in chegg writing before you submit it should be 100% unique and don't submit the existing chegg answers,and submit in text format

Provide References

In: Computer Science

Create four classes named: Planet, solarSystem, Earth and Moon, 1. Think how to use inheritance in...

Create four classes named: Planet, solarSystem, Earth and Moon,
1. Think how to use inheritance in three classes
2. solarSystem has
Name, color, Diameter_Miles, dist_From_Sun and perimeter =(float) 3.14*Diameter_Miles;
3. Moon has the following attributes:
Name, color, Diameter_Miles, dist_From_Sun, surface_area = 4*3.14*Radius*Radius;
And volume = (4/3)*(3.14)*(Radius_Miles)*(Radius_Miles)*(Radius_Miles);
4. Planet has the following attributes:
Name, color, Diameter_Miles, dist_From_Sun and volume = (4/3)*(3.14)*(Radius_Miles)*(Radius_Miles)*(Radius_Miles);
5. Earth has the following attributes:
Name, color, Diameter_Miles, dist_From_Sun and volume = (4/3)*(3.14)*(Radius_Miles)*(Radius_Miles)*(Radius_Miles);
Every class has constructor to initialize the input variables and measurements Method that prints the following:
From the solarSystem Class consider the following inputs: name ="solar System", color="multi", Diameter_Miles=7500000000L, dist_From_Sun =3666000000L
The output should be:
Name Of The solarSystem : solar System
Colour Of The solarSystem : multi
Distance From the Sun : 3666000000 miles
Perimeter of the solarSystem : 2.35500012E10 miles
--------------------------------------
From the Planet Class consider the following inputs: name =" Earth ", color=" blue", Diameter_Miles=3959L, dist_From_Sun =93000000L
The output should be:
Name Of The Planet : Earth
Colour Of The Planet : blue
Distance From the Sun is : 93000000 miles
Volume Of The Planet : 1.9484360366806003E11 cubic units
From the Earth Class consider the following inputs: name =" Earth ", color=" blue", Diameter_Miles=3959L, dist_From_Sun =93000000L
The output should be:
Name Of The Planet : Earth
Colour Of The Planet : blue
Distance From the Sun is : 93000000 miles
Volume Of The Planet : 1.9484360366806003E11 cubic units
-----------------
From the Moon Class consider the following inputs: name =" Luna", color=" silvery ", Diameter_Miles=1740L, dist_From_Sun =238900L
The output should be:
Name Of The Moon : Luna
Colour Of The Moon : silvery
Distance From the Mother Planet : 238900 miles
Surface area Of The Moon : 3.8026656E7 km^2
---------------

java

In: Computer Science