Questions
Exercise 9 – Writing values from a list into a file Complete the function design for...

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:...

In C create a program that stores contact info. The program must have the following features:

  • Able to store First Name, Phone Number and Birthday (MM/DD/YYYY)
  • Able to search for a specific contact using First Name, Phone Number and Birthday (find)
  • Able to delete a specific contact using First Name, Phone Number and Birthday (delete)
  • Print entire contact list
  • Show number of entries in contact list
  • Able to save Contact List to file (save)
  • Able to load Contact List from file (load)
  • Able to exit program (exit/quit)

The program must have the following structure:

  • Makefile that completely builds the entire project
  • Main file and library (implementation and header files with header guards)
  • Neat and Tidy code
  • Must have meaningful comments
  • Program must have a command and argument structure
  • Must use a linked list or dynamic array for contact list (NO REGULAR ARRAYS)
  • NO GLOBAL VARIABLES
  • Must use dynamically allocated memory that is correctly managed
  • Must use pointers
  • Must use a decision structure
  • Must give user feedback for all input (“contact list saved”, “entry ‘<user input>’ deleted”, etc.)
  • Must keep contact list sorted by First Name (sort as a new entry is added)
  • Use binary searching algorithm to find entries in contact list
  • All program features must be implemented as a function in a library.

Extra credit:

  • Used meaningful typedefs
  • Used enumerated data types
  • Used conditional operator in an inline if
  • Ask user to save contact list if they haven’t already before exiting

In: Computer Science

Define Addiction. List 5 examples of things that someone can be addicted to that are NOT...

  1. Define Addiction.
  2. List 5 examples of things that someone can be addicted to that are NOT illegal substances.
  3. List in your opinion the top 3 most dangerous risks of marijuana use that have been proven by research?
  4. List 4 physiological responses to smoking that increase disease risk

In: Nursing

Develop an algorithm to implement an employee list with employee ID ,name designation and department using...

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

Consider the matrix list x = [[1, 2, 3], [4, 5, 6], [7, 8, 9]]. Write...

  1. Consider the matrix list x = [[1, 2, 3], [4, 5, 6], [7, 8, 9]]. Write a list comprehension to extract the first column of the matrix [1, 4, 7]. Write another list comprehension to create a vector of twice the square of the middle column.

In: Computer Science

Q: Let’s say you have an unordered list of numbers and you wanted to put them...

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...

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...

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...

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

1. Please name for me five to ten occupations that are among the ‘hardest hit’ by...

1. Please name for me five to ten occupations that are among the ‘hardest hit’ by the pandemic in terms of workers losing wage income starting in March, 2020. 2. Please name for me five to ten occupations that are---or appear to be—the ‘least’ hardest hit by the pandemic in terms of lost wages 3. Are there any differences you can see, generally speaking, between the groups you listed in question 1 and in question 2? A college education? The nature of the job itself? How so? Membership in a union? 4. What is a union, exactly? Please name some occupations that tend to be ‘unionized’ in our country. Please name some of the largest unions in the U.S. and Santa Clara County. 5. How far should our government (G) go in order to try to “make whole” the workers in question #1? Should our G try to transfer money to these workers? Yes? WHY? How much? A. One quarter of their lost income? B. One third? C. One half? D. ALL OF IT???????? E. Do you see any potential problems with D???? What might they be? 6. Okay. One could argue that D may be a little extreme…. You have to form your own opinion….. IS NOW THE TIME IN OUR COUNTRY’S HISTORY FOR US TO CHANGE OUR CURRENT SYSTEM OF INCOME DISTRIBUTION AND WEALTH DISTRIBUTION? IF SO, just in general terms, what should we do? Why?

In: Economics