Write a Java program which reads a positive integer from the command line, then displays the sum of all even values up to and including the value provided, followed by the sum of all odd values up to and including the value provided.
Expected console output follows. Command line argument shown in red. Output was generated by multiple runs of the program to test input validation.
D:\COP2800C> java Sums 0
Value entered is 0
0 is out of range.
D:\COP2800C> java Sums -1
Value entered is -1
-1 is out of range.
D:\COP2800C> java Sums 5.5
Value entered is 5.5
5.5 is not an integer.
D:\COP2800C> java Sums hello
Value entered is hello
hello is not an integer.
D:\COP2800C> java Sums 5
Value entered is 5
The sum of the even numbers up to 5 is 6
The sum of the odd numbers up to 5 is 9
In: Computer Science
bag contains 7 red marbles, 5 white marbles, and 8 blue marbles.
You draw 5 marbles out at random, without replacement. What is the
probability that all the marbles are red?
The probability that all the marbles are red is .
What is the probability that exactly two of the marbles are
red?
What is the probability that none of the marbles are red?
In: Math
5) Name the data model that is only used to document a database design.
6) State the most important characteristics regarding the output of any relational algebra operation.
7) Name the software system that permits the data in a distributed database to be transparent to others.
8) Use two words to distinguish a file based system and a database.
In: Computer Science
With C++,
1. Assume we use two linked lists that represent Set A and Set B
respectively. Implement the
following function to calculate A = A U B. Note that a SET should
not contain duplicated
elements (e.g., integers).
void unionLL (Node * LA, Node * LB);
2. There are two linked lists, LA and LB. Their elements are both
in the non-descending order.
Implement the following function to merge LA and LB into a new
linked list, LC. Make sure that
the elements in LC are still in the non-descending order. (50
Points)
void mergeLL (Node * LA, Node * LB, Node * LC);
Example:
LA = (3, 5, 8, 11)
LB = (2, 6, 8, 9, 22, 24)
Then:
LC = (2, 3, 5, 6, 8, 8, 9, 11, 22, 24)
Additional requirements:
1. Create a main function and print out the numbers in the linked
lists before and after
executing each method above.
2. Assume Node is defined as follows:
struct Node{
int num;
Node * next;
};
Any help appreciated.
In: Computer Science
We assume that our wages will increase as we gain experience and become more valuable to our employers. Wages also increase because of inflation. By examining a sample of employees at a given point in time, we can look at part of the picture. How does length of service (LOS) relate to wages? The data here (data393.dat) is the LOS in months and wages for 60 women who work in Indiana banks. Wages are yearly total income divided by the number of weeks worked. We have multiplied wages by a constant for reasons of confidentiality.
(a) Plot wages versus LOS. Consider the relationship and whether
or not linear regression might be appropriate. (Do this on paper.
Your instructor may ask you to turn in this graph.)
(b) Find the least-squares line. Summarize the significance test
for the slope. What do you conclude?
| Wages = | + LOS |
| t = | |
| P = |
(c) State carefully what the slope tells you about the relationship
between wages and length of service.
(d) Give a 95% confidence interval for the slope.
( , )
worker wages los size 1 65.1229 24 Large 2 46.2397 34 Small 3 48.067 130 Small 4 56.7184 43 Small 5 46.314 76 Large 6 46.2223 15 Small 7 42.1995 64 Large 8 55.7412 47 Large 9 37.4091 79 Large 10 58.5093 154 Small 11 57.3379 28 Large 12 42.8656 136 Small 13 44.8088 133 Small 14 77.4053 78 Large 15 48.8927 115 Large 16 44.2125 65 Large 17 42.0177 167 Large 18 38.2394 32 Small 19 38.7164 97 Large 20 65.581 187 Large 21 43.3897 57 Large 22 50.1634 68 Small 23 52.668 86 Large 24 59.2598 106 Small 25 79.1054 30 Large 26 40.1483 41 Small 27 56.2467 31 Small 28 62.4825 18 Large 29 48.4094 88 Large 30 70.6421 40 Large 31 69.2177 34 Small 32 60.3709 24 Large 33 71.0116 83 Large 34 38.1429 158 Small 35 51.2402 77 Large 36 44.1567 155 Large 37 73.9482 57 Large 38 41.3124 92 Small 39 52.0047 86 Large 40 88.1481 136 Small 41 37.7559 39 Small 42 67.3698 37 Small 43 47.9039 57 Large 44 44.2461 26 Small 45 59.9857 29 Large 46 38.3378 57 Small 47 57.1175 140 Large 48 59.0108 43 Large 49 38.679 102 Small 50 64.7717 24 Large 51 47.1089 66 Large 52 38.9647 58 Large 53 46.6017 22 Large 54 62.8626 93 Small 55 44.1369 19 Small 56 44.0579 68 Large 57 39.4452 129 Small 58 47.3022 96 Large 59 50.5616 23 Small 60 64.7296 21 Large
In: Statistics and Probability
The comparative statements of financial position for 2023 and 2022 and the statement of profit or loss for 2023 are given below for Dux Company. Additional information from Dux's accounting records is also provided.
| DUX COMPANY Comparative Statements of Financial Position December 31, 2023 and 2022 ($ in 000s) |
||||||||
| 2023 | 2022 | |||||||
| Assets | ||||||||
| Cash | $ | 33 | $ | 20 | ||||
| Accounts receivable | 48 | 50 | ||||||
| Less: Allowance for uncollectible accounts | (4 | ) | (3 | ) | ||||
| Dividends receivable | 3 | 2 | ||||||
| Inventory | 55 | 50 | ||||||
| Long-term investment | 15 | 10 | ||||||
| Land | 70 | 40 | ||||||
| Buildings and equipment | 225 | 250 | ||||||
| Less: Accumulated depreciation | (25 | ) | (50 | ) | ||||
| $ | 420 | $ | 369 | |||||
| Liabilities | ||||||||
| Accounts payable | $ | 13 | $ | 20 | ||||
| Salaries payable | 2 | 5 | ||||||
| Interest payable | 4 | 2 | ||||||
| Income tax payable | 7 | 8 | ||||||
| Notes payable | 30 | 0 | ||||||
| Bonds payable | 95 | 70 | ||||||
| Less: Discount on bonds | (2 | ) | (3 | ) | ||||
| Shareholders' Equity | ||||||||
| Ordinary shares | 210 | 200 | ||||||
| Share premium | 24 | 20 | ||||||
| Retained earnings | 45 | 47 | ||||||
| Less: Treasury shares | (8 | ) | 0 | |||||
| $ | 420 | $ | 369 | |||||
| DUX COMPANY Statement of Profit or Loss For the Year Ended December 31, 2023 ($ in 000s) |
||||||
| Revenues | ||||||
| Sales revenue | $ | 200 | ||||
| Dividend revenue | 3 | $ | 203 | |||
| Expenses | ||||||
| Cost of goods sold | 120 | |||||
| Salaries expense | 25 | |||||
| Depreciation expense | 5 | |||||
| Bad debt expense | 1 | |||||
| Interest expense | 8 | |||||
| Loss on sale of building | 3 | |||||
| Income tax expense | 16 | 178 | ||||
| Net profit | $ | 25 | ||||
Additional information from the accounting records:
Required:
Prepare the statement of cash flows for Dux Company using the
indirect method, assuming Dux classifies dividend revenue
and interest paid as operating activities and dividends paid as a
financing activity. (Do not round intermediate
calculations. Amounts to be deducted should be indicated with a
minus sign. Enter your answers in thousands. (i.e., 10,000 should
be entered as 10).)
In: Accounting
7. A certain sports car model has a 0.07 probability of defective steering and a 0.11 probability of defective brakes. Erich S -E just purchased one of the models. If the two problems are statistically independent, determine the probability
a. Erich’s car has both defective steering and defective brakes.
b. Erich’s car has neither defective steering nor defective brakes.
c. Erich’s car has either defective steering only or defective brakes only (meaning exactly one of the two, but not both, defects).
In: Math
A beaker with 130 mL of an acetic acid buffer with a pH of 5.00 is sitting on a benchtop. The total molarity of acid and conjugate base in this buffer is 0.100 M. A student adds 6.20 mL of a 0.490 M HCl solution to the beaker. How much will the pH change? The pKa of acetic acid is 4.760.
Express answer numerically to two decimal places. Use a minus (-) sign if the pH has decreased.
In: Chemistry
Given the year end prices of the following stocks, estimate the expected return of a portfolio of 30% AAA and 70% BBB. Enter your answer as a percent without the % sign. Round your final answer to two decimals.
| Year | AAA | BBB |
|---|---|---|
| 2006 | 100 | 55 |
| 2007 | 105 | 65 |
| 2008 | 120 | 60 |
| 2009 | 110 | 70 |
| 2010 | 130 | 65 |
| 2011 | 160 | 80 |
In: Finance
Jeff and Sylvia Chan are now both 71 years of age and they have been retired for seven years. They have managed to remain debt free since their retirement seven years ago and their cash flow is now positive. Sylvia received a $1,000,000 inheritance shortly after their planned retirement and the funds were used exclusively to fund their retirement over the last six years. There is still $500,000 left from this amount and it is currently sitting in her bank account earning very little interest. Sylvia would like some recommendations on how to invest these funds. Her objective is to generate a 6% return on investments that are moderate risk and can provide a tax credit. She understands that 4% of this income will relate to dividend yield and 2% to deferred capital gains. Their RRSPs continued to grow since Jeff and Sylvia were age 65 and they have not taken any withdrawals. The plans were worth $600,000 and $700,000 respectively.
Since they are 71 years of age and must start withdrawing their RRSP funds as per the maturity rules they will be taking the minimum amount from their RRIF staring at age 72. In addition to this income they will have maximum CPP and maximum OAS, the amounts of which increased since they have deferred withdrawal. They also want to leave a significant estate for their two children. The current market value of the principal residence is $1,200,000. Jeff also has an investment property that transferred over to him at a fair market value of $400,000 when his dad died five years ago. The property is current valued at $500,000 and he expects that both the investment property and the principal residence will increase in value at 7% per year. The investment property generates $12,000 of additional rental income per year before deductions for property taxes which are $3,000, and property insurance of $1,200 per year. There is no mortgage on either property.
Their primary residence is held in joint tenancy and they have designated each other as beneficiary on their RRIF accounts. The inheritance account will be held solely in Sylvia’s name and the investment property solely in Jeff’s name.
REQUIRED –
How would you recommend Sylvia invest her remaining $500,000 inheritance given her objective for income with moderate risk and tax credits? (2) Recommend at least two different mutual funds and provide details on the mutual fund’s investment objective, performance, management fees and volatility.
In: Finance