Please provide a detailed walk through osf this Java application, which uses recursion to find the maximal (largest) contiguous sum in a list of integers. Base code on the algorithm below.
Input Read from a text file (List.dat) lines of data where each line represents a list in this format:
list-size numbers in the list separated by blanks 4 100 -50 5 8
For example, List.dat might contain: 7 -2 -4 30 15 -7 -5 1000 2 -50 100 6 1000 -2000 900 2800 -2900 2801 0 4 100 -10 5 8 4 100 -50 5 8
Note: the list-size must be greater than 0. Bypass any line with 0 or a negative number as the first number, i.e., NO empty list. No error checking needed. You may assume that your input file is structured correctly: it contains all integers, and if the first number on a line is n, then there are n integers that follow it on that line.
Output For each line of data read, display the largest sum of consecutive integers in the list followed by the list itself. For the example lists as above, your output would be:
Largest sum of The list used consecutive integers 1033 -2 -4 30 15 -7 -5 1000 100 -50 100 3700 1000 -2000 900 2800 -2900 2801 103 100 -10 5 8 100 100 -50 5 8
Algorithm - processing
• Use a loop to read each line of data from List.dat until end-of-file is reached
• On each pass of the loop implement an array of list-size (1st number on the line) to hold the list of numbers read (from the rest of the line)
• Invoke a recursive method (or a surrogate/helper method that invokes a recursive method— more on this below) that returns the largest contiguous sum for this list
• Display the sum and the list (as above) • Do not use any "global" variables in your code (your methods should use only parameters or local variables, no static variables that recursive methods would refer to, as they would not be instantiated)
Input File Include a file of test data in your src folder. The contents of your file will be replaced with my test data. Recall you can access this file in your program with this code:
Scanner fileScan = new Scanner (new File("src\\List.dat"));
You can recall in CSC 135 we read from a file that contained URLs.
Using Recursion Your main method should call this helper method, which returns the maximum contiguous sum on the list aList:
//This method returns the maximum contiguous sum public static int maxSum(int[] aList)
but in order to use recursion we need more parameters, so the method above maxSum will simply serve as a surrogate which calls another method, the recursive method, which does all the work:
//This method returns the maximum contiguous sum from a list stored in an //array which begins at cell "start" and ends at cell "end" public static int maxContigSum (int[] aList, int start, int end)
Using the approach for developing a recursive solution:
• Base case: a list with 1 item. What will the maximum sum be? • Assume we can determine the maximum sum for a list of contiguous items in a shorter list. (Looking ahead: the shorter list that we'll use in the next step, the general case, will be the list beginning at cell "start+1" and ending at cell "end (you could also do "start" till "end-1"). We'll remember that sum as it will be a candidate for the maximum sum that our method should return. • General case: From our assumption we know what the maximum contiguous sum is for all cells excluding the first cell, so now we need to consider any sum, which contains the first cell. So now compute (use a loop, not recursion here) all possible sums from your list that include the first cell. As you compute these sums compare them to your maximum sum so far (which initially will be what was returned by your assumption above)
In: Computer Science
As you might imagine the ABC Tank Manufacturing Company uses an activity-based costing system. ABC has given you the following data that is used in its activity-based costing system: Overhead Costs Wages and salaries $ 348,000 Other overhead costs 193,000 Total overhead costs $ 541,000 Activity Cost Pool Activity Measure Total Activity Direct labor support Number of direct labor-hours 10,500 DLHs Order processing Number of orders 480 orders Customer support Number of customers 105 customers Other This is an organization-sustaining activity Not applicable Distribution of Resource Consumption Across Activities Direct Labor Support Order Processing Customer Support Other Total Wages and salaries 10 % 25 % 20 % 45 % 100 % Other overhead costs 25 % 20 % 20 % 35 % 100 % Early in this year, ABC Tank completed an order for a special vertical envelopment tank for a new customer, Sky Tanks. This was the only order from this customer for the whole year. Below is some data concerning that order: Data Concerning the Sky Tank Order Selling price $ 270 per unit Units ordered 100 units Direct materials $ 258 per unit Direct labor-hours 0.9 DLH per unit Direct labor rate $ 22 per DLH Required: 1. Prepare a report showing the first-stage allocations of overhead costs to the activity cost pools. 2. Compute the activity rates for the activity cost pools. (Round your answers to 2 decimal places.) 3. Compute the overhead costs for the order from Sky Tank, including customer support costs. (Round your intermediate calculations and final answers to 2 decimal places.)
In: Accounting
| As you might imagine the ABC Tank Manufacturing Company uses an activity-based costing system. ABC has given you the following data that is used in its activity-based costing system: |
| Overhead Costs | |||
| Wages and salaries | $ | 347,000 | |
| Other overhead costs | 197,000 | ||
| Total overhead costs | $ | 544,000 | |
| Activity Cost Pool | Activity Measure | Total Activity | |
| Direct labor support | Number of direct labor-hours | 14,000 | DLHs |
| Order processing | Number of orders | 480 | orders |
| Customer support | Number of customers | 105 | customers |
| Other | This is an organization-sustaining activity | Not applicable | |
|
Distribution of Resource Consumption Across Activities |
||||||||||
| Direct Labor Support | Order Processing | Customer Support | Other | Total | ||||||
| Wages and salaries | 10 | % | 30 | % | 15 | % | 45 | % | 100 | % |
| Other overhead costs | 25 | % | 10 | % | 20 | % | 45 | % | 100 | % |
|
Early in this year, ABC Tank completed an order for a special vertical envelopment tank for a new customer, Sky Tanks. This was the only order from this customer for the whole year. Below is some data concerning that order: |
| Data Concerning the Sky Tank Order | |||
| Selling price | $ | 290 | per unit |
| Units ordered | 100 | units | |
| Direct materials | $ | 267 | per unit |
| Direct labor-hours | 0.6 | DLH per unit | |
| Direct labor rate | $ | 21 | per DLH |
| Required: | |
| 1. |
Prepare a report showing the first-stage allocations of overhead costs to the activity cost pools. |
|
2. |
Compute the activity rates for the activity cost pools. (Round your answers to 2 decimal places.) |
| 3. |
Compute the overhead costs for the order from Sky Tank, including customer support costs. (Round your intermediate calculations and final answers to 2 decimal places.) |
| 4. |
Prepare a report showing the customer margin for Sky Tank. |
In: Accounting
There are two extremes when it comes to the power of providers to set prices. The first one is the provider has no power and must accept the reimbursement rate set by others. The second one is the provider sets the price and the third-party payers must accept them. Neither sounds like a win-win for all parties involved. We will explore these strategies in this week’s discussion question.
You are the Business Manager for Dr. Jones' medical practice. He is hoping to open in a few months but first wants to determine his prices. He has asked you to recommend if he should set his own prices or accept those from third-party payers. After researching both options, provide a memorandum with your recommendation. In your memo, be sure to first provide a brief discussion of what it means to be price-setter or price-taker. List the pros and cons of each one. Be sure to comment on the strategies that would be used in both scenarios. Finally, end the memo with your recommendation.
Instructions:
In: Operations Management
Chastain Corporation produces three products, with costs and selling prices as follows:
|
Product A |
Product B |
Product C |
|||||||||||||||||
|
Selling price per unit |
$ |
30 |
100 |
% |
$ |
20 |
100 |
% |
$ |
15 |
100 |
% |
|||||||
|
Variable costs per unit |
18 |
60 |
% |
15 |
75 |
% |
6 |
40 |
% |
||||||||||
|
Contribution margin per unit |
$ |
12 |
40 |
% |
$ |
5 |
25 |
% |
$ |
9 |
60 |
% |
|||||||
A particular machine is the bottleneck. On that machine, 3 machine hours are required to produce each unit of Product A, 1 hour is required to produce each unit of Product B, and 2 hours are required to produce each unit of Product C.
Required:
In: Accounting
C++ language code plzzzzz
As we know, here're bills with values: 1, 5, 10, 20, 50, 100. Now, suppose you have enough amount for each kind of bill, when given a price, decide how many bills of each kind you should pay so that the total number of bills is minimized. Output the number of each bill you need to pay in the order 1, 5, 10, 20, 50, 100.
SAMPLE INPUT
77
SAMPLE OUTPUT
2 1 0 1 1 0
---> since two for 1 bill 1 for 5bill 0 for 10 bill 1for 20 bill 1 for 50bill 0 for 100bill(2*1 + 1*5 +0*10 +1*20 + 1*50 + 0*100)
In: Computer Science
Please answer the following questions:
1) List the five characteristics of pure monopoly.
2) Describe the demand curve facing a pure monopoly and how it differs from that facing a firm in a purely competitive market.
3) Explain why the marginal revenue is equal to the price in pure competition but not in monopoly.
4) Use the chart to solve the following:
Calculate the Marginal Cost at Q 100?
Calculate the Marginal Cost at Q 200?
Calculate the Marginal Cost at Q 300?
Calculate the Average Total Cost at Q 100?
Calculate the Average Total Cost at Q 200?
Calculate the Average Total Cost at Q 300?
|
Q |
P=D |
TC |
|
0 |
$10.00 |
$1,000 |
|
100 |
$20.00 |
$2,500 |
|
200 |
$30.00 |
$4,500 |
|
300 |
$40.00 |
$7,500 |
In: Economics
John holds 100 shares of stock with a total basis of $1000. He receives a 25% stock dividend at the end of year 1.
In year two, he sales 30 of his shares when the stock price is $15.00 per share. Please calculate his gain in year two.
In: Finance
The current zero-coupon yield curve for risk-free bonds is as follows:
|
Maturity (years) |
1 |
2 |
3 |
4 |
5 |
|
YTM |
4.99% |
5.55% |
5.79% |
5.96% |
6.09% |
What is the price per $100 face value of a two-year, zero-coupon, risk-free bond?
In: Finance
Using the Black-Scholes options pricing model. Calculate the call option premium on a stock with an exercise price of $105, which expires in 90 days. The stock is currently trading for $100 and the monthly standard deviation on the stock return is 3%. The annual risk-free rate is 4% per year.
In: Finance