Questions
write a method called Comparisons that will return the number of comparisons to find an element...

write a method called Comparisons that will return the number of comparisons to find an element in the tree. The main program calls this method for each element, adding the comparisons each time in order to count the total number of comparisons. The program then outputs the total number of comparisons and the average number. You may use the program BuildTreeWIthMethod to build your tree. Then, after you have made the call to inOrder(root), add the following code:

int totalComparisons=0;

for (int i = 0; i < arr.length; i++) {
totalComparisons=totalComparisons + Comparisons(root, arr[i]);
}

System.out.println("Number of comparisons to find all data in tree is " + totalComparisons);
System.out.println("Average number of comparisons is " + totalComparisons*1.0/arr.length);

To be clear: you ONLY have to write the method and to put the code above into your program - use the program I gave to you.

2. Repeat the above for strings in an input file. The input file is here. words2.txt

In each case work the tree by hand (pencil and paper) so you know what the answer should be. You can EITHER submit two programs OR put both into one program. Your choice.

FOR THIS LAB it is OK if you have to write two TreeInsert methods (one for Integer, one for Strings), and two Comparisons methods (you can write template methods in the next lab) - but if you put template methods in here that is good too. ALSO the integers are in an array, but the Strings are in a file. So after you have built a tree of Strings you either have to close the input file, then reopen it and pick up each word again and calculate the number of comparisons to find it, or you have to look for another solution. (Possibilities are to read them into an array at the beginning before building your tree or count comparisons in the same loop where you read in your string. Either is fine (for now)).

words2.txt
Hi
Bye
Monday
April
Donkey
Yellow
Computers
Monkey
Dog
Cat

In: Computer Science

Using Virtualbox in Debian, write a simple program (a single .cpp file) in Linux shell C++...

Using Virtualbox in Debian, write a simple program (a single .cpp file) in Linux shell C++

Rules:

-Use fork(), exec(), wait(), and exit()

_______________________________________________________________________________________________________________________________________________

-A line of input represents a token group.

-Each token group will result in the shell forking a new process and then executing the process.

e.g. cat –n myfile.txt // a token group

-Every token group must begin with a word that is called the command(see example above). The words immediately following a command are calledarguments(e.g. there are two arguments for the catcommand above).A command may be followed bynone, one, or more argumentsas the command allows to have.

_______________________________________________________________________________________________________________________________________________

Shell Commands:

ls: a token group containing one token(i.e.a command)

ls -l: a token group containing two tokens (i.e.a command and an argument)

sort infile: a tokengroup containingtwo tokens (i.e.acommand and an argument)

dir: a token group containingonly one token (i.e.a command)

sort –dinfile: atoken group containingthree tokens (i.e.a command and two arguments)

cat infile: a token group containing two tokens (i.e.a command and an argument)

Lines of input are interpreted once their tokens are correctly extracted.Your shell should first print a # sign to the screen representing a prompt and wait there until the user types in a command. Your shell then spawns a child process to carry out the command.When yourshell finishes processingthe current line, it prints a # sign again to the screen waiting for the user to type in another command.This process is repeated until the user presses Ctrl-C to terminate your shell.

-Every command is to be interpreted as a valid Linux executable to be executed.

-All commands are assumed to be in the current directory.

-After interpreting a command, the shell should wait for the forked processto terminate before processingthe next line of input.

The program should be able to extract tokens from each input line entered by the user. If you have problems with extracting tokens from input lines, you may use the C++ library function strtok() to do it.

In: Computer Science

Instructions: Quite often, I have heard many people say that "a managers job is simply to...

Instructions:

Quite often, I have heard many people say that "a managers job is simply to tell people what to do." I sometimes wonder if that is true! Hey, I just thought of a great idea. Instead of just wondering if that statement has any validity to it, let's just ask a manager.

Your task for this week is to interview a manager.  It can be a present or past manager or someone whom you have never worked with. You may choose any organization you wish - perhaps one in which you or a family member/friend have worked. Feel free to choose a for-profit or not-for-profit organization. Below is a list of questions to help get you started.

  • What are their responsibilities?
  • What is their managerial hierarchy level? How many people do they report to directly?
  • What is the most challenging part of their job?
  • How many of the four basic management principles do they use? (planning, organizing, leading and controlling)
  • What is their managerial span of control?
  • How important to their job are technical, conceptual, interpersonal, and communication skills?
  • What is their primary leadership style? Does that style work for most situations or do they sometimes use a different approach?

Once you have completed your interviews, develop a summary of your findings that includes:

  • A brief summary of the organization and its purpose (you may withhold the name if you wish).
  • A description of the industry in which the organization exists (list major competitors if appropriate).
  • A description of the manager and his/her position within the organization (withhold the name).
  • Your paper should include: Two (2) Full Pages, Typed, Double Space, Font Size 12- Times Roman, MLA Format with a Minimum of (2) Cited Sources.

Your thoughtful input should reflect application of concepts studied in this module, and should reflect proper use of English grammar, spelling, punctuation, word usage, sentence structure, and paragraph structure.

In: Finance

RET Inc. currently has two products, low and high priced stoves. REX Inc. has decided to...

RET Inc. currently has two products, low and high priced stoves. REX Inc. has decided to sell a new line of medium-priced stoves. Sales revenues for the new line of stoves are estimated at $600 a year. Variable costs are 60% of sales. The project is expected to last 10 years. Also, non-variable costs are $200 per year. The company has spent $100 in research and a marketing study that determined the company will have synergy gains/sales of $200 a year from sales of its existing high-priced stoves. The production variable cost of these sales is $100 a year.

The plant and equipment required for producing the new line of stoves costs $300 and will be depreciated down to zero over 30 years using straight-line depreciation. It is expected that the plant and equipment can be sold (salvage value) for $50 at the end of 10 years. The new stoves will also require today an increase in net working capital of $20 that will be returned at the end of the project.

The tax rate is 20 percent and the cost of capital is 10%.

1. What is the initial outlay (IO) for this project?

2. What is the annual Earnings before Interests, and Taxes (EBIT) for this project?                                    

3. What is the annual net operating profits after taxes (NOPAT) for this project?

4. What is the annual incremental net cash flow (operating cash flow: OCF) for this project?

5. What is the remaining book value for the plant at equipment at the end of the project?

6. What is the cash flow due to tax on salvage value for this project? Enter a negative # if it is a tax gain. For example, if your answer is a tax on capital gains of $3,004.80 then enter   -3,005 ; if your answer is a tax shelter from a capital loss of $1,000.20 then enter 1,000

7. What is the project's cash flow for year 10 for this project?

8. Is the Net Present Value (NPV) for this project positive or negative? Just write the word positive or negative

In: Finance

Analyze 1 of the following government intervention programs: Countercyclical fiscal policies (countering economic disruptions such as...

Analyze 1 of the following government intervention programs:

  • Countercyclical fiscal policies (countering economic disruptions such as the housing bubble and the Great Recession)
  • US agriculture support programs
  • Assistance for Low Income Families (choose 1)
  • Housing vouchers
  • Earned Income Tax Credit (including Child Tax Credit)
  • Supplemental Nutrition Assistance Program (SNAP)
  • Low income healthcare (choose 1)
  • Medicaid (including Children's Health Insurance Program).
  • Affordable Care Act expansion
  • Social insurance programs (choose 1)
  • Old Age, Survivors, and Disability Insurance (OASDI)
  • Medicare
  • Unemployment insurance

Write a 700- to 1,050-word summary of your analysis. Identify the intervention and the market failure leading up to the intervention. Complete the following in your paper:

  • Analyze the arguments for government intervention as opposed to arguments for market-based solutions.Hint:See the information about market failures.
  • Examine who has been helped and who has been hurt by the selected government intervention.
  • Examine externalities and unintended consequences of such intervention. For example, consider whether the SNAP program and health coverage for low-income families result in higher future tax revenues because low-income children grow up healthier and produce higher incomes over their lifetimes.
  • Analyze whether cost of the intervention you selected as a share of GDP or the number of participants is increasing,decreasing, or varies with the state of the economy, based on the cost trend(or number of participants) since its inception or since 2000.
  • Analyze credible economists’ opinions on the success or failure of the intervention that you chose in achieving its objectives.
  • Recommend whether the program should be continued as is, discontinued, or modified based on your conclusions. Defend your recommendation.

References

https://www.congress.gov/bill/111th-congress/house-bill/1/text

https://projects.propublica.org/bailout/

https://www.bea.gov/

https://www.congress.gov/110/plaws/publ343/PLAW-110publ343.pdf

https://www.frbsf.org/

https://fred.stlouisfed.org/

http://www.oecd.org/

https://www.bls.gov/

https://www.census.gov/

In: Economics

This exercise requires designing a program which solves the problem described in the problem statement below....

This exercise requires designing a program which solves the problem described in the problem statement below. Provide comments in your pseudo-code and Java program as necessary.

Your solution must include these components:

  1. UML Class diagram
  2. Flowchart
  3. Pseudo-code
  4. Program Coded
  5. Program Output

Problem Statement

Design a class named Pet, which should have the following fields:

  • name: The name field holds the name of a pet.

  • type: The type field hold the type of animal that a pet is (for example, “dog”, “cat”, “bird”)

  • age: The age field holds the pet’s age.

The Pet class should also have the following methods:

  • setName: the setName method stores a value in the name field.

  • setType: the setType method stores a value in the type field

  • setAge: the setAge method stores a value in the age field.

  • getName: the getName method returns the value of the name field.

  • getType: The getType method returns the value of the type field.

  • getAge: the getAge method returns the value of the age field.

Once you have designed the class, design a program that creates an object of the class and prompts the user to enter the name, type, and age of his or her pet. This data should be stored in the object. Use the object’s accessor methods to retrieve the pet’s name, type, and age and display this data on the screen.

Expected Output

Your results should be similar to the following:

Please enter the name of your pet: Maestro

Please enter the type of your pet: dog

Please enter the age of your pet: 8


The name of your pet is Maestro.

Maestro is a dog.

Maestro is 8 years old.

Submission

Submit your assignment as a Microsoft Word document (.docx) with all components in the one document. Once submitted, the answer will be revealed.

Grading

This practice problem is NOT graded. However, you must complete the practice problem and survey before your graded programming assignment problem will be revealed.

In: Computer Science

This text is justified, meaning that the words are arranged so that both the left and...

This text is justified, meaning that the words are arranged so that both the left and right margins form straight lines. This is accomplished by varying the amount of space between words and characters in the text. Unfortunately, there are limits to this technique since uneven spacing eventually becomes noticeable to the human reader. Your job in this problem is going to be determining where to put line breaks in a sequence of words to make the most visually-pleasing justified paragraph.

You are given an array of word lengths (the lengths include space needed for whitespace and punctua- tion). We are assuming the every character occupies the same amount of space and that lines have room for 80 characters. You need to determine the number of words to put onto each line. Your selection must limit the number of characters per line to 80 or less. For example, consider the sequence 20, 20, 20, 10, 10, 10, 20, 15, 40. One possible solution would be 5, 3, 1 (i.e. 5 words on the first line, 3 on the second, and 1 on the third), which puts 80 characters on line 1, 45 on line 2, and 40 on line 3. A second solution would be 4, 4, 1, which puts 70 characters on line 1, 55 on line 2, and 40 on line 3.

The quality of your line breaks will be judged based on all lines except the last, which is ignored since the last line of a paragraph can be of any length. Every other line contributes the square of the number of unused characters on that line. You are asked to minimize the sum of these squares. For example, the first solution above has cost 02 + 252 = 1, 225 while the second has cost 102 + 252 = 725.

Give a fast dynamic programming algorithm to find the optimal set of line breaks. Be sure to explain how to get the actual locations of the line breaks (not just the optimal cost). Argue for your algorithm’s correctness and analyze its running time.

In: Computer Science

Write a C++ program for storing information on on a series of balls collected by a...

Write a C++ program for storing information on on a series of balls collected by a person. The balls should have these characteristics:

1. Diameter in mm

2. Color

3. if the texture of the surface is smooth or rough

4. an identification id/number

The program should allow the person to enter the values for the balls' attributes as they are entered in a database. The program should then offer the choice to save all new data into a file.

Next, the program should offer these operations:

1. List all balls with diameters above 10mm (Show all attribute values)

2. List all balls with less or equal to 10mm (Show all attribute values)

3. Show all balls that are smooth (Show all attribute values as a list)

4. Show all balls that are rough (Show all attribute values as a list)

5. Find a specific ball based on its id (Show all attributes)

6. How many balls of a specific color are in the database? (Show a total)

Program requirements:

1. The program must be OOP

2. Use of an array as temporary buffer to store ball objects

3. Move content of array to file

4. Retrieve all objects in file to an array at run time

5. Use of menus to direct user on the various available options for the program.

6. Use of header files for the classes need for this program (Use a project setup rather than a single app).

Delivery requirements:

1. Source code

2. Sample files generated by the program

3. A word document that summarizes your work with screenshots of your program running and generating outputs based on your menu selections. All menu options must be tested!

4. A conclusion within the above document about your performance in completing this task. This is going to be important for me to read and assess what needs to be done at the beginning of this course to bring each one of you to a level where CS230 will be performed without struggles.

In: Computer Science

Cash Flows from Operating Activities Net Income $        539,000 Adjustments to reconcile net income to net...

Cash Flows from Operating Activities
Net Income $        539,000
Adjustments to reconcile net income to net cash from operating activities:
Depreciation expense              63,400
Increase in net accounts receivable          (376,000)
Increase in inventory          (396,000)
Increase in accounts payable            102,000
Decrease in accrued liabilities            (79,000)
Increase in income taxes payable              24,000
Gain on sale of land            (53,000)
Loss on sale of investments                 6,000
Net cash provided(used) by operating activities $(169,600)
Cash Flows from Investing Activities
Purchase of machinery          (102,000)
Proceeds from sale of investments              91,000
Proceeds from sale of land            104,000
Net cash provided(used) by investing activities         93,000
Cash Flows from Financing Activities
Issuance of Preferred Stock              80,000
Issuance of Bonds Payable            175,000
Payment of cash dividends          (114,000)
Purchase of treasury stock            (80,000)
Net cash provided(used) by financing activities         61,000
Net change in cash       (15,600)
Cash, January 1, 2015         68,000
Cash, December 31, 2015 $     52,400

Analyze the Cash Flow Statement for the Big Corporation).    You obviously do not have access to all relevant information but you can identify potential concerns or areas of strength. Try to consider what these could mean for the company. Were they planned or unplanned? You do not know for sure but you can make reasonable assumptions and consider possible effects for the company. (You can type your analysis directly on this word document.)

Analyze the Cash Flows from Operating Activities identifying areas of strength and areas of concern:

Analyze the Cash Flows from Investing Activities identifying areas of strength and areas of concern :

Analyze the Cash Flows from Financing Activities identifying areas of strength and areas of concern:

Provide a summary analysis.Explain how strengths and concerns from operating activities could potentially relate to investing and financing decisions:

In: Accounting

Write a C++ program for storing information on on a series of balls collected by a...

Write a C++ program for storing information on on a series of balls collected by a person. The balls should have these characteristics:

1. Diameter in mm

2. Color

3. if the texture of the surface is smooth or rough

4. an identification id/number

The program should allow the person to enter the values for the balls' attributes as they are entered in a database. The program should then offer the choice to save all new data into a file.

Next, the program should offer these operations:

1. List all balls with diameters above 10mm (Show all attribute values)

2. List all balls with less or equal to 10mm (Show all attribute values)

3. Show all balls that are smooth (Show all attribute values as a list)

4. Show all balls that are rough (Show all attribute values as a list)

5. Find a specific ball based on its id (Show all attributes)

6. How many balls of a specific color are in the database? (Show a total)

Program requirements:

1. The program must be OOP

2. Use of an array as temporary buffer to store ball objects

3. Move content of array to file

4. Retrieve all objects in file to an array at run time

5. Use of menus to direct user on the various available options for the program.

6. Use of header files for the classes need for this program (Use a project setup rather than a single app).

Delivery requirements:

1. Source code

2. Sample files generated by the program

3. A word document that summarizes your work with screenshots of your program running and generating outputs based on your menu selections. All menu options must be tested!

4. A conclusion within the above document about your performance in completing this task. This is going to be important for me to read and assess what needs to be done at the beginning of this course to bring each one of you to a level where CS230 will be performed without struggles.

In: Computer Science