Write the code to return the output in Rstudio. What is the code?
Code: x <- c(28, 69, 5, 88, 19, 20)
Output must be:
[1] 4 2 1 6 5 3
In: Computer Science
Solve the following equations in non-negative integers.
1. x2 - y2 = 221
2. a + b = ab
3. gcd(a,b)lcm(a,b) = b + 9
4. x4 + 2x3 - y2(1+2x) + x2(1-y2) = 2299
In: Advanced Math
Solve with Laplace transform
1. y''+ 4 t y'− 4y = 0, y(0) = 0, y'(0) = −7
2. (1− t) y''+ t y' − y = 0, y(0) = 3, y'(0) = −1
In: Advanced Math
|
interest rate |
1% |
2% |
3% |
And that the FRA (1 year, starting two year from now) is 4%
In: Finance
2. On January 1, 2020, Firm Lessor leased a building to Firm Lessee. The relevant information related to the lease is as follows.
1) The lease arrangement is for 2 years.
2) Equal rental payments are due on January 1 of each year, beginning in 2020.
3) The building’s fair value at commencement of the lease is $100,000. The building is depreciated on a straight-line basis. Its estimated economic life is 4 years with salvage value of $25,000 at the end of the lease and $0 at the end of the economic life.
4) The lease contains no renewal options. The building reverts to Firm Lessor at the termination of the lease.
5) Both firms use the discount factor of 10%. 6) Both the lessor and the lessee are on a calendar-year basis.
(a) Discuss whether this is an operating lease.
(b) Prepare the journal entries that Firm Lessee should make in 2020
For the dates 1/1/2020, 1/1/2020, 1/1/2021 & Include Lease Payment, Interest, Reduction of Lease Liability, Lease Liability
(c) Prepare the journal entries that Firm Lessor should make in 2020.
In: Accounting
This C++ program is to validate the ISBN number and
output "Valid" if the number is valid, and "Invalid"
otherwise.
The ISBN number for a book is a 10-digit number made up of 4
sections separated by '-'. In the ISBN
number 1-214-02031-3:
1 represents a country (must be 1 digit)
214 represents the publisher (must be 3 digits)
02031 represents the book number (must be 5 digits)
3 is the checksum (must be 1 digit or the letter 'x').
The checksum is a digit to see if the ISBN number is a valid
number. If the checksum is 'x', then that
represents the digit 10.
A weight is associated with each digit:
10 with the first digit (1 in the example)
9 with the second digit (2 in the example)
8 with the 3rd digit (1 in the example)
7 with the 4th digit (4 in the example)
6 with the 5th digit (0 in the example)
5 with the 6th digit (2 in the example)
4 with the 7th digit (0 in the example)
3 with the 8th digit (3 in the example)
2 with the 9th digit (1 in the example)
1 with the 10th digit (3 in the example)
To check to see if an ISBN number is valid, you multiply the digit
by its weight and add the resulting
products. If the sum is evenly divisible by 11, then it is a valid
ISBN number.
In the example: 1-214-02031-3
1*10+2*9+1*8+4*7+0*6+2*5+0*4+3*3+1*2+3*1 = 88
Since 88 is evenly divisible by 11, the above number is a valid
ISBN number.
The main function will create an array of pointers of type char
to store all the ISBN numbers I'll give
you in a separate text file for the convenience of copying. The
main should iterate over that array and for
each ISBN number call the function checkDigits which will return
true is there are digits and a correct
number of digits in each section, and if each section is separated
by a '-'. Otherwise, it will return false.
If checkDigits returns true, the main will call checkSum, which
will return true if the sum of the
products of the weights and digits is divisible by 11. Otherwise,
it returns false. The main program will
output "valid" or "not valid" for each ISBN number.
In this program, do not use subscripted variables. Use
the pointers to the characters. The declaration for
the checkSum would be:
bool checkSum(char *);
Note that functions take a single pointer as a parameter, not a
char ** (i.e. array of pointers).
Note, that *(ptrISBN + 3) is the same as ptrISBN[3]
To check to see if there is an '-' in the i-th position you can use
the statement:
if(*(ptrISBN + i) == '-')
Your program should not be like that:
if(ISBN[0] == '-' || ISBN[1] == '-' || ISBN[2] == '-' ….. ||
ISBN[10] == '-')
To check for each element in the array.
I want you to use the loop and iterate over the arrays using the
loop.
However, if you need to check just a couple (maybe three, max),
that is OK.
Should use:
2 functions with using const arguments
Using enum valid, invalid in place of bool
Do not use:
Declaring array according to standards
off-by-one errors
Using global variables
Run the program with the data from the data file
“test_data.txt”
Note, I want you to hard code the array of pointers. I don't want
you to read the data from the file on
the fly.
------------------------------------------------------------------------------------------------------------------------------------------------------------
Expected output would be similar to the following:
Input ISBN numbers:
(input number from given .txt file)
Array filled! //use a loop to get input from the user
Checking ISBN numbers...
//(for ISBN #'s return False/Invalid)
Invalid ISBN #
//(for ISBN #'s return True/Valid)
Checking sum of Valid ISBN numbers
Valid/Invalid ISBN # : (return sum of ISBN number)
------------------------------------------------------------------------------------------------------------------------------------------------------------
Given text file: Note, I want you to hard code the array
of pointers. I don't want you to read the data from the file
on
the fly. IF applicable/possible try to make another function to
show the difference.
1-214-02031-3
0-070-21604-5
2-14-241242-4
2-120-12311-x
0-534-95207-x
2-034-00312-2
1-013-10201-2
2-142-1223
3-001-0000a-4
done
In: Computer Science
2. A solid insulating sphere with a radius ? = 12 ?? has a volume charge density which varies with radial distance ? as given by ? = 4 × 103 ?0 (1 + ? ? ) ?/?3 . Calculate the electric field magnitude at ? = 2? by using Gauss’s Law. (?0 = 8.85 × 10−12 ? 2/??2 )
In: Physics
Sleep deprivation, CA vs. OR. For a recent report on sleep deprivation, the Centers for Disease Control and Prevention interviewed 11575 residents of California and 4783 residents of Oregon. In California, 903 respondents reported getting insufficient rest or sleep during each of the preceding 30 days, while 421 of the respondents from Oregon reported the same. Round each calculation to 4 decimal places.
1. Using California as population 1 and Oregon as population 2,
what are the correct hypotheses for conducting a hypothesis test to
determine if these data provide strong evidence the rate of sleep
deprivation is different for the two states?
A. ?0:?1−?2=0H0:p1−p2=0,
??:?1−?2≠0HA:p1−p2≠0
B. ?0:?1−?2=0H0:p1−p2=0,
??:?1−?2>0HA:p1−p2>0
C. ?0:?1−?2=0H0:p1−p2=0,
??:?1−?2<0HA:p1−p2<0
2. Calculate the pooled estimate of the proportion for this test. ?̂p^ =
3. Calculate the standard error. SE =
4. Calculate the test statistic for this hypothesis test. ? z t X^2 F =
5. Calculate the p-value for this hypothesis test. p-value =
6. Based on the p-value, we have:
A. very strong evidence
B. strong evidence
C. extremely strong evidence
D. little evidence
E. some evidence
that the null model is not a good fit for our observed data.
In: Statistics and Probability
Sample Code and Models
Run each of the models below and explain the code function and your findings for each system, do they agree/disagree with what you understand and why ??
Matlab Code
% Winter 2018 Control Engineering
% Lab No.3 - Root Locus problems
% Mark Clarke
clear
s = tf('s')
K = 1150; %Proportional Controller Gain, May need to be altered?
% Enter Model 1
% This is a model of a simple 2nd order with no zeros
g1 = 1/((s+2)*(s+4));
h1 = feedback(K*g1,1);
figure(1)
rlocus(g1) % Plot the root locus of system g1
figure(2)
step (h1,5)% plot the step response of system h1
% Enter Model 2
% This is a model of a simple 2nd order with one zeros
g2 = (s+3)/((s+2)*(s+4));
h2 = feedback(K*g2,1);
figure(1)
rlocus(g2) % Plot the root locus of system g2
figure(2)
step (h2,5)% plot the step response of system h2
% Enter Model 3
g3 = 1/((s*(s^2 + 15*s + 60)));
h3 = feedback(K*g3,1);
g4 = 1/((s+1)*(s^2 + 15*s + 60));
h4 = feedback(K*g4,1);
figure(1)
rlocus(g3) % run the root locus on the g3 an g4 above
figure(2)
step(h3,10) % run the step response on the h3 an h4 above
PART 2 Findings and Conclusion
In: Electrical Engineering
Drs. Glenn Feltham and David Ambrose began operations of their physical therapy clinic, called Northland Physical Therapy, on January 1, 2017. The annual reporting period ends December 31. The trial balance on January 1, 2018, was as follows (the amounts are rounded to thousands of dollars to simplify):
| Account Titles | Debit | Credit | ||||
| Cash | $ | 8 | ||||
| Accounts Receivable | 4 | |||||
| Supplies | 4 | |||||
| Equipment | 8 | |||||
| Accumulated Depreciation | $ | 1 | ||||
| Software | 4 | |||||
| Accumulated Amortization | 1 | |||||
| Accounts Payable | 4 | |||||
| Notes Payable (short-term) | 0 | |||||
| Salaries and Wages Payable | 0 | |||||
| Interest Payable | 0 | |||||
| Income Taxes Payable | 0 | |||||
| Deferred Revenue | 0 | |||||
| Common Stock | 14 | |||||
| Retained Earnings | 8 | |||||
| Service Revenue | 0 | |||||
| Depreciation Expense | 0 | |||||
| Amortization Expense | 0 | |||||
| Salaries and Wages Expense | 0 | |||||
| Supplies Expense | 0 | |||||
| Interest Expense | 0 | |||||
| Income Tax Expense | 0 | |||||
| Totals | $ | 28 | $ | 28 | ||
Transactions during 2018 (summarized in thousands of dollars) follow:
Data for adjusting journal entries on December 31:
6-a. Prepare an income statement.
6-b. Prepare the statement of retained earnings.
6-c. Prepare the balance sheet.
In: Accounting