I need help getting started on a problem involving a range of numbers and guessing!

1 view (last 30 days)
So I have the following question and I am slightly unfamiliar with matlab. I am a student in a class and this is one of the practice problems assigned to us by my professor. How should I get started and what commands are recommended? Also keep in mind im very new to this software so if you could supply the easiest and simplest way that would be helpful!
Thanks!
Write a function called guessMyNumber that has two input arguments: L and U that are the lower and upper end of the range of numbers that can be guessed e.g. guessMyNumber(10,120) means that the range is from 10 to 120. After each guess, the program returns a statement, which is one of ‘Out of range, try again’, ‘Guess lower’, or ‘Guess higher’, or ‘You got it!’.
Include some sample runs that show how it responds to various odd cases, e.g. L and U are the same number, or L > U, or no inputs are supplied. In other words your program should deal gracefully with these and perhaps other cases that you can think of. (

Answers (0)

Products

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!