Exercise 9 – Writing values from a list into a file Complete the function design for the write_most_frequent() function, which takes 4 parameters, a string, a list of tuples, an integer, and another string: • The first string represents the name of the file to write to (with the append usage mode) • The list of tuples contains the information to write. Assume the list has already been sorted. • The integer represents the number of elements to read from the list and write to the file • The title should be written to the file before writing data from the list.
def test_write_most_frequent():
print("testing write_most_frequent")
list1 = [("a",27), ("bc",25), ("defg",21), ("hi",21),
("jk",18),
("l",17),
("m",16), ("nop", 15), ("qr", 14), ("s", 13),
("t",10),
("uv",9), ("x",5), ("yz",2)]
write_most_frequent("test_output.txt", list1, 5,
"Alphabet Statistics")
# Should append to a file called test_output.txt the
following:
# Results for Alphabet Statistics:
# a: 27
# bc: 25
# defg: 21
# hi: 21
# jk: 18
write_most_frequent("test_output.txt", list1, 12,
"Large Alphabet Statistics")
# Should append to a file called test_output.txt the
following:
# Results for Large Alphabet Statistics:
# a: 27
# bc: 25
# defg: 21
# hi: 21
# jk: 18
# l: 17
# m: 16
# nop: 15
# qr: 14
# s: 13
# t: 10
# uv: 9
-------------------------------------
# (str, (list of tuple), int, str -> None)
# appends to the file named filename data from the first
# n elements found in the given list; assumes the list is
sorted;
# the title given should be written on its own line first
def write_most_frequent(filename, list, n, title):
print("Fix me")
In: Computer Science
In C create a program that stores contact info. The program must have the following features:
The program must have the following structure:
Extra credit:
In: Computer Science
In: Nursing
Develop an algorithm to implement an employee list with employee ID ,name designation and department using link list and perform the following operation on the list
i)add employee details based on department
ii)remove employee details
iv)count the number of employee in each department
In: Computer Science
In: Computer Science
Q: Let’s say you have an unordered list of numbers and you wanted to put them in order from lowest to highest value. How would you do that? You’re probably thinking that you would just look at all the numbers, find the lowest number and put it at the beginning of your list. Then you would find the next largest number and put it in the second spot in the list, and so on until you’ve ordered the entire list of numbers. It’s simple, basic, and not very exciting. Now, let’s say that instead of ordering the list yourself, you decide it’s a better idea to write a computer program to order the list for you. Now you don’t have to deal with moving the numbers around, you just need to tell your program how to move the numbers, and then let the program handle any list you give it.Identify all possible ways of telling your program how to move the numbers, where each way provides the required result.
(Note: The program code is preferred to be in Java)
In: Computer Science
There are wide applications of the searching algorithm, where given a list of objects, to find whether the search target is in the list.
The intuitive solution is that we walk through the list until the search target is found or the end of the list is reached. The solution is called Linear Search.
For general purpose, let us use ListADT and define a static generic linear search method as follows:
public static <T extends Comparable<T>> int search(ListADT<T> array, T targetValue) throws EmptyCollectionException;
Please implement the linear search method, which walks through the given list and search for the targetValue until the targetValue is found or the end of the list is reached. If the targetValue is found, the method returns the index of the targetValue in the list or else it returns -1.
public static <T extends Comparable<T>> int search(ListADT<T> array, T targetValue) throws EmptyCollectionException {
}
In the hands-out or your sketchbook, please write down your code and take a snapshot and submit it.
Additionally, discuss and answer the following question:
what are the worst and average case running times for serial search?
In: Computer Science
1. Classify each of these transactions as an asset, a liability, or neither for each of the “players” in the money supply process – the Federal Reserve, the banking system, and nonbank public.
a) You take a $10,000 loan from Bank One to buy an automobile
b) You deposit $400 into your checking account at the First National Bank of Huntsville
c) The Fed provides an emergency loan to a bank for $ 1 million
d) A bank borrows $500,000 in overnight loans from another bank
e) You use your debit card to purchase a meal at a restaurant for $50
2. Suppose that Mr. Justin Bieber deposits $5,000 in his checking account at Santa Monica Bank. How does this transaction affect the monetary base? Show the changes in the balance sheets for Mr. Bieber, the bank, and the Fed.
3. What are the major differences between a discount loan and an open market purchase with respect to their respective effects on monetary base? Explain using an example and showing the relevant changes in the balance sheets of the Fed and the Banking System. Between these two actions, is one preferred to the other by the Fed? Why or why not?
4. As the bankers’ bank, the Federal Reserve Banks operate the payments system in the United States? What are the different components of the payments system that they operate? Briefly describe.
5. What are the main arguments against central bank independence? Is the Fed independent? How do you know? Explain.
In: Economics
Problem 6-10 (Algo) Long-term contract; revenue recognition over time [LO6-8, 6-9]
[The following information applies to the questions
displayed below.]
In 2021, the Westgate Construction Company entered into a contract
to construct a road for Santa Clara County for $10,000,000. The
road was completed in 2023. Information related to the contract is
as follows:
| 2021 | 2022 | 2023 | |||||||
| Cost incurred during the year | $ | 2,490,000 | $ | 3,984,000 | $ | 2,008,600 | |||
| Estimated costs to complete as of year-end | 5,810,000 | 1,826,000 | 0 | ||||||
| Billings during the year | 2,030,000 | 4,444,000 | 3,526,000 | ||||||
| Cash collections during the year | 1,815,000 | 3,900,000 | 4,285,000 | ||||||
Westgate recognizes revenue over time according to percentage of
completion.
Problem 6-10 (Algo) Part 1
Required:
1. Calculate the amount of revenue and gross
profit (loss) to be recognized in each of the three years.
(Do not round intermediate calculations. Loss amounts
should be indicated with a minus sign.
2-a. In the journal below, complete the
necessary journal entries for the year 2021 (credit "Various
accounts" for construction costs incurred).
2-b. In the journal below, complete the necessary
journal entries for the year 2022 (credit "Various accounts" for
construction costs incurred).
2-c. In the journal below, complete the necessary
journal entries for the year 2023 (credit "Various accounts" for
construction costs incurred).
In: Accounting
In: Economics