Questions
IN JAVA Minimal Documentation Required (no javadoc) Purpose The purpose of this assignment is to introduce...

IN JAVA

Minimal Documentation Required (no javadoc)

Purpose

The purpose of this assignment is to introduce you to basic operations on a linked list.

Specifics

Design a program that generates a linked list of randomly generated Integer objects. Present a menu at program start that gives the user the following options (most of these options will have corresponding methods in a Linked List class):

1. Create a new list. The size will be specified by the user, make sure a non-negative value is entered. If there is a pre-existing list when this option is chosen, make sure you delete the contents of that list before creating your new list.

2. Sort the list. How you implement this is up to you. You can insert items in the list such that the list is always in sorted order or you can write a sort routine. You may not call a sort routine provided by the Java API.

3. Print the list (to the screen), one number per line.

4. Print the list in reverse order (to the screen), one number per line.

5. Generate a sub-list that contains all the even numbers in the current list. This list should be returned and the contents should be displayed (to the screen), one number per line.

6. Print the contents of every "nth" node in the list. Obtain the "n" from the user, ensure it is greater than 0.

7. Delete node(s) containing an integer value entered by the user. You should report how many were deleted to the user.

8. Delete the contents of the current list.

9. Quit

You may use any linked list implementation you wish (singly linked, doubly linked, dummy head node, circular).

In addition to your LinkedList class, include a driver file called ListTester that will contain the menu and anything else you deem necessary (perhaps a utility to generate random Integers...).

Keep things modular and encapsulate your data properly - do not let anything outside the Linked List class have direct access to any of the nodes.

Do not accept Invalid input of any type from the user and do not let user input crash your program.

PLEASE IMPLEMENT ALL

In: Computer Science

IN JAVA A recursive method that takes a String as its argument and returns a list...

IN JAVA

  • A recursive method that takes a String as its argument and returns a list of Strings which includes all anagrams of the String. This method will contain a loop that generates each possible substring consisting of all but one character in the input String, ie the substring that omits the first letter, then the substring that omits the second letter, etc. Within the loop, the method calls itself recursively for each substring. For each String in the list returned by the recursive call, add the omitted character back to the end and add the String to the list to be returned. When the first instance of this method returns, the list will contain all anagrams of the original input String. It may help to work this out with a pencil and paper for a very short string (like "abc".) The most straightforward base case (termination condition for the recursion) is to return a list containing only a new empty String if the input String has length 0. If you want a challenge, try replacing this algorithm with one that uses the only recursion, with no loops.
  • A nonrecursive method that starts the recursion for the filtering step. This method will take a list of Strings, consisting of the anagrams, as its argument. Use a loop that takes each String in the list, converts it to an array of Strings using String's split() method with a blank space as the argument, and then uses the array to provide values for a list of Strings. The result of this will be a list of Strings in which each String is a word from the anagram. Still, inside the loop, call the recursive filter method for each of these Strings. In each case when it receives a non-null String as the return value fo the recursive filter method, it will add the String to the list which it returns.
  • A recursive filter method that takes a list of Strings and returns the following:
    • if all of the Strings in the list are contained in the list of valid words, return a single String made up of the Strings in the order in which they appear in the list
    • if any of the Strings in the list do not appear in the list of valid words, return null. This should be much more common than the first case.

If a list is received for which the last String is in the word list, this method should recursively call itself on a list consisting of all but the last word. If the recursive call returns a String (not null), add the last word back to the end of the String and return it. This method should not contain any loops.

In: Computer Science

/** * This class maintains an arbitrary length list of integers. * * In this version:...

/**
* This class maintains an arbitrary length list of integers.
*
* In this version:
* 1. The size of the list is fixed after the object is created.
* 2. The code assumes there is at least one element in the list.
*
* This class introduces the use of loops.
*
* @author Raymond Lister
* @version September 2015
*
*/
public class ListOfNVersion02PartB
{   
public int[] list; // Note: no "= {0, 1, 2, 3}" now

/**
* This constructor initializes the list to the same values
* as in the parameter.
*
* @param element the initial elements for the list
*/
public ListOfNVersion02PartB(int [] element)
{
// make "list" be an array the same size as "element"
list = new int[element.length];

for (int i = 0; i {
list[i] = element[i];
}


// add whatever code is required to complete the constructor


} // constructor ListOfNVersion01Skeleton(int [] element)

/**
* @return the first element in the list
*/
public int getFirst()
{
return list[0];

} // method getFirst

/**
* In ListOfN in this test, the toString method
* should return a String such that:
*
* 1. The String begins with an open brace "{" followed
* IMMEDIATELY (i.e. no space) by the first element
* of the list.
* 2. All remaining elements of the list are preceded by
* ", " (i.e. a comma folowed by a SINGLE space).
* 3. The String ends with a closing brace "}".
*
* e.g. "{1, 2, 3, 4}"
*
* @return A summary of the contents of the list.
*/
public String toString()
{
String s = "{"; // role: gatherer

for (int i = 0; i < list.length; i++)

if (i == 0)
{
s += list[i];
}
else
{
s += ", " + list[i];
}

s += "}";

// add and/or modify code to complete the method

return s;

} // method toString

/**
* @return the sum of the elements of the array
*/
public int sum()
{
int sum = 0;
  
for (int i = 0; i < list.length; i++)
{
sum += list[i];
}

// add and/or modify code to complete the method


return sum;

} // method sum

/**
* @return the number of times the replacement was made (i.e. 0 or 1)
*
* @param replaceThis the element to be replaced
* @param withThis the replacement
*/
public int replaceOnce(int replaceThis, int withThis)
{   
  
for (int i = 0; i < list.length; i++)

{
if( list[i] == replaceThis)
{
list[i] = withThis;
return 1;
}
  
}

// add and/or modify code to complete the method


return 0;
  

} // method replaceOnce

/**
* @return the value of the smallest element in the array
*/
public int minVal()
{
int min = Integer.MAX_VALUE;
  
for (int i = 0; i < list.length; i++)

if (list[i] < min)
{
min = list[i];
}

// add and/or modify code to complete the method


return min;

} // method minVal

/**
* Inserts an element in the first position. The elements already in the
* list are pushed up one place, and the element that was previously
* last is lost from the list.
*
* @param newElement the element to be inserted
*/
public void insertFirst(int newElement)
{   
int temp = list[0];
list[0] = newElement;

for (int i = 1; i < list.length-1; ++i)
{
int curr = list[i];
list[i] = temp;
temp = curr;
}


// add and/or modify code to complete the method


} // method insertFirst
  
/*
* This method is NOT examinable in this test.
*
* Swaps two elements in the list.
*
* @param i the position of one of the elements to be swapped
* @param j the position of one of the elements to be swapped
*/
private void swap(int i, int j)
{
int temp; // role: temporary

temp = list[i];
list[i] = list[j];
list[j] = temp;

} // method swap

/**
* "So the first shall be last, and the last first"
* -- The Christian Bible, book of Matthew 20:16
*/
public void reverse()
{
for (int i = 0, j = list.length - 1; i < list.length / 2 && j > list.length / 2; i++, j--)
{
swap(i, j);


// add and/or modify code to complete the method


} // method reverse

}} // class ListOfNVersion02PartB

How do i fix this??:

Failed: Check insertFirst. expected:<{7,[1,4],2}> but was:<{7,[4,1],2}>

I figured out my mistake, thank you anyway!

(the reverse method needed a while loop and fixed my insertFirst method )

In: Computer Science

Note: This problem is for the 2018 tax year. Lance H. and Wanda B. Dean are...

Note: This problem is for the 2018 tax year.

Lance H. and Wanda B. Dean are married and live at 431 Yucca Drive, Santa Fe, NM 87501. Lance works for the convention bureau of the local Chamber of Commerce, while Wanda is employed part-time as a paralegal for a law firm.

During 2018, the Deans had the following receipts:

Salaries ($60,000 for Lance, $41,000 for Wanda) $101,000
Interest income—
   City of Albuquerque general purpose bonds $1,000
   Ford Motor company bonds 1,100
   Ally Bank certificate of deposit 400 2,500
Child support payments from John Allen 7,200
Annual gifts from parents 26,000
Settlement from Roadrunner Touring Company 90,000
Lottery winnings 600
Federal income tax refund (for tax year 2017) 400

Wanda was previously married to John Allen. When they divorced several years ago, Wanda was awarded custody of their two children, Penny and Kyle. (Note: Wanda has never issued a Form 8332 waiver.) Under the divorce decree, John was obligated to pay alimony and child support—the alimony payments were to terminate if Wanda remarried.

In July, while going to lunch in downtown Santa Fe, Wanda was injured by a tour bus. As the driver was clearly at fault, the owner of the bus, Roadrunner Touring Company, paid her medical expenses (including a one-week stay in a hospital). To avoid a lawsuit, Roadrunner also transferred $90,000 to her in settlement of the personal injuries she sustained.

The Deans had the following expenditures for 2018:

Medical expenses (not covered by insurance) $7,200
Taxes—
   Property taxes on personal residence $3,600
   State of New Mexico income tax (includes amount withheld
       from wages during 2018) 4,200 7,800
Interest on home mortgage (First National Bank) 6,000
Charitable contributions 3,600
Life insurance premiums (policy on Lance's life) 1,200
Contribution to traditional IRA (on Wanda's behalf) 5,000
Traffic fines 300
Contribution to the reelection campaign fund of the mayor of Santa Fe 500
Funeral expenses for Wayne Boyle 6,300

The life insurance policy was taken out by Lance several years ago and designates Wanda as the beneficiary. As a part-time employee, Wanda is excluded from coverage under her employer's pension plan. Consequently, she provides for her own retirement with a traditional IRA obtained at a local trust company. Because the mayor is a member of the local Chamber of Commerce, Lance felt compelled to make the political contribution.

The Deans' household includes the following, for whom they provide more than half of the support:

Social Security Number Birth Date
Lance Dean (age 42) 123-45-6786 12/16/1976
Wanda Dean (age 40) 123-45-6787 08/08/1978
Penny Allen (age 19) 123-45-6788 10/09/1999
Kyle Allen (age 16) 123-45-6789 05/03/2002
Wayne Boyle (age 75) 123-45-6785 06/15/1943

Penny graduated from high school on May 9, 2018, and is undecided about college. During 2018, she earned $8,500 (placed in a savings account) playing a harp in the lobby of a local hotel. Wayne is Wanda's widower father who died on January 20, 2018. For the past few years, Wayne qualified as a dependent of the Deans.

Federal income tax withheld is $5,200 (Lance) and $2,100 (Wanda). The proper amount of Social Security and Medicare tax was withheld.

Required:

Determine the Federal income tax for 2018 for the Deans on a joint return by providing the following information that would appear on Form 1040 and Schedule A. They do not want to contribute to the Presidential Election Campaign Fund. All members of the family had health care coverage for all of 2018. If an overpayment results, it is to be refunded to them.

Make realistic assumptions about any missing data.

Enter all amounts as positive numbers.

If an amount box does not require an entry or the answer is zero, enter "0".

When computing the tax liability, do not round your immediate calculations. If required round your final answers to the nearest dollar.

In: Accounting

USING PYTHON Write a program to create a number list. It will call a function to...

USING PYTHON

Write a program to create a number list. It will call a function to calculate the average values in the list.

Define main ():

                       Declare variables and initialize them

                       Create a list containing numbers (int/float)

                       Call get_avg function that will return the calculated average values in the list.

                                      Use a for loop to loop through the values in the list and calculate avg

                       End main()

In: Computer Science

CCC3 In November 2017, after having incorporated Cookie Creations Inc., Natalie begins operations. She has decided...

CCC3 In November 2017, after having incorporated Cookie Creations Inc., Natalie begins operations. She has decided not to pursue the offer to supply cookies to Biscuits. Instead, she will focus on offering cooking classes. The following events occur.

1 Natalie purchases $5000 of Cookie Creations’ common stock.

2 Natalie teaches a group of elementary school students how to make Santa Claus cookies. At the end of the class, Natalie leaves an invoice for $3000- with the school principal. The principal says that he will pass it along to the business off

3 ice and it will be paid some time in the future

4 Cookie Creations receives $750 in advance from the local school board for five classes that the company will give during December and January.

5 Natalie receives a $500 invoice for use of her cell phone. She uses the cell phone exclusively for Cookie Creations Inc. business

11 Cookie Creations purchases paper and other office supplies for $2000. (Use Supplies.)

15 Natalie purchased equipment $3000 . Will pay for the equipment in 30days

15 . Natalie signs a note with the bank for $2,000 cash, for a two-year, 12% note payable. Interest and the principal are repayable at maturity.

15 Pays the cell phone invoice outstanding.

18 Natalie did her first class . She received $1000 cash.

23 Additional revenue during the month for cookie-making classes amounts to $4,000. (Natalie ha $3,000 in cash has been collected and $1,000 is still outstanding.

23 Received a bill from her accountant for $ 800

23 Issues a check to Natalie’s assistant for $800.

28 Pays a dividend of $500 to the common shareholder

30 Natalie received an advertising bill for $ 1500.

30 Cookie Creations pays $1,200 for a one-year insurance policy.

30 Cookie Creations receives a check for the amount due from the neighborhood school for the class given on November 2.

Additional Information

1. Monthly Depreciation on the equipment is $ 100

2. Accrued interest on the loan is $ 15

3. There were $500 of office supplies left at the end of the month

4. One month of insurance policy expired

5. Earned $ 300 for the entry on Nov 3

Required :

1. Journalize the above transactions

2. Post to ledger

3. Do a trial balance

4. Record adjusting entries in journal and post to the ledger

5. Adjusted trial balance

6. Do a income statement ,balance sheet and retained earnings statement

In: Accounting

Complete the following method in java: public static List<Integer> runningMedianOfThree(List items) Create and return a new...

Complete the following method in java:

public static List<Integer> runningMedianOfThree(List items)

Create and return a new List<Integer> instance (of any subtype of List of your choice) whose first two elements are the same as that of original items, after which each element equals the median of the three elements in the original list ending in that position. For example, when called with a list that prints out as [5, 2, 9, 1, 7, 4, 6, 3, 8], this method would return an object of type List<Integer> that prints out as [5, 2, 5, 2, 7, 4, 6, 4, 6].

In: Computer Science

IN C++ Write a program to find the number of comparisons using binarySearch and the sequential...

IN C++

Write a program to find the number of comparisons using binarySearch and the sequential search algorithm as follows:
Suppose list is an array of 1000 elements.

3 Search list for some items as follows:
a. Use the binary search algorithm to search the list. (You may need to modify the algorithm given in this chapter to count the number of comparisons.)
b. Use the binary search algorithm to search the list, switching to a sequentialsearch when the size of the search list reduces to less than 15. (Use the sequential search algorithm for a sorted list.)
Print the number of comparisons for Questions 3a and b. If the item is found in the list, then print its position.

In: Computer Science

Question Four Eric Aboagye was a 29-year-old math teacher at Ako Basic School in Pru District....

Question Four

Eric Aboagye was a 29-year-old math teacher at Ako Basic School in Pru District. He empathized with his students and was devoted to their success. A colleague described Aboagye as a “star teacher” and a “very hard worker, who will go the extra mile.” Aboagye was a teacher when Mary Afenya was Pru District’s school superintendent. Afenya set accountability measures for the Pru District school district and created performance objectives for the schools. Teacher evaluations were linked to students’ performance on standardized tests. Schools whose students did not make appropriate progress toward the standardized test goals received escalating sanctions that culminated in replacement of teachers and other staff, and restructuring or closing of the school. Ako Basic School had been classified as “a school in need of improvement” for the previous five years. Unless 58 percent of students passed the math portion of the standardized test and 67 percent passed the language arts portion, Ako Basic School could be closed down. Its students would be separated and bussed across town to different schools. Aboagye pushed his students to work harder than they ever had in preparing for the test. But he knew that it would be very difficult for many of them to pass. Mr. Mensah, the new principal of Ako Basic School, had heard that teachers in the elementary schools that fed into Ako had changed their students’ answers on the standardized tests under the guise of erasing stray pencil marks. Mr. Mensah asked Aboagye and other teachers to do the same. Aboagye found the exams of students who needed to get a few more questions right in order to pass. He changed their answers. If he did not change their scores, Aboagye feared that his students would lapse into “why try” attitudes. They would lose their neighborhood school and the community that had developed within it. Thanks to Aboagye and other teachers, students of Ako did better than ever on the standardized tests. Salomey, a former student at Ako at the time, recalled, “Everyone was jumping up and down,” after a teacher announced the school had met the requirements. The same process of changing answers continued at Ako for about five years. In the fifth year, nine other teachers were helping Aboagye change answers. Later in that year, the investigation unit of the Ghana Education Service (GES) visited Ako and other Pru District schools. The results of the investigation showed that, teachers and administrators at 20 schools had cheated in the manner that Aboagye had. Also, 78 teachers who had confessed or been accused of cheating were placed on administrative leave, including Aboagye. Later, Aboagye’ employment was terminated. (All characters used in the case are hypothetical)

1. In this case study, indicate and explain two benefits and three disadvantages of falsifying the results (make reference to relevant ethical theories and/or approaches).

2. Do you think cheating can ever be ethically justifiable? Why or why not (Explain three reasons – make reference to relevant ethical approaches)?

In: Operations Management

Part 2 of 2 - Two-way ANOVA Two-way ANOVA: For the problem below, use the ANOVA...


Part 2 of 2 - Two-way ANOVA
Two-way ANOVA: For the problem below, use the ANOVA table to determine whether the main effects and interaction were significant. Use the table of means and effect sizes to interpret the significant effects.

Katy is interested in the impact of different types of studying methods on students’ memory for different topics. She assesses the impact of flashcards versus study guides on students’ memory of biology versus psychology. The mean performance memory scores, ANOVA table, and effect sizes are reported below.

Mean memory scores: (Higher score = better memory)

Flashcards

Study guides

Biology

12

10

Psychology

30

32

ANOVA table:

Source

SS

df

MS

F

Between

Studying method

15.23

1

15.23

2.53

Topic

37.11

1

37.11

6.16*

Interaction

16.17

1

12.17

2.68

Within

120.40

20

6.02

Total

188.91

23

*p < .05

Eta-squared (n2): Notetaking method = 0.03, Topic = 0.22, Interaction = 0.05


Question 6 of 8
Write yes or no. (2 pts. each)

Was there a significant main effect of studying method?

Was there a significant main effect of topic?   

Was there a significant interaction?

Mark for Review What's This?
Question 7 of 8
For the following statements, write true or false based on the results and STATISTICAL interpretation of the ANOVA analysis: (2 pts. each)

Overall, students remembered more in psychology than in biology.

Overall, students remembered more after flashcards than after study guides.   

Overall, studying method did not impact student memory.

Students remembered more after flashcards in biology and more after study guides in psychology.   

The impact of study guides on memory was dependent on the topic.   

Flashcards led to better memory regardless of topic.   

Students remembered more in psychology regardless of studying method.   

Mark for Review What's This?
Question 8 of 8
Which of the following had the greatest impact on variance in students’ memory?

A. Studying method
B. Topic
C. Interaction
Reset Selection

In: Statistics and Probability