java code
Question 4:
Iterating with loops
You can process the list using a For loop. The variable in the For loop becomes the index value for each of the items in the loop. Everything you do to an element inside the loop gets done for the entire list. Examine the following loops. Then use what you know to write the following loops.
int[] numbers = new int[100];
for(int i = 0; i < numbers.length; i++){
numbers[i] = i;
}
int sum = 0;
for(int i = 0; i < numbers.length; i++){
sum += numbers[i];
}
Write a loop to display all the numbers in the list.
Write a loop to display the number in the list in reverse order.
Write a loop with an if statement to print only the even numbers in the list.
Write a loop to subtract the value 50 to every element in the list.
Write a loop to count the number of negative values in the list.
In: Computer Science
RACKET
a) Write a recursive function (gen-list start end). This function will generate a list of consecutive integers, from start to end. If start > end then an empty list is generated. For example: (gen-list 1 5) ---> (1 2 3 4 5)
b) write a recursive function pair-sum? that takes an integer sequence as generated by the gen-list function in exercise 4 above. This function tests whether any two adjacent values in the given list sum to the given val. For example,
(pair-sum? '(1 2 3) 3) ---> #t since 1+2=3. Similarly,
(pair-sum? (gen-list 1 100) 1000) ---> #f since no two adjacent integers in the range 1 to 100 can sum to 1000.
You must use recursion, and not iteration. Please include explanation thanks.
In: Computer Science
[ RACKET]
a) Write a recursive function (gen-list start end). This function will generate a list of consecutive integers, from start to end. If start > end then an empty list is generated.
For example: (gen-list 1 5) ---> (1 2 3 4 5)
b) write a recursive function pair-sum? that takes an integer sequence as generated by the gen-list function in exercise 4 above. This function tests whether any two adjacent values in the given list sum to the given val.
For example,
(pair-sum? '(1 2 3) 3) ---> #t since 1+2=3. Similarly,
(pair-sum? (gen-list 1 100) 1000) ---> #f since no two adjacent integers in the range 1 to 100 can sum to 1000.
You must use recursion, and not iteration. Please include explanation thanks.
In: Computer Science
Laboratory Tasks
public class LinkedList {
Node head;
class Node {
int data;
Node next;
Node(int d) {
data = d;
next = null;
}
}
}
Complete the above java program by adding the following methods:
Part1:
In: Computer Science
A firm producing computers considers a new investment which is about opening a new plant.
The project’s lifetime is estimated as 5 years and requires 22 million $ as investment cost. Salvage value of the project is estimated as 4 million $ (which will be received in the sixth year) However the firm prefers to show salvage value only as 2 million $. The firm uses 5-year straight-line depreciation.
It is estimated that the sales will be 12 million $ next year and then sales will grow by 20% each year.
It is estimated that fixed costs will be 1.5 million next year and then will grow by 5% each year.
Variable costs are projected %10 of sales each year.
This project, in addition, requires a working capital of $ 3 million in the first year, 4 million in the second year, 4 million in the third year, 3 million in the fourth year and 1.5 million in the fifth year.
Firm plans to use a debt/equity ratio of %50 in this project.
The company can borrow $ loan with an interest cost of 14% before tax. Corporate tax rate is 20%. The shares of this company in NYSE are selling at 8 $ and the stocks have approximately market risk and have a strong correlation with NYSE index. 10- year government bond yields at %12 and market risk premium is %8.
Given this information; find the NPV and IRR of the project; is this project feasible or not?
What is the result of higher WACC ? Can a company reduce its WACC ? If yes, how? Give numerical example related with this project and explain this topic briefly regarding to the capital structure theories.
Please solve this CLEARLY
Andrew Jim Moore. UC Berkeley.
In: Finance
Only need answers for e,f,g,h,i
Jacob has the utility function for goods x and y asu(x, y) = ?2/3?2/3.
The price of good x is $2 each, and the price of good y is $5 each. Jacob has a total income of $120 to spend on these two goods.
(a) Write down Jacob's budget line, and show in the graph.
(b) Write down the budget exhaustion condition (BC) of Jacob’s
optimization problem.(c) Write down the rationality condition (RC)
of Mr. Jacob’s optimization problem.
(d) Given the two conditions from (b) and (c), calculate the optimal bundle (x*, y*) that he will choose in order to maximize his utility, and (approximately) indicate this optimal bundle in the graph.
Now, the price of good x increases to $4 each, and everything else remains the same.
(e) Given the change in the price of good x, calculate the new optimal bundle (x**, y**).
(f) How much additional income does Jacob need in order to consume at the original optimal bundle as in (d)?
(g) Suppose Jacob is a cardholder of a credit card, where the credit card company decides to compensate its members, so all of its members are able to maintain their utility level as the same as before the price changed. Write down the utilization condition (UC) of Jacob’soptimization problem after price changed.
(h) Given the condition in (g), calculate Jacob’s new optimal bundle (xc, yc) under the compensation.
(i) What is the amount that the credit card company needs to compensate Jacob? Compare the result with (f).
In: Economics
You would like to implement a list where you put in operations at any position to the list occur frequently. Would you use an array-based list? Explain why or why not?
In: Computer Science
Question: Write an implementation of the ADT sorted list that uses a resizable array (vector class of C++ STL) to represent the list items. Anytime the list becomes full, double the size of the array.
In: Computer Science
In python Consider the tuple t = (2,3,4,5). Write a function tuList( t ) that takes in a tuple, makes a list out of it, and also creates a new list of all possible sums of elements of the list
In: Computer Science
1. Start a new Visual Studio project and name it GradeApp
a. Make sure your project is a web project
b. Make sure it is using C#
2. Add a new folder and name it Grades_Logic
3. Inside this new folder create a new web form called “Grades”
4. Add a label to hold text “Enter Grade”
5. Add a text field in front of the label to receive the grade
6. Add another label in a new line to display the text “Participation”
7. Place a drop-down list in front of this label containing the following:
a. Excellent Participant
b. Very Good participant
c. Good participant
d. Fair participant
e. Poor participant
f. Did not participate
8. Add a button in a new line called submit labeled “Submit Evaluation”
9. In a new line below the button add a label to display the output with no text in it
10. Create a code behind to display the final evaluation based on the score entered in the text box and the participation selected from the drop-down list.
11. Final evaluation should be “Excellent”, “Very Good”, “Good”, “Fair”, or “Poor”
12. The logic should work as the following:
a. The grade should present 90% of the total evaluation
b. The participation should be 10% of the total evaluation
i. Excellent Participant = 100% of participation weight
ii. Very Good participant = 90% of participation weight
iii. Good participant = 80% of participation weight
iv. Fair participant = 70% of participation weight
v. Poor participant = 50% of participation weight
vi. Did not participate = 0% of participation weight
13. The final evaluation will be as the following:
a. Excellent = 91% - 100% of total grade
b. Very Good = 81% - 90% of total grade
c. Good = 71% - 80% of total grade
d. Fair = 60% - 70% of total grade
e. Poor is anything below 60% of total grade
In: Computer Science