In: Computer Science
TCP congestion control the congestion window is typically resized at the event receiving
a) Timeout and 3 duplicate acknowledgment?
**Please Explain the solution when you answer my questions because I don't know how to solve it :(
In: Computer Science
This research report is broken into two parts:
2. Is the wireless network you own as secure as it should be? Examine your wireless network or that of a friend or neighbor and determine which security model it uses. Next, outline the steps it would take to move it to the next highest level. Estimate how much it would cost and how much time it would take to increase the level. Finally, estimate how long it would take you to replace all the data on your computer if it was corrupted by an attacker, and what you might lose. Would this be motivation to increase your current wireless security model? Write a one-page paper on your work.
In: Computer Science
Task
Create a class called Mixed. Objects of type Mixed will store and manage rational numbers in a mixed number format (integer part and a fraction part). The class, along with the required operator overloads, should be written in the files mixed.h and mixed.cpp.
Details and Requirements
Finish Lab 2 by creating a Mixed class definition with constructor functions and some methods.
The Mixed class should have public member functions Evaluate(), ToFraction(), and Simplify(). The Evaluate() function should return a double, the others don’t return anything. These functions have no parameters. The names must match the ones here exactly. They should do the following:
Create an overload of the extraction operator >> for reading mixed numbers from an input stream. The input format for a Mixed number object will be:
integer numerator/denominator
i.e. the integer part, a space, and the fraction part (in numerator/denominator form), where the integer, numerator, and denominator parts are all of type int. You may assume that this will always be the format that is entered (i.e. your function does not have to handle entry of incorrect types that would violate this format). However, this function should check the values that come in. In the case of an incorrect entry, just set the Mixed object to represent the number 0, as a default. An incorrect entry occurs if a denominator value of 0 is entered, or if an improper placement of a negative sign is used. Valid entry of a negative number should follow this rule - if the integer part is non-zero, the negative sign is entered on the integer part; if the integer part is 0, the negative sign is entered on the numerator part (and therefore the negative sign should never be in the denominator). Examples:
Valid inputs: 2 7/3 , -5 2/7 , 4 0/7 , 0 2/5 , 0 -8/3
Invalid inputs: 2 4/0 , -2 -4/5 , 3 -6/3 , 0 2/-3
Create an overload of the insertion operator << for output of Mixed numbers. This should output the mixed number in the same format as above, with the following exceptions: If the object represents a 0, then just display a 0. Otherwise: If the integer part is 0, do not display it. If the fraction part equals 0, do not display it. For negative numbers, the minus sign is always displayed to the left.
Examples: 0 , 2 , -5 , 3/4 , -6/7 , -2 4/5 , 7 2/3
Create operator overloads for the 4 standard arithmetic operations ( + , - , * , / ) , to perform addition, subtraction, multiplication, and division of two mixed numbers. Each of these operators will perform its task on two Mixed objects as operands and will return a Mixed object as a result - using the usual meaning of arithmetic operations on rational numbers. Also, each of these operators should return their result in simplified form. (e.g. return 3 2/3 instead of 3 10/15, for example).
Use function __gcd (you need to add #include <algorithm>) for calculation of the greatest common divisor) for simplification of the fractions. For subtraction and division, you can use inverse rules to simplify your code, see Inverse of rational number.
In the division operator, if the second operand is 0, this would yield an invalid result. Since we have to return something from the operator, return 0 as a default (even though there is no valid answer in this case). Example:
Mixed m(1, 2, 3); // value is 1 2/3 Mixed z; // value is 0 Mixed r = m / z; // r is 0 (even though this is not good math)
Create overloads for the increment and decrement operators (++ and –). You need to handle both the pre- and post- forms (pre-increment, post-increment, pre-decrement, post-decrement). These operators should have their usual meaning – increment will add 1 to the Mixed value, decrement will subtract 1. Example:
Mixed m1(1, 2, 3); // 1 2/3 Mixed m2(2, 1, 2); // 2 1/2 cout << m1++; // prints 1 2/3, m1 is now 2 2/3 cout << ++m1; // prints 3 2/3, m1 is now 3 2/3 cout << m2--; // prints 2 1/2, m2 is now 1 1/2 cout << --m2; // prints 1/2 , m2 is now 0 1/2
Driver Program
The sample driver program that is provided can be found below. Note, this is not a comprehensive set of tests. It is just some code to get you started, illustrating some sample calls.
#include <iostream>
#include "mixed.h"
using namespace std;
int main(){
Mixed m0(1, 1, 1); // 1 1/1 == 2
m0.Simplify();
cout << m0 << endl; // prints 2
m0.ToFraction();
cout << m0 << endl; // prints 2/1
Mixed m1(1, 2, 3); // 1 2/3
m1.Print(); // prints 1 2/3
cout << m1++ << endl; // prints 1 2/3, m1 is now 2
2/3
cout << ++m1 << endl; // prints 3 2/3, m1 is now 3
2/3
Mixed m2(2, 5, 3); // 2 5/3
cout << m2 << endl; // prints 2 5/3
cout << m2.Evaluate() << endl; // prints 3.6666
m2.Simplify(); // m2 is now 3 2/3
cout << m2 << endl; // prints 3 2/3
Mixed m3 = m1 + m2; // m3 is now 7 1/3
cout << m3 << endl; // prints 7 1/3
cout << m3.Evaluate() << endl; // prints 7.3333
Mixed m4(1, 2, 3); // 1 2/3
m4.ToFraction();
cout << m4 << endl; // prints 5/3
Mixed m5 = m4 + Mixed(1);
cout << m5 << endl; // prints 2 2/3
Mixed m6(1);
cout << m6 << endl; // prints 1
m6.ToFraction();
cout << m6 << endl; // prints 1/1
cout << m6-m4 << endl; // prints -2/3
Mixed m7(0,3,4);
cout << m5*m7 << endl; // prints 2 (= 8/3 * 3/4)
cout << m5/m7 << endl; // prints 3 5/9 (32/9 = 8/3 *
4/3)
cout << "m4 == m4: " << boolalpha << (m4 == m4)
<< endl;
cout << "m5 != m4: " << boolalpha << (m5 != m4)
<< endl;
cout << "m5 > m4: " << boolalpha << (m5 >
m4) << endl;
cout << "m5 >= m4: " << boolalpha << (m5 >=
m4) << endl;
cout << "m4 < m5: " << boolalpha << (m4 <
m5) << endl;
cout << "m4 <= m4: " << boolalpha << (m4 <=
m4) << endl;
}
In: Computer Science
RFID tags are being increasingly used by companies such as Macy's, Walmart, and Home Depot. Identify an additional company that uses RFIDs and write a one-page paper that describes the company's specific application of RFIDs. What are the two differences between an RFID and a UPC system?
In: Computer Science
write a program that finds the average of all positive, non-zero values found in a given array of doubles and prints that to the console. Any negative or zero values do not contribute to the average. The program should use the array provided in the code, and you may assume that it has already been populated with values. The results should be printed out to the console in the following format:
“Average: ”<<average value>>
Values denoted in “<< >>” represent variable values, and strings in quotations denote literal values (make sure to follow spelling, capitalization, punctuation, and spacing exactly). Also, if there are either no non-zero or positive in the array then print out the average value as “0.0”.
Solution Tests:
Average: 7.0
Average: 3.5
Average: 0.0
PROVIDED CODE:
* Provided code. Do not alter the code that says "Do not alter" * Make sure this at least compiles (no syntax errors) * You may write additional methods to help */ //Do not alter----------------------------------------------------------------------- import java.util.Scanner; public class Question04 { public static double[] array;//The array to be used in the problem public static void main(String[] args) { int number;//Used for the stairs if(args == null || args.length == 0) { //----------------------------------------------------------------------------------- double[] tempArray ={2.0,-4.0,-6.0,8.0,11.0};//You may change these values to test your solution //Do not alter----------------------------------------------------------------------- array = tempArray; } else { } //----------------------------------------------------------------------------------- //Write your solution here }//Do not alter this //Space for other methods if necessary----------------------------------------------- //Write those here if necessary //----------------------------------------------------------------------------------- }//Do not alter this /*Solution Description *
In: Computer Science
What are some of the differences between FireWire 400 and FireWire 800?
What is the maximum cable length of a FireWire 400 cable? A FireWire 800 cable?
In what ways does IEEE 1394 differ from USB?
In: Computer Science
We have an array of numbers, and we start at index 0. At every point, we're allowed to jump from index i to i+3, i+4, or stop where we are. We'd like to find the maximum possible sum of the numbers we visit. For example, for the array [14, 28, 79, -87, 29, 34, -7, 65, -11, 91, 32, 27, -5], the answer is 140. (starting at the 14, we jump 4 spots to 29, then 3 spots to 65, another 3 to 32, then stop. 14 + 29 + 65 + 32 = 140) What's the maximum possible sum we could visit for this array: [95, 69, 68, 44, 0, 53, 34, -83, -8, 38, -63, -89, 34, -91, 1, 39, -7, -54, 85, -25, -47, 89, -57, -18, -22, -50, -74, -91, -38, 99, 73, 7, 44, -47, -35, -70, 26, -54, -28, 7, -26, -73, -48, -76, -18, 94, -54, 65, -71, -10, 5, 64, 55, 68, 7, 41, -52, 57, -75, 90, -21, -47, -88, -5, -9, 46, -8, 71, 34, 82, 10, -37, 37, 1, 49, 91, 80, 57, -56, 83, -58, 24, -34, 30, -65, 42, -28, -84, -58, -62, 20, 89, -43, -16, 9, 37, -21, -71, -27, 93, 93, 3, 24, 51, 19, -54, -20, 43, 96, 15, -4, -30, -12, -88, 95, -89, 63, 63, 26, 34, 9, 66, 40, 59, -69, -29, -3, -89, -58, 45, 68, 45, 92, -51, 89, -75, 0, 14, 46, -20, -90, -83, 82, 29, -32, 68, 55, 41, -85, 56, 97, -11, -25, -28, 65, 61, 54, -36, -24, 98, 49, 19, 3, -94, -46, 26, 92, -72, -29, 93, 71, 15, 3, -89, -66, -85, -42, 83, 43, 27, 76, 71, 62, 44, 9, 2, 40, 8, 78, -6, -61, -93, 28, -46, -48, 25, -34, -91, 73, 90, 77, -5, 98, 1, -5, -85, 63, -15, 57, 20, 71, -67, -60, -46, -71, -9, 62, 99, 80, -15, 53, 29, 52, -91, -78, -77, -57, 21, -74, 46, -11, 74, -21, -48, -7, -56, 54, 8, -51, -61, -46, 79, 42, 97, 61, 40, -99, -13, 55, -53, -71, 80, 31, -35, 77, 89, -2, 75, 59, -66, 87, 23, 48, 80, -28, 86, 54, 37, -41, 95, -87, 79, -49, 8, -95, 66, 79, -38, 75, 49, -30, 7, -46, -44, 43, -26, -63, 23, 77, -8, 36, 83, 10, 12, -34, 32, -63, -32, 47, -5, 53, 66, 32, 14, 24, 28, 57, -48, -89, -51, -26, -21, -37, -41, -17, -40, 19, 25, 89, -11, 92, -43, -50, 53, -36, 50, -12, 68, -28, 18, 62, -48, -86, 87, -80, 58, 73, -93, 81, -86, 26, 3, 51, 74, 37, 45, 85, 12, 49, 93, -93, -5, 61, -64, -48, -11, 68, -36, -83, -18, 30, -53, -88, 6, 43, -38, 50, -28, 91, 49, 21, 86, -15, -18, 2, 0, 55, -73, 85, -49, -18, -90, 89, 79, -21, 23, 38, 43, 83, 72, 63, 14, -35, 81, -2, -71, 70, 51, -26, -20, 74, 10, -37, 61, -29, -62, 18, -46, 75, 98, 18, -4, 25, 13, 70, -34, 79, 16, -55, -7, -56, -55, 79, 29, 13, -31, -12, -29, -33, 12, 17, -5, -59, -12, 76, -6, -4, -5, -90, -45, -33, -14, -56, 64, -99, -65, -98, -97, 35, -50, -63, 8, -7, -46, 3, -69, 24, -23, -6, 78, -21, 2, -99, -29, 75, 40, -30, -40, 10, -41, -65, -42, -88, -8, -32, -2, -39, -95, -73, 32, 99, -35, -88, 81, -32, -19, 58, 83, -73, -23, 1, -34, -40, -39, 35, -52, -24, 57, -44, 2]
In: Computer Science
Can you please write this in python and comment as well so I can understand what yo are doing. Thank you.
1)Loop through list A, at each iteration, show the square root result of that element. Add proper text to your print function.
A = [-4, 1, -16, 36, -49, 64, -128]
2)Create a counter variable, name it i and initialize it to 0. Using a for loop, count how many numbers are divisible by 3 in range of 1 to 50.
3)Consider a string called S. Convert S into a list of words using split method. Then use a for loop to iterate over the list of words, only if letter c is in a word, print it. For example:
if ‘x’ in word: print(word).
S = “This class has three credits”
4) Create a for loop that iterates over list C and only prints an
element if it’s a number (int or float).
C = [13, ‘not me’, -4, ‘skip this one’, 6.1, 0.9, ‘NO’]
In: Computer Science
In: Computer Science
Language: Java or C (NO OTHER LANGUAGE)
Do NOT use Java library implementations of the data structures (queues, lists, STs, hashtables etc.)
Have a unit test implemented in main(). And comment every code.
Show examples from the executions.
Question:
First step: write a program based on DFS which can answer questions
of the type: "Find the a path from X to Y" Which should result in a
list of vertices traversed from X to Y if there is a path.
Second step: Change the program to use BFS.
For the vertex pairs use this as your input:
AL FL
AL GA
AL MS
AL TN
AR LA
AR MO
AR MS
AR OK
AR TN
AR TX
AZ CA
AZ NM
AZ NV
AZ UT
CA NV
CA OR
CO KS
CO NE
CO NM
CO OK
CO UT
CO WY
CT MA
CT NY
CT RI
DC MD
DC VA
DE MD
DE NJ
DE PA
FL GA
GA NC
GA SC
GA TN
IA IL
IA MN
IA MO
IA NE
IA SD
IA WI
ID MT
ID NV
ID OR
ID UT
ID WA
ID WY
IL IN
IL KY
IL MO
IL WI
IN KY
IN MI
IN OH
KS MO
KS NE
KS OK
KY MO
KY OH
KY TN
KY VA
KY WV
LA MS
LA TX
MA NH
MA NY
MA RI
MA VT
MD PA
MD VA
MD WV
ME NH
MI OH
MI WI
MN ND
MN SD
MN WI
MO NE
MO OK
MO TN
MS TN
MT ND
MT SD
MT WY
NC SC
NC TN
NC VA
ND SD
NE SD
NE WY
NH VT
NJ NY
NJ PA
NM OK
NM TX
NV OR
NV UT
NY PA
NY VT
OH PA
OH WV
OK TX
OR WA
PA WV
SD WY
TN VA
UT WY
VA WV
In: Computer Science
In: Computer Science
With the code that is being tested is:
import java.util.Random;
public class GVdate
{
private int month;
private int day;
private int year;
private final int MONTH = 1;
private final int DAY = 9;
private static Random rand = new Random();
/**
* Constructor for objects of class GVDate
*/
public GVdate()
{
this.month = rand.nextInt ( MONTH) + 1;
this.day = rand.nextInt ( DAY );
}
public int getMonth()
{return this.month;
}
public int getDay()
{return this.day;
}
public int getYear()
{return this.year;
}
public String toString()
{String monthString = "0" + this.month;
int monthLength = monthString.length();
String dayString = "0" + this.day;
int dayLength = dayString.length();
return (
"\t" +
monthString.substring( monthLength-2 ) + ":" +
dayString.substring( dayLength-2 ) + " " +
this.year
);
}
public boolean isMyBirthday()
{return month == 8 && day == 31 && year ==
2001;
}
public void setMonth( int m )
{
month=m;
}
public void setDay( int d )
{
day=d;
}
public void setYear( int y)
{
year=y;
}
public void setDate (int m, int d, int y)
{ year = y;
month = m;
day = d;
}
}
How do I fix the errors so that it runs?
int errors = 0; System.out.println ("Testing begings"); //********** phase 1 testing ************ // testing the default constructor GVdate today = new GVdate(); if (today.getMonth() != 10){ System.out.println("month should be 10"); errors++; } if (today.getDay() != 12){ System.out.println("day should be 12"); errors++; } // TO DO: test the year // testing constructor 2 GVdate theDay = new GVdate(1, 10, 1995); // TO DO: complete the checks for month, day and year // testing setter methods //testing setMonth theDay.setMonth(8); // TO DO: complete the code to check for month // TO DO: finish testing setDay and setYear // TO DO: test the toString method System.out.println("Errors: " + errors); System.out.println ("Testing ends"); } }
In: Computer Science
Suppose you are given a file containing a list of names and phone numbers in the form "First_Last_Phone."
Write a program in C language to extract the phone numbers and store them in the output file.
Example input/output:
Enter the file name: input_names.txt
Output file name: phone_input_names.txt
1) Name your program phone_numbers.c
2) The output file name should be the same name but an added phone_ at the beginning. Assume the input file name is no more than 100 characters. Assume the length of each line in the input file is no more than 10000 characters.
3) The program should include the following function: void extract_phone(char *input, char *phone); The function expects input to point to a string containing a line in the “First_Last_Phone” form. In the function, you will find and store the phone number in string phone.
Please also comment on your code to help to understand, thank you.
In: Computer Science
c++ language
Create a file program that reads an int type Array size 10; the array has already 10 numbers, but your job is to resize the array, copy old elements of array to the new one and make it user input and add an additional 5 slots in the array, and lastly do binary search based on user input. close the file.
In: Computer Science