A. There are 10 users whose traffic is being multiplexed over a single link with a capacity of 2 Mbps. Suppose each user generates 100 kbps when busy, but is only busy (i.e., has data to send) 10% of the time. Would circuit-switching or packet-switching be preferable in this scenario? Why?
B. Continuing the previous problem, assume that the link capacity is still 2 Mbps, but the amount of traffic each user has to send when busy is increased to 1 Mbps, and that each of the 10 users still only has data to send 10% of the time. Would circuit-switching or packet-switching be preferable in this scenario? Why?
In: Computer Science
A client sends a TCP segment to the server with Sequence Number 1400 and the payload included in the segment is 1399 bytes long.
- A. What is the ACK Number in the acknowledgement that is returned from the server?
- B. Assume this packet is lost but the following packet is received. What is the ACK Number in the acknowledgement that is returned from the server for this packet?
- C. Provide a detailed explanation for part B.
In: Computer Science
Write a Python program that print out the list of couples of prime numbers that are less than 50, but their sum is bigger than 40. For instance(29,13)or(37,17),etc. Your program should print all couples
In: Computer Science
Prove that in any nonempty set of n numbers, there is one number whose value is at least the average of the n numbers.
In: Computer Science
Trucking companies no longer merely carry goods from one place
to another. Some also provide supply chain management services to
their customers and help them manage their information. In this
project you�ll use the Web to research and evaluate two of these
business services. Investigate the Web sites of two companies, J.
B. Hunt and Schneider Logistics, to see how these companies�
services can be used for supply chain management. Using the
information found in those sites as well as your own outside
reasearch, create a 2-3 page essay in which you answer the
following questions: What supply chain processes can each of these
companies support for their clients? How can customers use the Web
site of each company to help them with supply chain management?
Compare the supply chain management services provided by these
companies. Which company would you select to help your firm manage
its supply chain? Why?
note Your essay should be 2-3 pages in length and fully explore all of the following items described above. Include at least 2 outside citations (not including your text) and use proper APA formatting.
In: Computer Science
In Python:
A hospital administrator wished to study the relation between patient satisfaction and patient’s age (years), severity of illness (an index), and anxiety level (an index). The administrator randomly selected 46 patients and collected the data, where larger values are associated with more satisfaction, increased severity of illness, and more anxiety.
(a) Plot satisfaction against severity of illness for young patients (less than 40 years old). Describe the relationship briefly: direct or inverse; linear or curved; strong, moderate, or weak.
(b) Plot satisfaction against the anxiety level for both young and old patients. Do you think anxiety predicts patients satisfaction? Explain!
Data:
satis age severity anxiety
48 50 51 2.3
57 36 46 2.3
66 40 48 2.2
70 41 44 1.8
89 28 43 1.8
36 49 54 2.9
46 42 50 2.2
54 45 48 2.4
26 52 62 2.9
77 29 50 2.1
89 29 48 2.4
67 43 53 2.4
47 38 55 2.2
51 34 51 2.3
57 53 54 2.2
66 36 49 2.0
79 33 56 2.5
88 29 46 1.9
60 33 49 2.1
49 55 51 2.4
77 29 52 2.3
52 44 58 2.9
60 43 50 2.3
86 23 41 1.8
43 47 53 2.5
34 55 54 2.5
63 25 49 2.0
72 32 46 2.6
57 32 52 2.4
55 42 51 2.7
59 33 42 2.0
83 36 49 1.8
76 31 47 2.0
47 40 48 2.2
36 53 57 2.8
80 34 49 2.2
82 29 48 2.5
64 30 51 2.4
37 47 60 2.4
42 47 50 2.6
66 43 53 2.3
83 22 51 2.0
37 44 51 2.6
68 45 51 2.2
59 37 53 2.1
92 28 46 1.8
In: Computer Science
In VB console write a Console Application that reads an input value for ??. You can assume that the user only inputs numeric values.
In: Computer Science
provide a full detailed table of the differences between Windows XP, Windows 7, windows 8 and windows 10
In: Computer Science
It is about C++linked list code. my assignment is making 1 function, in below circumstance,(some functions are suggested for easier procedure of making function.)
void push_Stack (struct linked_list* list, struct linked_node* node) //*This is the function to make and below is the explanation that should be written in given code.
This function inserts a node in stack manner. If the type of list is not stack, print the error message “Function push_Stack: The list type is not a stack” The new node will be always inserted to tail of the list which means the tail of the list should be changed after a new node is inserted.
Given code is written below,(There is a function to fill in last moment in this code)
linked_list.h: This is the header file of linkLQS.c that declares all the functions and values that are going to be used in linkLQS.c. You do not have to touch this function.
-----------------------------------------------------------------------
(Below code is about linked_list.h)
#include <stdio.h>
#include <stdlib.h>
#include <time.h>
struct linked_node{
int value;
struct linked_node* next;
struct linked_node* prev;
};
struct linked_list{
int type_of_list; // normal = 0, stack = 1
struct linked_node* head;
struct linked_node* tail;
int number_of_nodes;
};
--------------------------------------------------------
#include "linked_list.h"
#include "string.h"
extern int list_exist;
struct linked_list* create_list (int number_of_nodes, int
list_type)
{
int a[number_of_nodes];
int i, j;
int bFound;
if (number_of_nodes < 1)
{
printf("Function create_list: the
number of nodes is not specified correctly\n");
return NULL;
}
if(list_exist == 1)
{
printf("Function create_list: a
list already exists\nRestart a Program\n");
exit(0);
}
if(list_type != 0 && list_type != 1)
{
printf("Function create_list: the
list type is wrong\n");
exit(0);
}
struct linked_list * new_list = (struct
linked_list*)malloc(sizeof(struct linked_list));
new_list->head = NULL;
new_list->tail = NULL;
new_list->number_of_nodes = 0;
new_list->type_of_list = list_type;
//now put nodes into the list with random
numbers.
srand((unsigned int)time(NULL));
if(list_type == 0)
{
for ( i = 0; i <
number_of_nodes; ++i )
{
while ( 1
)
{
a[i] = rand() % number_of_nodes + 1;
bFound = 0;
for ( j = 0; j < i; ++j )
{
if ( a[j] == a[i] )
{
bFound =
1;
break;
}
}
if ( !bFound )
break;
}
struct
linked_node* new_node = create_node(a[i]);
insert_node(new_list, new_node);
}
}
else if(list_type == 1)
{
for ( i = 0; i <
number_of_nodes; ++i )
{
while ( 1
)
{
a[i] = rand() % number_of_nodes + 1;
bFound = 0;
for ( j = 0; j < i; ++j )
{
if ( a[j] == a[i] )
{
bFound =
1;
break;
}
}
if ( !bFound )
break;
}
struct
linked_node* new_node = create_node(a[i]);
push_Stack(new_list, new_node);
}
}
list_exist = 1;
printf("List is created!\n");
return new_list;
}
struct linked_node* create_node (int node_value)//This
functon is the example for reference of the assignment
function
{
struct linked_node* node = (struct
linked_node*)malloc(sizeof(struct linked_node));
node->value = node_value;
node->next = NULL;
node->prev = NULL;
return node;
}
void insert_node(struct linked_list* list, struct
linked_node* node)//This functon is the example for reference of
the assignment function
{
node->next = NULL;
node->prev = NULL;
if(list->head == NULL)
//if head is NULL, tail is also NULL.
{
list->head = node;
list->tail = node;
list_exist = 1;
}
else if(list->head == list->tail)
{
node->next =
list->head;
list->head->prev =
node;
list->head = node;
}
else if(list->head != list->tail)
{
node->next =
list->head;
list->head->prev =
node;
list->head = node;
}
(list->number_of_nodes)++;
}
void push_Stack(struct linked_list* list, struct
linked_node* node)//The function to be written!!
{
~~~~~~~~~~~~~~~~ //your code starts from
here
}
In: Computer Science
Complete the corresponding assembly language fragments by selecting the correct instruction, register, or value: (Choices in bold)
a) Consider the following fragment of C code:
if(a == b) {
x += 10;
A[50] = A[50] +x;
}
else {
y += 10;
A[50] = A[50] + y;
}
Assume that variables a, b, x and y are assigned to $s0, $s1, $s2 and $s3 respectively and the base address for array A is in $s4. Only register $t0 is used for storing results temporarily.
bne $s0, ($s0 / $s1 / $s2 / $s3 / $s4 / $t0), else
addi $s2, $s2, 10
lw $t0, (0 / 10 / 50 / 200 / $s1 / $t0) ($s4)
add $t0, $t0, $s2
sw $t0, 200($s4)
j Exit
else: addi $s3, $s3, (0 / 10 / 50 / 200 / $s1 / $t0)
lw $t0, 200($s4)
add $t0, 200($s4)
add $t0, $t0, ($s0 / $s1 / $s2 / $s3 / $s4 / $t0)
(beq / bne / j / add / addi / sll / lw / sw) $t0, 200($s4)
Exit:
b) Consider the following fragment of C code:
while (A[i] == 0) {
A[i] = A[i] + 10;
i += 1;
}
Assume that variable i is assigned to $s0 and the base address for array A is in $s1. A is an array of words. Registers $t0 and $t1 are used for storing results temporarily.
Loop: sll $t0, $s0, (0 / 1 / 2 / 4 / 10)
add $t0, $t0, $s1
lw $t1, 0( ($s0 / $s1 / $t0 / $t1 / $zero) )
bne $t1, $zero, (Loop / Exit)
addi $t1, ($s0 / $s1 / $t0 / $t1 / $zero), 10
sw $t1, 0($t0)
addi ($s0 / $s1 / $t0 / $t1 / $zero), $s0, 1
j Loop
Exit;
In: Computer Science
Consider the following page reference string:
0, 1, 2, 3, 1, 0, 4, 5, 1, 0, 1, 2, 6, 5, 2, 1, 0, 1, 2, 5
How many page faults would occur for the following replacement algorithms, assuming one, three, five, and seven frames? Remember that all frames are initially empty, so your first unique pages will cost one fault each.
In: Computer Science
3.1. Explain the concepts "Procedures" and "Modularity" as related to programming.
3.2. Explain each of the class members that belong to object orientated programming.
In: Computer Science
B. Write a program Median.java to read each file whose name is specified in the command-line arguments. That is, for each command-line argument, open it as a file and read it.
The file contents are zero or more lines each containing a list of comma-separated integers, such as 1,2,3,4 or 99,120,33. You should parse each of these integers and save them in an ArrayList (if you prefer you may use an array, but an ArrayList is likely to be easier for this assignment).
Once you have filled your array list with all the integers in the line, you must compute the median value, that is, the integer for which half the integers in the line are above it, and half are below it. There are two subtleties that you should handle correctly:
- each integer may appear more than once: in 1,1,2,2,3, the median is 2
- with an even number of integers, the median may be the average of two of the integers: in 1,2,3,4, the median is 2.5
You must implement and use a method whose header is one of
private static double
computeMedian(java.util.ArrayList<Integer> numbers)
or
private static double computeMedian(Integer[] numbers)
or
private static double computeMedian(int[] numbers)
to compute and return the median of all the numbers.
An algorithm to compute the median is as follows:
- for each number in the ArrayList (or array), compare it to all the numbers in the array, computing how many are above it, how many are below it, and how many are the same -- at least one (itself) should be the same.
- then if (the number below plus the number equal are greater than the number above) AND (the number below is less than the number equal plus the number above) then this number is the median.
For example, in 1,1,2,2,3:
- for the number 1, there are 0 numbers below, 2 numbers that are equal, and 3 numbers above, so 1 is not the median.
- for the number 2, there are 2 numbers below, 2 numbers that are equal, and 1 numbers above, so 2 is the median.
- for the number 3, there are 4 numbers below, 1 number that is equal, and 0 numbers above, so 3 is not the median.
On the other hand, if (the number below plus the number equal is the same as the number above) OR (the number below is the same as the number equal plus the number above) then this is one of two numbers, the average of which is the median.
For example, in 1,2,3,4,5,2, for the number 2, there is one number below and two numbers equal, which is the same as the three number above. For the number 3, there is one number equal and two numbers above, which is the same as the three numbers below. So in this case the median is the average of 2 and 3: mathematically, (2 + 3) / 2 = 2.5 (remember the division must be done using doubles, otherwise the result will be truncated).
To correctly implement this part of the computation, you need to have one or more variables declared outside the main loop, to keep track of whether you have already seen one of the two numbers whose average is the mean. In the example above, once you see 3 (after seeing 2), you should be able to immediately return the median 2.5. Be careful -- if you see another 2 (before seeing the 3), as in processing 2,2,1,3,5,4, you must continue your search past the second 2.
In: Computer Science
Please fulfill the requirements. Thank you
Objectives:
Description:
Write a menu-driven program that provides the following options:
It allows the user to select a menu option to display all expenses, add new entry, search for a substring and find the list of entries greater a given amount.
Requirements:
Required error handling:
The program MUST perform the following checks:
Sample run:
D:\>TrackExpensesUsingArray.exe
Welcome to my expense tracker.
Expense Tracking Menu:
1. show all
2. spend
3. search expenses containing this string
4. search expenses with greater than or equal to this amount
5. exit
Enter your option: 1
There is no expense entry available.
Expense Tracking Menu:
1. show all
2. spend
3. search expenses containing this string
4. search expenses with greater than or equal to this amount
5. exit
Enter your option: 2
Please enter the description for the expense: Monthly telephone and Internet services
Please enter the amount: 45.25
AMOUNT(45.25) DESC(Monthly telephone and Internet services)
Expense Tracking Menu:
1. show all
2. spend
3. search expenses containing this string
4. search expenses with greater than or equal to this amount
5. exit
Enter your option: 2
Please enter the description for the expense: Monthly electric, water and gas
Please enter the amount: 200.20
AMOUNT(200.2) DESC(Monthly electric, water and gas)
Expense Tracking Menu:
1. show all
2. spend
3. search expenses containing this string
4. search expenses with greater than or equal to this amount
5. exit
Enter your option: 2
Please enter the description for the expense: Rent
Please enter the amount: 1200
AMOUNT(1200) DESC(Rent)
Expense Tracking Menu:
1. show all
2. spend
3. search expenses containing this string
4. search expenses with greater than or equal to this amount
5. exit
Enter your option: 2
Please enter the description for the expense: Netflix membership
Please enter the amount: 12.90
AMOUNT(12.9) DESC(Netflix membership)
Expense Tracking Menu:
1. show all
2. spend
3. search expenses containing this string
4. search expenses with greater than or equal to this amount
5. exit
Enter your option: 2
Please enter the description for the expense: Amazon membership
Please enter the amount: 99
AMOUNT(99) DESC(Amazon membership)
Expense Tracking Menu:
1. show all
2. spend
3. search expenses containing this string
4. search expenses with greater than or equal to this amount
5. exit
Enter your option: 2
Please enter the description for the expense: Monthly gym membership
Please enter the amount: 50
AMOUNT(50) DESC(Monthly gym membership)
Expense Tracking Menu:
1. show all
2. spend
3. search expenses containing this string
4. search expenses with greater than or equal to this amount
5. exit
Enter your option: 1
Expenses:
AMOUNT(45.25) DESC(Monthly telephone and Internet services)
AMOUNT(200.2) DESC(Monthly electric, water and gas)
AMOUNT(1200) DESC(Rent)
AMOUNT(12.9) DESC(Netflix membership)
AMOUNT(99) DESC(Amazon membership)
AMOUNT(50) DESC(Monthly gym membership)
Expense Tracking Menu:
1. show all
2. spend
3. search expenses containing this string
4. search expenses with greater than or equal to this amount
5. exit
Enter your option: 3
Please enter the search string: membership
AMOUNT(12.9) DESC(Netflix membership)
AMOUNT(99) DESC(Amazon membership)
AMOUNT(50) DESC(Monthly gym membership)
Expense Tracking Menu:
1. show all
2. spend
3. search expenses containing this string
4. search expenses with greater than or equal to this amount
5. exit
Enter your option: 3
Please enter the search string: MEMBERSHIP
AMOUNT(12.9) DESC(Netflix membership)
AMOUNT(99) DESC(Amazon membership)
AMOUNT(50) DESC(Monthly gym membership)
Expense Tracking Menu:
1. show all
2. spend
3. search expenses containing this string
4. search expenses with greater than or equal to this amount
5. exit
Enter your option: 4
Please enter the amount: 50
AMOUNT(200.2) DESC(Monthly electric, water and gas)
AMOUNT(1200) DESC(Rent)
AMOUNT(99) DESC(Amazon membership)
AMOUNT(50) DESC(Monthly gym membership)
Expense Tracking Menu:
1. show all
2. spend
3. search expenses containing this string
4. search expenses with greater than or equal to this amount
5. exit
Enter your option: 4
Please enter the amount: 200
AMOUNT(200.2) DESC(Monthly electric, water and gas)
AMOUNT(1200) DESC(Rent)
Expense Tracking Menu:
1. show all
2. spend
3. search expenses containing this string
4. search expenses with greater than or equal to this amount
5. exit
Enter your option: 4
Please enter the amount: 1000
AMOUNT(1200) DESC(Rent)
Expense Tracking Menu:
1. show all
2. spend
3. search expenses containing this string
4. search expenses with greater than or equal to this amount
5. exit
Enter your option: 2
Please enter the description for the expense: Home repair and improvement
Please enter the amount: -1
Invalid amount. Amount cannot be negative or string. Please try it again.
Please enter the amount: -100
Invalid amount. Amount cannot be negative or string. Please try it again.
Please enter the amount: -1000
Invalid amount. Amount cannot be negative or string. Please try it again.
Please enter the amount: 175.75
AMOUNT(175.75) DESC(Home repair and improvement)
Expense Tracking Menu:
1. show all
2. spend
3. search expenses containing this string
4. search expenses with greater than or equal to this amount
5. exit
Enter your option: 1
Expenses:
AMOUNT(45.25) DESC(Monthly telephone and Internet services)
AMOUNT(200.2) DESC(Monthly electric, water and gas)
AMOUNT(1200) DESC(Rent)
AMOUNT(12.9) DESC(Netflix membership)
AMOUNT(99) DESC(Amazon membership)
AMOUNT(50) DESC(Monthly gym membership)
AMOUNT(175.75) DESC(Home repair and improvement)
Expense Tracking Menu:
1. show all
2. spend
3. search expenses containing this string
4. search expenses with greater than or equal to this amount
5. exit
Enter your option: 5
D:\>
In: Computer Science
Get information from the user Calculate Phone Line Charge Military Discount Display Phone Line Charge and Military Discount !!!!!
The user will need to input • Number of phone lines • Data plan chosen (U, M or L) U for Unlimited Data M for Moderate Data L for Limited Data • Military discount (Y or N) You can see examples of how to prompt the user for this information in the sample output windows below. Please note the number of phone lines can be an int, but the data plan and military discount need to use the char data type in order to store a U, M, L, Y or N. 2. Calculations (all these calculated variables should be double data type) • Phone Line Charge Unlimited data - $45 per phone line Moderate data - $25 per phone line Limited data - $15 per phone line • Discount (10% off phone line charge): if customer is an active or retired member of the military • Subtotal: Phone Line Charge - Discount • Surcharge and Taxes: 15% of Subtotal • Total: Subtotal + Surcharge and Taxes
In: Computer Science