PYTHON ONLY NO JAVA! PLEASE INCLUDE PSEUDOCODE AS WELL!
Program 4: Design (pseudocode) and implement (source code) a program (name it LargestOccurenceCount) that read from the user positive non-zero integer values, finds the largest value, and counts it occurrences. Assume that the input ends with number 0 (as sentinel value to stop the loop). The program should ignore any negative input and should continue to read user inputs until 0 is entered. The program should display the largest value and number of times it appeared as shown below in this sample runs. Document your code and properly label the input prompts and the outputs as shown below.
Sample run 1:
Enter positive integers (0 to quit): 3 4 5 -9 4 2 5 1 -5 2 5 0
Largest value: 5
Occurrences: 3 times
Sample run 2:
Enter positive integers (0 to quit): 3 7 5 -4 4 2 -5 5 1 7 0
Largest value: 7
Occurrences: 2 times
Sample run 3:
Enter positive integers (0 to quit): 2 9 8 -4 8 9 -5 8 9 1 7 7 9 0
Largest value: 9
Occurrences: 4 times
In: Computer Science
It is known that the mean time to solve the puzzle in healthy control children is 60 seconds. Carry out the Wilcoxon signed-rank test on these data to test the null hypothesis that the mean time to solve the puzzle for children with NF1 is the same as for healthy controls.
a) Calculate the value of the test statistic and give the approximate normal distribution of the test statistic under the null hypothesis.
b) Calculate the p-value for the test assuming a two-sided alternative hypothesis.
c) What do you conclude about the time taken by children with NF1 to solve the puzzle compared to healthy controls?
d) Describe in a few sentences how you would calculate a 95% confidence interval for the mean time without assuming any particular parametric model for the data. You do not need to calculate the interval.
Provided data is:-
ID yi
1 51
2 60
3 75
4 43
5 92
6 72
7 49
8 39
9 62
10 127
11 51
12 75
13 69
14 59
15 25
16 58
17 95
18 63
19 91
20 63
21 32
22 50
23 108
24 41
25 93
26 43
27 74
28 50
29 55
30 60
31 62
32 91
33 79
34 71
35 85
36 86
37 78
38 100
39 146
40 62
41 134
42 41
43 40
44 51
45 68
46 59
47 59
48 38
49 66
50 79
51 111
52 69
53 68
54 110
55 69
56 62
57 91
In: Statistics and Probability
5. Write a C++ statement or statements that will:
Print the first two digits and the last two digits of any 4 digit number stored in an integer variable n.
For example, given int n = 5623, print
56 23.
6. Write C++ statements that will align the following three lines as printed in two 20 character columns.
Name Years President
Abraham Lincoln 1860-1865
Thomas Jefferson 1801-1809
7. Write a C++ statement or statements that will Output if a string has a length greater than 10, equal to 10 or less than 10.
Examples :
string str1 = “Four Score and Seven Years Ago” would output “String Length > 10”
string str2 = “Good Day” would output “String Length < 10”
string str3 = 0123456789” would output “String Length = 10”
In: Computer Science
Alice and Bob are discussing Alice’s healthy eating. They suspect Eve is listening in, so they use double encryption. Message blocks are eight bits. Each block encodes a character using ASCII.
A block is first encrypted by flipping a single bit (changing 1 to 0 or 0 to 1). The key is a value from 0 to 7 and says which bit to flip. So if the key is 5, bit number 5 in each 8-bit block is flipped. Number bits from 0 to 7, starting at the right bit. (The book sometimes numbers bits in the other direction.)
The second key is a value from 0 to 7 and says how much to rotate the block left. So if the key is 2, blocks are rotated left by two bit positions.
Here is a plaintext block for ‘A’ : 0100 0001. Say the key is (4, 3). First flip bit 4: 0101 0001, and then rotate left by three: 1000 1010.
Eve intercepts the message
0000 1010 0010 1010 1000 0010 0111 1010 0010 1010 0100 0010 0000 1010
She suspects the first three blocks encode EAT. She knows the two ciphers that Alice and Bob are using, but does not know the two keys. Exhaustive search would require trying up to 8x8 = 64 key pairs until the first three blocks deciphered to EAT.
So she uses a known plaintext attack with Meet-in-the-Middle
|
Plaintext: EAT |
||
|
bit to flip |
A: block as 24 bits |
B: Col A in hex |
|
none |
||
|
0 |
||
|
1 |
||
|
2 |
||
|
3 |
||
|
4 |
||
|
5 |
||
|
6 |
||
|
7 |
||
Fill in the table by enciphering the first three blocks (1 byte each) of the known plaintext using the first cipher. The row labeled none is the 24 bits of unenciphered plaintext.
Now, fill in the second table by deciphering the first three blocks of the intercepted ciphertext using the second cipher. You are de-ciphering, so the rotation is right. There should be a match in column D to a cell in column B. Now Eve has the full key.
|
C |
D |
|
|
Second key (rotation) |
First 3 half-deciphered blocks in binary |
Column C in hex |
|
0 |
||
|
1 |
||
|
2 |
||
|
3 |
||
|
4 |
||
|
5 |
||
|
6 |
||
|
7 |
Use the full key to decipher the message. What is the secret that Alice sent to Bob?
In: Computer Science
Please answer all of them
Pough Publishing Company produces books for the retail market. Demand for a current book is expected to occur at a constant annual rate of 7200 copies. The cost of one copy of the book is $14. 50. The holding cost is based on an 18% annual rate, and production set up costs are $150 per set up. The equipment on which the book is produced has an annual production volume of 25,000 copies. Pough has 250 working days per year, and the lead time for a production run is 15 days. Use the production lot size model to compute the following values:
In: Operations Management
In: Advanced Math
Doaktown Products manufactures fishing equipment for recreational uses. The Miramichi plant produces the company’s two versions of a special reel used for river fishing. The two models are the M-008, a basic reel, and the M-123, a new and improved version. Cost accountants at company headquarters have prepared costs for the two reels for the most recent period. The plant manager is concerned. The cost report does not coincide with her intuition about the relative costs of the two models. She has asked you to review the cost accounting and help her prepare a response to headquarters.
Manufacturing overhead is currently assigned to products based on their direct labor costs. For the most recent month, manufacturing overhead was $298,400. During that time, the company produced 12,900 units of the M-008 and 2,300 units of the M-123. The direct costs of production were as follows:
| M-008 | M-123 | Total | ||||
| Direct materials | $ | 103,200 | $ | 92,000 | $ | 195,200 |
| Direct labor | 103,200 | 46,000 | 149,200 | |||
Management determined that overhead costs are caused by three cost drivers. These drivers and their costs for last year were as follows:
| Activity Level | |||||||||
| Cost Driver | Costs | M-008 | M-123 | Total | |||||
| Number of machine-hours | $ | 116,900 | 8,000 | 2,000 | 10,000 | ||||
| Number of production runs | 90,000 | 20 | 20 | 40 | |||||
| Number of inspections | 91,500 | 20 | 35 | 55 | |||||
| Total overhead | $ | 298,400 | |||||||
Required:
a. How much overhead will be assigned to each product if these three cost drivers are used to allocate overhead? What is the total cost per unit produced for each product? (Round your intermediate calculations and final answers to 2 decimal places.)
b. How much of the overhead will be assigned to each product if direct labor cost is used to allocate overhead? What is the total cost per unit produced for each product? (Round "Total unit cost" to 2 decimal places.)
In: Accounting
Doaktown Products manufactures fishing equipment for recreational uses. The Miramichi plant produces the company’s two versions of a special reel used for river fishing. The two models are the M-008, a basic reel, and the M-123, a new and improved version. Cost accountants at company headquarters have prepared costs for the two reels for the most recent period. The plant manager is concerned. The cost report does not coincide with her intuition about the relative costs of the two models. She has asked you to review the cost accounting and help her prepare a response to headquarters.
Manufacturing overhead is currently assigned to products based on their direct labor costs. For the most recent month, manufacturing overhead was $328,000. During that time, the company produced 15,000 units of the M-008 and 2,200 units of the M-123. The direct costs of production were as follows:
| M-008 | M-123 | Total | ||||
| Direct materials | $ | 120,000 | $ | 88,000 | $ | 208,000 |
| Direct labor | 120,000 | 44,000 | 164,000 | |||
Management determined that overhead costs are caused by three cost drivers. These drivers and their costs for last year were as follows:
| Activity Level | |||||||||
| Cost Driver | Costs | M-008 | M-123 | Total | |||||
| Number of machine-hours | $ | 154,000 | 8,000 | 2,000 | 10,000 | ||||
| Number of production runs | 80,000 | 20 | 20 | 40 | |||||
| Number of inspections | 94,000 | 25 | 35 | 60 | |||||
| Total overhead | $ | 328,000 | |||||||
Required:
a. How much overhead will be assigned to each product if these three cost drivers are used to allocate overhead? What is the total cost per unit produced for each product? (Round your intermediate calculations and final answers to 2 decimal places.)
b. How much of the overhead will be assigned to each product if direct labor cost is used to allocate overhead? What is the total cost per unit produced for each product? (Round "Total unit cost" to 2 decimal places.)
In: Accounting
Doaktown Products manufactures fishing equipment for recreational uses. The Miramichi plant produces the company’s two versions of a special reel used for river fishing. The two models are the M-008, a basic reel, and the M-123, a new and improved version. Cost accountants at company headquarters have prepared costs for the two reels for the most recent period. The plant manager is concerned. The cost report does not coincide with her intuition about the relative costs of the two models. She has asked you to review the cost accounting and help her prepare a response to headquarters.
Manufacturing overhead is currently assigned to products based on their direct labor costs. For the most recent month, manufacturing overhead was $330,400. During that time, the company produced 14,400 units of the M-008 and 2,500 units of the M-123. The direct costs of production were as follows:
M-008 M-123 Total
Direct materials $ 115,200 $ 100,000 $ 215,200
Direct labor 115,200 50,000 165,200
Management determined that overhead costs are caused by three cost drivers. These drivers and their costs for last year were as follows:
Activity Level
Cost Driver Costs M-008 M-123 Total
Number of machine-hours $ 153,900 1,000 9,000 10,000
Number of production runs 80,000 20 20 40
Number of inspections 96,500 15 30 45
Total overhead $ 330,400
Required:
a. How much overhead will be assigned to each product if these three cost drivers are used to allocate overhead? What is the total cost per unit produced for each product? (Round your intermediate calculations and final answers to 2 decimal places.)
b. How much of the overhead will be assigned to each product if direct labor cost is used to allocate overhead? What is the total cost per unit produced for each product? (Round "Total unit cost" to 2 decimal places.)
In: Accounting
Describe an efficient recursive algorithm for solving the element uniqueness problem, which runs in time that is at most O(n2) in the worst case without using sorting.
In: Computer Science