Let A and B be two stations attempting to transmit on an Ethernet. Each has a steady queue of frames ready to send; A’s frames will be numbered ?1, ?2 and so on, and B’s similarly. Let ? = 51.2 ???? be the exponential backoff base unit. Suppose A and B simultaneously attempt to send frame 1, collide, and happen to choose backoff times of 0 × ? and 1 × ?, respectively. As a result, Station A transmits ?1 while Station B waits. At the end of this transmission, B will attempt to retransmit ?1 while A will attempt to transmit ?2. These first attempts will collide, but now A backs off for either 0 × ? or 1 × ? (with equal probability), while B backs off for time equal to one of 0 × ?, 1 × ?, 2 × ? and 3× ? (with equal probability).
What is the probability that A wins all the ? backoff races. (? is a given constant)
In: Computer Science
Correct the code to prints the following:
0 1 2 3 4 5 6 7 8 9
int[] numbers = new int[10];
for(int i=0; i < numbers.length; ++i)
numbers[i] = i * 3;
for(int i=0; i < numbers.length; ++i)
System.out.print(numbers[i] / 2 + 1 + " ");
System.out.println();
In: Computer Science
The following shows the French translation for some colours: English French red rouge orange orange yellow jaune green vert blue bleu Create a program ColourTranslator that displays the French translation of the English colour obtained from the user. E.g.: System: Enter a colour in English: User: red System: The French word for red is rouge. Include a default case that handles input that is not on the list. e.g. System: Enter a colour in English User: purple System: Sorry, purple is not in the list.
In: Computer Science
Program 3: Give a baby $5,000! Did you know that, over the last century, the stock market has returned an average of 10%? You may not care, but you’d better pay attention to this one. If you were to give a newborn baby $5000, put that money in the stock market and NOT add any additional money per year, that money would grow to over $2.9 million by the time that baby is ready for retirement (67 years)! Don’t believe us? Check out the compound interest calculator from MoneyChimp and plug in the numbers!
To keep things simple, we’ll calculate interest in a simple way. You take the original amount (called the principle) and add back in a percentage rate of growth (called the interest rate) at the end of the year. For example, if we had $1,000 as our principle and had a 10% rate of growth, the next year we would have $1,100. The year after that, we would have $1,210 (or $1,100 plus 10% of $1,100). However, we usually add in additional money each year which, for simplicity, is included before calculating the interest.
Your task is to design (pseudocode) and implement (source) for a program that 1) reads in the principle, additional annual money, years to grow, and interest rate from the user, and 2) print out how much money they have each year. Task 3: think about when you earn the most money!
Lesson learned: whether it’s your code or your money, save early and save often…
Sample run 1:
Enter the principle: 2000
Enter the annual addition: 300
Enter the number of years to grow: 10
Enter the interest rate as a percentage: 10
Year 0: $2000
Year 1: $2530
Year 2: $3113
Year 3: $3754.3
Year 4: $4459.73
Year 5: $5235.7
Year 6: $6089.27
Year 7: $7028.2
Year 8: $8061.02
Year 9: $9197.12
Year 10: $10446.8
Sample run 2 (yeah, that’s $9.4MM):
Enter the principle: 5000
Enter the annual addition: 1000
Enter the number of years to grow: 67
Enter the interest rate as a percentage: 10
Year 0: $5000
Year 1: $6600
Year 2: $8360
Year 3: $10296
Year 4: $12425.6
Year 5: $14768.2
.
.
Year 59: $4.41782e+06
Year 60: $4.86071e+06
Year 61: $5.34788e+06
Year 62: $5.88376e+06
Year 63: $6.47324e+06
Year 64: $7.12167e+06
Year 65: $7.83493e+06
Year 66: $8.61952e+06
Year 67: $9.48258e+06
In: Computer Science
Computer Science, Website Design, Enhanced Business Technology
Write three paragraphs (4-7 sentences each) with three website references (i.e. quotes from websites) on Ajax technology and/or its business implications.
In: Computer Science
Let A and B be two stations attempting to transmit on an Ethernet. Each has a steady queue of frames ready to send; A’s frames will be numbered ?1, ?2 and so on, and B’s similarly. Let ? = 51.2 ???? be the exponential backoff base unit. Suppose A and B simultaneously attempt to send frame 1, collide, and happen to choose backoff times of 0 × ? and 1 × ?, respectively. As a result, Station A transmits ?1 while Station B waits. At the end of this transmission, B will attempt to retransmit ?1 while A will attempt to transmit ?2. These first attempts will collide, but now A backs off for either 0 × ? or 1 × ? (with equal probability), while B backs off for time equal to one of 0 × ?, 1 × ?, 2 × ? and 3× ? (with equal probability). (a) Give the probability that A wins this second backoff race immediately after his first collision. (b) Suppose A wins this second backoff race. A transmits ?2 and when it is finished, A and B collide again as A tries to transmit ?3 and B tries once more to transmit ?1. Give the probability that A wins this third backoff race immediately after the first collision. (c) What is the probability that A wins all the ? backoff races. (? is a given constant) (d) Assume that there are 3 stations sharing the Ethernet. Will the chance for A to win all the backoff races decrease or increase? Why?
In: Computer Science
C++ PROGRAMMING.
S-DES: The purpose of this assignment is to implement algorithm for encryption with the simplified DES-type algorithm.
· Item #1. Write a C++ program that performs one round of the simplified DES-type algorithm. Test your code with a plaintext = 011100100110 and K = 010011001.
In: Computer Science
Java Programing
Write a program called reverseProg.
This program will do the following
Sample output example:
Enter a string: Wilmington University
String Entered is: Wilmington University
Wilmington University spelled backward is: ytsirevinU notgnimliW
The 7th character in the string is: T
The 8th character in the string is: O
The 9th character in the string is: N
Length of the string is: 21
In: Computer Science
What python codes should I use to solve this question below?
Use input() function once to retrieve an input and assign that input value to a variable. Check if the input contains the string “an”. If so, use input() function one more time to retrieve an input and assign the new input value to a different variable. Now, replace “an” characters in the first variable with the first two characters of the second variable if only the second variable has at least two characters
In: Computer Science
Java Program
The program must prompt for an integer divisor in the range 10-20 and will print all numbers 1-1000 that are divisible by that divisor. You MUST use a while loop for this. Use printf to display the numbers in right-aligned columns, 10 to a line. For example, “%5d” would be the format String to allow a field width of 5 to display the number. If the number entered by the user is out of range just print an error message.
In: Computer Science
What is the DUAL table?
Explain the USER function.
Explain the ROWNUM pseudocolumn.
What is a sequence?
Answer the following in reference to sequences
a. Show the SQL code to create a sequence per the following:
Sequence Name: testsequence
Starts with: 100
Increments by: 2
b. Show the SQL command to display the next available sequence value (1st value).
c. Show the SQL command to display the next available sequence value (2nd value).
d. Show the SQL command to display the current sequence value.
e. Show the SQL code to delete the sequence
In: Computer Science
In: Computer Science
The todo section in java please
LinkedStack class (provided as a skeleton) is to implement TextbookStackInterface using chain of nodes to manage the data (see the textbook implementation).
The instance variable topNode is defined as chain head reference. The empty stack should have this variable set to null.
Skeleton of LinkedStack class is provided. Please note that in addition to all the methods defined in the TextbookStackInterface there are two methods: displayStack and remove that you also need to implement:
The class includes main with test cases to test your methods. The output of your program must match the sample run below:
SAMPLE RUN
*** Create a stack ***
--> Pushing A B C D E on the stack
Done adding 5 elements.
The content of the stack:
E
D
C
B
A
--> Testing peek, pop, isEmpty:
E is at the top of the stack.
E is removed from the stack.
D is at the top of the stack.
D is removed from the stack.
C is at the top of the stack.
C is removed from the stack.
B is at the top of the stack.
B is removed from the stack.
A is at the top of the stack.
A is removed from the stack.
--> The stack should be empty:
isEmpty() returns true
CORRECT - exception has been thrown: cannot complete peek() - stack is empty
CORRECT - exception has been thrown: cannot complete pop() - stack is empty
The stack is empty
--> Testing clear:
--> Pushing A B C D E F G on the stack
Done adding 7 elements.
The content of the stack:
G
F
E
D
C
B
A
--> Calling clear()
The stack is empty
--> Testing remove:
--> Calling remove(4) on empty stack
0 elements have been removed.
The stack is empty
--> Pushing A B C D E F G H I J on the stack
Done adding 10 elements.
The content of the stack:
J
I
H
G
F
E
D
C
B
A
--> Calling remove(4)
removing J
removing I
removing H
removing G
4 elements have been removed.
The content of the stack:
F
E
D
C
B
A
--> Calling remove(10)
removing F
removing E
removing D
removing C
removing B
removing A
6 elements have been removed.
The stack is empty
*** Done ***
Process finished with exit code 0
public final class LinkedStack<T> implements TextbookStackInterface<T> { private Node<T> topNode; // references the first node in the chain public LinkedStack() { // TODO PROJECT #3 } // end default constructor public void push(T newEntry) { // TODO PROJECT #3 } // end push public T peek() throws InsufficientNumberOfElementsOnStackException { // TODO PROJECT #3 return null; // THIS IS A STUB } // end peek public T peek2() throws InsufficientNumberOfElementsOnStackException { // TODO PROJECT #3 return null; // THIS IS A STUB } // end peek2 public T pop() throws InsufficientNumberOfElementsOnStackException { // TODO PROJECT #3 return null; // THIS IS A STUB } // end pop public boolean isEmpty() { // TODO PROJECT #3 return false; // THIS IS A STUB } // end isEmpty public void clear() { // TODO PROJECT #3 } // end clear public int remove(int numberOfElements) { // TODO PROJECT #3 return 0; // THIS IS A STUB } // end remove public void displayStack() { // TODO PROJECT #3 } // end displayStack
public interface TextbookStackInterface<T> { /** Adds a new entry to the top of this stack. @param newEntry An object to be added to the stack. */ public void push(T newEntry); /** Removes and returns this stack's top entry. @return The object at the top of the stack. throws appropriate exception if the stack is empty before the operation. */ public T pop(); /** Retrieves this stack's top entry. @return The object at the top of the stack. throws appropriate exception if the stack is empty. */ public T peek(); /** Detects whether this stack is empty. @return True if the stack is empty. */ public boolean isEmpty(); /** Removes all entries from this stack. */ public void clear(); } // end StackInterface
In: Computer Science
To understand the value of counting loops:
Sample Result is shown below:
Enter the number of rows of matrix A: 2
Enter the number of columns of matrix A: 3
Enter the number of columns of matrix B: 3
Enter the number of columns of matrix B: 4
Enter matrix A;
1 2 3
4 5 6
Enter matrix B:
7 8 9 10
11 12 13 14
15 16 17 18
Matrix A:
1 2 3
4 5 6
Matrix B:
7 8 9 10
11 12 13 14
15 16 17 18
Product of matrix A and Matrix B ( A x B) :
74 80 86 92
173 188 203 218
In: Computer Science
In java please create a class with a method to be able to add ints into a linked List and to be able to print out all the values at the end.
public class Node {
int data;
Node next;
In: Computer Science