Question

Matlab A really nice Math Professor gives out large sums of cash for correct answers in...

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?

0 0
Add a comment Improve this question Transcribed image text
Answer #1

Solution: function f = Correct (n) % Initialize variables total-n; % First three questions if n>=3 pay 3*1000; n-n-3 end Next

pay-pay-5; n-n-l; end end Remaining questions if n>0 disp (Number of correct answer before Maths professor start to take pro

>x-3030 3030 >>Correct (x) Before profit number of correct answer is 3027 Amount of money student has to pay 15

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

Add a comment
Know the answer?
Add Answer to:
Matlab A really nice Math Professor gives out large sums of cash for correct answers in...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • Unable to correct errors from my MatLab Script and would like to see a script to...

    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...

  • please can you solve for all these questions but the right answers because I dont have...

    please can you solve for all these questions but the right answers because I dont have anymore remaining please a) What is the market cap? b) What are the earnings per share? (TTM after EPS stands for "trailing twelve months", i.e. their reported earnings per share for the last 12 month period) c) What is their PE ratio? Click on the "Chart" menu item. Click on the "18" option to get a chart of stock prices for the last year....

  • Needs correction to the following multiple choice questions. Please, provide the correct answers below; 32.A nurse...

    Needs correction to the following multiple choice questions. Please, provide the correct answers below; 32.A nurse is caring for a client who delivered a health term newbom via cesarean binh. "Is there a chance that I could deliver my next baby without having a cesarean section responses should the nurse provide? nealthy term newborn via cesarean birth. The client asks the nurse by without having a cesarean section?" Which of the following (A.) The primary consideration is what type of...

  • check my answers for Networking I came up with these answers, can check my answers Question...

    check my answers for Networking I came up with these answers, can check my answers Question 1: General What data rate is needed to transmit an uncompressed 4" x 6" photograph every second with a resolution of 1200 dots per inch and 24 bits per dot (pixel)? 691,200 kb/s 28.8 kb/s 8.29 Mb/s 829 Mb/s Question 2: Layering "Layering" is commonly used in computer networks because (check all that apply): -It forces all network software to be written in ‘C’....

  • help me with the requirement 7and 8 and also check if everything is correct and also...

    help me with the requirement 7and 8 and also check if everything is correct and also make sure requirement 5 is correct where I entered 1500 in the yellow box please go through to every pic and make sure everything is correct 40 points Accounting 202 - Fall 2019 Project 3 - Operating Budget Enter the last 4 digits of your student ID number: Name/s: Highest Lowest other than 0 Save this file in EXCEL FORMAT as: P3Lastname Round all...

  • Matching: Select the best answer from the vocabulary word bank. There may be extra words that...

    Matching: Select the best answer from the vocabulary word bank. There may be extra words that are not used. a. $500 / $1,000 b. Money market mutual fund c. Amoral d. First e. Positive f. Rate of return g. Sinking fund h. Negative i. Wealth building j. Murphy’s Law k. 1–2 l. 3–6 m. Last n. Insurance o. Baby Steps _____ 11. The type of account that holds your fully funded emergency fund _____ 12. The amount you put into...

  • While reading the story, consider the culture (or sub culture) and related communication styles the story...

    While reading the story, consider the culture (or sub culture) and related communication styles the story reveals. Consider too, possibly, the values, behavioral norms, social practices, social artifacts, etc. After reading the story through the lens of this idea, please compose a full academic length (evidence-based 7 to 11 sentence long) paragraph which addresses the following prompt: What does the story reveal about the culture it portrays and/OR the communication styles the culture shares? In other words, what does the...

  • ARE MY ANSWERS CORRECT? 25 questions 1. what an A/R aging analysis is, its purpose, and...

    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...

  • how the cash here become 1135? because if you check my trial balance the cash is...

    how the cash here become 1135? because if you check my trial balance the cash is 8810. and i can I get help in step 8,9? and I provide u my journal entry this is the steps 8,9 From the information given above, I have solved 5,6,7 that is Adjusting entries, Trial Balance, Income Statement, Statement of Equity changes and Balance Sheet. Der in the problem Set Depreciation expense General in From 1. Sep 131, Dec formoh T unter est...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT