Matlab
A really nice Math Professor gives out large sums of cash for correct answers in class. Each student gets $1000 for each of their first three correct answers (paid by the Professor to the student), each student then gets $500 for each of their next 24 correct answers, while for every subsequent correct answer they make, the student has to pay the Professor $5, as a fine for talking too much. (Note: this is a fake scenario, set in a world of high fantasy, with hobbits and elves. It’s not real life. I don’t have pointy ears.)
(First 3 correct answers get $1000 EACH.
The next 24 correct answers get $500 EACH.
The next correct answer (i.e., your 28th correct answer) costs you
$5 (but you get to keep all the money you earned from your previous
27 correct answers). All your next correct answers (i.e., your
29th, 30th, etc) all cost you $5 each.)
(a) Write a Matlab function file that inputs the number of correct answers, and outputs the amount of money the student receives (or pays).
(b) How many correct answers from any individual student does it take before the Math Professor starts to make a profit from that student?
Code:
function f = Correct(n)
% Initialize variables
pay=0;
total=n;
% First three questions
if n>=3
pay=3*1000;
n=n-3;
end
% Next 24 questions
if n-24>0
pay=pay+24*500;
n=n-24;
else
pay=pay+n*500;
n=n-24;
end
%Remaining questions
%Remaining questions upto start of profit
if n>0
while pay>0
if n==0
break;
end
pay=pay-5;
n=n-1;
end
end
% Remaining questions
if n>0
disp("Number of correct answer before Maths professor start to take profit")
disp(total-n)
pay=pay-(n*5);
end
if pay>0
disp('Amount of money student recieve')
disp(pay)
else
disp('Amount of money student has to pay')
disp(abs(pay))
end
end
Matlab A really nice Math Professor gives out large sums of cash for correct answers in...
Unable to correct errors from my MatLab Script and would like to see a script to compare mine to. Write a MatLab script that simulates a virus spread. This problem needs the following parts, some of which are nested loops, ie Part 3, 4 and 5 are nested in Part 2’s loop (for or while): To build the program first to only deal with infection transmission within the town’s neighbors An array which for every person in the town which...
ARE MY ANSWERS CORRECT? 25 questions 1. what an A/R aging analysis is, its purpose, and how it is created. Used to estimate amount needed in Allowance for Bad Debts Account (a contra account) A/R Days Outstanding 0-30 31-60 61-90 Over 90 Under each term list all A/Rs that are not paid by date Use historical experience to estimate the percentage of A/R for each date period to determine allowance for Bad Debts What the three major cost components are...
I
had a question about Step 5-9. I already completed the general
journal with the entries into the general ledger. Now I need help
creating the adjusted trial balance, I cant get it to equal to
$20,743. Also, I need help completing the financial statements:
income statements, statement of owners equity, and a balance sheet.
*Net Income has to equal $1024 and total assets has to equal
$18,354.
The
question is how can I balance out my adjusted trial balance...