Questions
Please attach the output screenshots, narrative descriptions, or paste the Python codes when requested. Task 2...

Please attach the output screenshots, narrative descriptions, or paste the Python codes when requested.

Task 2

Please define a function that extracts the even numbers in a given list. For example, given a list x = [2,3,5,6,7], the function will return a sublist [2,6] because 2 and 6 are even numbers in the list x.

The input of this function should be a list, and the output of the function should be a list as well (the sublist).

You can try the inline for loop with conditions to make the solution super simple.

Task 3

Use inline for loop to extract the common elements in two lists. For example, if x = [1,2,3], and y = [2,3,4], the result should be [2,3].

Hint: to check if a value exists in a list, you can use the “in” command. For example: we define two variables

a = 2 in [1,2,3]

b = 4 in [1,2,3].

After executing the codes, a will be a “True”, and b will be a “False”.

In: Computer Science

Digital security is an increasing concern is the Internet age. In order to protect sensitive information...

Digital security is an increasing concern is the Internet age. In order to protect sensitive information online, what are the methods for enhancing digital security? Select one method and describe in detail how it is implemented and how you would implement it to protect your online data.

In: Computer Science

Java Write a method that removes duplicates from an array of strings and returns a new...

Java

Write a method that removes duplicates from an array of strings and returns a new array, free of any duplicate strings.

In: Computer Science

Create a Java application to simulate a “GradeBook”. A teacher has five students who have taken...

Create a Java application to simulate a “GradeBook”. A teacher has five students who have taken four exams. The teacher uses the following grading scale to assign a letter grade to a student, based on the average of his or her four exam scores:

Average

Letter Grade

90 – 100

A

80 – 89

B

70 – 79

C

60 – 69

D

0 – 59

F

Write logic to create a String array to hold student names, a character array to hold student letter grades, and a two-dimensional array to hold each of the five students’ test scores for each of the four exams completed during the semester.

Use nested for loop logic to fill the names and test scores arrays. Do not accept test scores less than zero or greater than 100. Make sure you test both ends of the range!

Use another nested for loop to compute the average test score for each student and then assign the corresponding letter the letter grade array. Make sure you test each letter grade value!

Use while loop logic to display a table showing each student’s name and letter grade.

In: Computer Science

How can I check to see if 2 arrays contain the same element using nothing worse...

How can I check to see if 2 arrays contain the same element using nothing worse than linear runtime? (Java)

For example if I have 2 arrays with elements {7, 8, 5, 4, 3} and {10, 12, 15, 20, 8}

I would want it to return true since there is an 8 in each array.

In: Computer Science

(PYTHON) A beard-second is a unit of length inspired by the light-year and is defined as...

(PYTHON) A beard-second is a unit of length inspired by the light-year and is defined as the length the average beard grows in one second, or precisely 5 nanometers. The beard-second is used for extremely short distances such as measurements within an integrated circuit. Your manufacturing equipment is very accurate but it uses inches as a unit of measurement, so you need a conversion table between beard-seconds and inches to complete a special order.

The following information should be helpful: 1 beard second = 5 nanometers 1 nanometer = 3.937e-8 inches

Write a program named beard.py that includes two functions main() and inches()which are used to produce a conversion table between beard seconds and inches for a series of values specified by the user.

The main() function: • Displays a description of the program’s function • Prompts the user for the starting and ending beard second value to be converted to inches • Displays a table header (see examples) • Using a loop, calls the inches() function repeatedly to calculate the converted values • The beard second values should increment by 250

The inches() function: • Accepts one (1) value in beard seconds as an argument • Performs the conversion calculation from beard seconds to inches • Displays the table row including the beard seconds and inches values (to 8 decimal places) • Beard second values should have a thousands comma separator • Does not return any values

In: Computer Science

Write a program that reads two square Matrices of size 2 *2 and calculate and print...

Write a program that reads two square Matrices of size 2 *2 and calculate and print the sum of them. Also, the signed value of the matrices are input by the user Note: 1) Use CamelCase for variables names 2) Write Comments such as your name, the class, description of the program, and description of your logic. 4) Use sematic names for your variables 5) Your program should be C program not C++.

In: Computer Science

Array/File Functions Write a function to accept three arguments:  The name of a file, a...

Array/File Functions
Write a function to accept three arguments:
 The name of a file, a pointer to an int array, and the size of the array. The
function should open the specified file in binary mode, write the contents of the
array to the file, and then close the file.
Write another function to accept three arguments:
 The name of a file, a pointer to an int array, and the size of the array. The
function should open the specified file in binary mode, read its contents into the
array, and then close the file.
Write a complete program that demonstrates these functions:
 Function to write an array to a file, and then read the data from the same file.
An array values shall be created, write to a file, and after that data are read from
the file, and display the array’s contents on the screen.

Notes:
 The filename parameter is the name of the file,
 The array parameter is a pointer to the array, and
 The size parameter is the number of elements in the array (size of the array)

In: Computer Science

Random Access Memory (RAM) is _______________ type of memory because the contents are erased when the...

Random Access Memory (RAM) is _______________ type of memory because the contents are erased when the computer is turned off and is therefore used only for temporary storage while a program is running.

In Python, the % arithmetic operator gives the ______________________ when one integer is divided by another.

_______________ storage is the general name given to storage that can hold data for long periods of time, even when there is no power to the computer.

Python uses ______________________ to categorize values in memory so that it can tell the differences among integers, floating point numbers, and strings .

The binary number for 37 is _____________.

The step in the programming development life-cycle where the task of the program is understood and steps that must be taken to perform the task are determined is ________________.

A(n) __________ decision structure provides only one block of statements as a path to be executed conditionally.

A table that lists Boolean expressions and shows all possible true and false outcomes from compound combinations of the connected Boolean expressions is called a(n) _______________ table.

The general name given to data such as 72, 'A', "Hello", 2.8712 as it appears in a program is ______________  

In: Computer Science

Software Engenninring 1. Draw a Level-0, a Level-1, a Level-2 Data Flow Diagram for an ATM...

Software Engenninring

1. Draw a Level-0, a Level-1, a Level-2 Data Flow Diagram for an ATM Machine System. 2. Draw a sequence diagram for one use-case as follows: Getting money from an ATM Treat each part of the ATM as a class/object: Money dispenser Screen Keypad Bank computer

In: Computer Science

IN JAVA!   Write a class Store which includes the attributes: store name, city. Write another class...

IN JAVA!  

Write a class Store which includes the attributes: store name, city. Write another class encapsulating an Art Gallery, which inherits from Store. An Art Gallery has the following additional attributes: how many paintings are sold every year and the number of artists submitting artwork.

Code the constructor, accessors, mutators, toString and equals method of the super class Store. Code the constructor, accessors and mutators for the subclass Art Gallery. In the Art Gallery class, also code a method returning the average number of paintings per artist.

You should create a test class which creates 2 Art Gallery objects, then calls your set methods, get methods, toString and equals methods and average paintings per artist for the Art Gallery objects. MAKE THE PROGRAM ASK USER FOR THE INPUTS ALSO THANKS

In: Computer Science

I am trying to figure out how to properly execute a while loop and a do/while...

I am trying to figure out how to properly execute a while loop and a do/while loop in the same program using java. I am stuck at just writing the while loop. I made a condition but I can't figure out how to get it to loop if the condition is true?? Also I have to write a do/while loop in the same program.

here are the details:

  • This lab demonstrates the use of the While Loop and the Do While Loop as error checking mechanisms.
  • You will be using each of these loops to solve the same problem.
  • Please put them both in the same program.
  • When you test the code, you will not see a difference in the way they execute - but there will be a difference in the logic when writing the code.
  • You will want to write a refined algorithm for both to see the logic differences

Here is what I have written in JAVA so far:

import java.util.Scanner;


public class whileloopanddowhile //BEGIN Class Definition (must be same as file name)
{
public static void main (String[] args) //BEGIN Main Method
{
//Declare variables
int number;

//List all Class Objects here
Scanner scan = new Scanner(System.in);
  
//Executable Statement Section, user input
System.out.println ("Enter a grade from 0 to 100 ");
number = scan.nextInt();
  
//This is where the code goes
while (number < 0 && number > 100 )
{   
System.out.println ("ERROR! Must enter a grade between 0 and 100");
}

System.out.println ("You have enetered a valid grade");
  


}//END main method

}

Thank you for any help and clarification!

In: Computer Science

2. Examine various vulnerabilities of information system that lead to a successful footprinting and recommend the...

2. Examine various vulnerabilities of information system that lead to a successful footprinting and recommend the countermeasures for the same.

In: Computer Science

explain why ethical hacking is necessary in today's complex business environment.

explain why ethical hacking is necessary in today's complex business environment.

In: Computer Science

how would you transpose a matrix in a java program if you can only use linked...

how would you transpose a matrix in a java program if you can only use linked list not 2D - arrays.

In: Computer Science