Please use python.
Step a: Create two dataframes df1 and df2 as follows:
|
import numpy as np import pandas as pd rng = np.random.RandomState(100) df1 = pd.DataFrame(rng.randint(0, 100, (4, 3)), columns=['A', 'B', 'C']) df2 = pd.DataFrame(rng.randint(0, 100, (3, 4)), columns=['A', 'B', 'C', 'D']) |
Step b: Create a new dataframe df which is the summation of df1 and df2;
Step c: Subtract all columns of df by the half of column 'C' in df1; (Remark: the values in df should be updated)
Step d: Replace the NaN in df by 10; (Remark: the values in df should be updated)
Step e: Use df.apply() to calculate the summation of the numbers in each row of df, and show the result. (Remark: the result should be a vector of four values)
In: Computer Science
prove or disprove these three interval greedy algorithm underneath if it is an optimal greedy strategy.
(a) earliest finish time first
(b) shortest interval first
(c) fewest conflicts first
In: Computer Science
Windows monitoring tools are essential to the Windows Systems Administrator. Three software tools that are essential are: Task Manager, Event Viewer and Resource Monitor. Create a short PPT presentation of at least six slides (or more) for a 15-minute Windows Administrators Lunch and Learn session on the use of these three tools using the following requirements:
1) A slide with the description of each tool (one slide per tool)
2) Show how to measure CPU, Memory and Network Activity in Task Manager
3) Demonstrate how to find different events of different severities in Event Viewer.
4) Discuss the four elements of Resource Monitor – CPU, Disk, Network and Memory and how it can be used in real time and to review historical logs.
In: Computer Science
Write a java program, creating three threads, to sort two arrays and merge them into a third array. More specifically:
Create a thread to sort the first array. Create a thread to sort the second array. Create a thread to merge the arrays into the third array. Let the main method prints the merged array.
i want three threads to be created .
You must call the two sorter threads together. In other words, if we name these threads sorta, sortb, and merge, you must call the start methods in the following sequence: sorta.start(); sortb.start(); Some java code merge.start();
I post the sequential program for this assignment. Note that you need to change the classes Sorter and Merger to make them suitable for threads.
import java.util.Random;
public class Main{
public static void main(String[] args) {
Random rand = new Random();
int size = rand.nextInt(50) + 1;
int a[] = new int[size];
size = rand.nextInt(50) + 1;
int b[] = new int[size];
for(int i = 0; i < a.length; i++)
a[i] = rand.nextInt(999);
for(int i = 0; i < b.length; i++)
b[i] = rand.nextInt(999);
new Sorter(a);
new Sorter(b);
int[] c = new int[a.length + b.length];
new Merger(a, b, c);
for(int i = 0; i < c.length; i++)
System.out.print(c[i] + " ");
}
}
-------------------------------------------------------------------
public class Merger{
public Merger(int[]a, int[] b, int[] c){
merge(a, b, c);
}
private void merge(int[] a, int[] b, int[] c){
int index = 0, i = 0, j = 0;
while(i < a.length && j < b.length)
if(a[i] < b[j])
c[index++] = a[i++];
else
c[index++] = b[j++];
if(i < a.length)
for(int k = i; i < a.length; i++)
c[index++] = a[i];
if(j < b.length)
for(int k = j; j < b.length; j++)
c[index++] = b[j];
}
}
----------------------------------------------------------------------------------------------------------------
public class Sorter{
public Sorter(int[] a){
sort(a);
}
private void sort(int[] a){
for(int i = 0; i < a.length; i++){
int pos = i;
int min = a[i];
for (int j = i + 1; j < a.length; j++)
if(a[j] < min){
min = a[j];
pos = j;
}
a[pos] = a[i];
a[i] = min;
}
}
}
In: Computer Science
In: Computer Science
PLEASE ANSWER using R studio .
VARIABLE ASSIGNMENT AND SIMPLE FUNCTIONS ##
#########################################################
#Section 2 instructions:
#Answer the following questions by defining the provided
objects.
#Question 2.1 (2 points)
#Create a numeric vector that contains all integers between 1 and
1,000 (inclusive)
aS2Q1 <-
#Question 2.2 (2 points)
#Create a numeric vector that contains all even integers between 2
and 1,000 (inclusive)
aS2Q2 <-
#Question 2.3 (2 points)
#Four strings are defined as character vectors below. Using the
already defined
#character vectors, create a single character vector that combines
all of them
#and separates the contents of each with a comma followed by a
space.
str1 <- "The National Mall in Washington"
str2 <- "D.C. has monuments"
str3 <- "museums"
str4 <- "and scenery that draws many tourists from around the
world."
aS2Q3 <-
#Question 2.4 (2 points)
#Translate the following mathematical function into an R function
named "zFunction": z = (x + x^2 + x^3) - (y + y^2 + y^3)
#Then, evaluate for (x, y) = (3, 4) and save your answer to the
provided object.
zFunction <-
aS2Q4 <-
#Question 2.5 (2 points)
#Create a four-element list where each element is your answer to
questions 2.1-2.4.
#Name the four elements ans1, ans2, ans3, and ans4
aS2Q5 <-
#Question 2.6 (2 points)
#Display the element ans3 from the list created in question 2.5
using two different methods
In: Computer Science
The assignment will be graded both running and reading your code.
Readability: Your code should be readable. Add
comments wherever is necessary.
If needed, write helper functions to break the code into small,
readable chunks.
Write two concrete classes implementing GeometricShape
The class Circle. Circle will have the following public methods:
// a constructor
Circle(Point center, int radius);
// returns the area of the circle
float getArea();
// returns the perimeter of the circle
float getPerimeter();
// prints the center of the circle and its radius
virtual void print();
The class Rectangle. Rectangle will have the following public methods:
// a constructor
Rectangle(Point topLeftPoint, int length,
int width);
// returns the area of the rectangle
float getArea();
// returns the perimeter of the circle
float getPerimeter();
// prints the top left point of the rectangle, its length
and width
virtual void print();
Write a function test() that tests your solutions.
In: Computer Science
write a paragraph on each of the topics. your paragraph needs to include your understanding of the content (in your own words) and how you might envision using that content to produce a multi-page website.
Write it on your own words.
In: Computer Science
Write a C program to find the count of words and optionally the longest and or shortest words in a string input by the user or coming from a file. If there is no filename the user would enter the string right after running the command. You must use getopt to parse the command line.
Usage: words [-l] [-s] [filename]
The l flag means to find the longest and the s option means to find the shortest. You may have both or one of the flags. Output should be well formatted and easy to read.
Code should be nicely indented and commented.
Create a simple Makefile to compile your program into an executable called words.
You should submit the source code and your Makefile. The Makefile should be called Makefile with no extension. I should be able to type make at the command line to compile your program. Do not include any other files or folders in the zipfile. This applies even if you are a Mac user.
In: Computer Science
Write a statement that opens the file 'final.txt' in append mode and assigns it to my_file. PYTHON
In: Computer Science
In Python 3. Design, implement, and test a network application that maintains an online phonebook. The data model for the phonebook is saved in a file on the server’s computer. Clients should be able to look up a person’s phone number or add a name and number to the phonebook. The server should handle multiple clients without delays.
In: Computer Science
python
College is an investment. Tuition can range from $3,000 to $20,000 for a full-time student per semester. It seems like every year the cost continues to increase. It has been announced that the average tuition will increase by 5 percent each year for the next 4 years. To help students manage the cost of college, write a program that allows the students to input their full-time tuition cost per semester and then using a loop displays the projected semester tuition amount for the next 4 years.
Ex.
Enter the full-time student tuition per semester:
5000
when 10000
Enter the full-time student tuition per semester: - In 1 year, the tuition will be $10500.00.
-In 2 years, the tuition will be $11025.00.
In 3 years, the tuition will be $11576.25.
here is what i got
def main():
amount=5000.0
print('Enter the full-time student tuition per semester:')
for i in range(1,5):
amount=amount+(amount*0.05)
if i is 0:
print('- In '+str(i)+' year, the tuition will be $'+str((amount))+'.')
elif i is 5:
print('- In '+str(i)+' years, the tuition will be $'+str(round(amount, 2))+'2.')
else:
print('- In '+str(i)+' years, the tuition will be $'+str(round(amount,2))+'.')
if __name__=="__main__":
main()
In: Computer Science
Java.
Write 3 methods named addArrays, subArrays, and mulArrays each.
addArrays gets two matrices(int [][] array1, int [][] array2) as parameters and add them and returns the result (matrix).
subArrays gets two matrices(int [][] array1, int [][] array2) as parameters and subtract array2 from array1 and returns the result (matrix).
mulArrays gets two matrices(int [][] array3, int [][] array4) as parameters, multiplying them and returning the result(matrix).
In: Computer Science
Define the following term:
1. Bootstrap Protocol (BOOTP)
2. Simple Mail Transfer Protocol (SMTP)
3. Post Office Protocol (POP)
4. Internet Message Access Protocol (IMAP)
5. File Transfer Protocol (FTP)
In: Computer Science