Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Matlab . Display the option user picked in part (d). If the user picked ENERGETIC, you should print HYPE. If the user picked TIRED, you

Matlab

. Display the option user picked in part (d). If the user picked ENERGETIC, you should print HYPE. If the user picked TIRED, you should print EXHAUSTED. You cannot use if or switch statements. Hint: Think about indexing, you should be using L1 in your answer.

g. Write a line of code that shows the variable D3 and its value, by using fprintf.

h. Write a line of code that shows the value of D2, with & without using fprintf.

i. Write a line of code using fprintf, that forms output based on user's previous inputs from parts a, b, and c: "Your favorite number is 3, and your favorite color is blue. You are feeling HYPE today."

j. Create the variable named D4 = 5+12i. Using fprintf, write a line of code that prints the following result: "The imaginary part is 12 and the real part is 5.". DO NOT hard code the 5 and 12 in the code to be displayed

image text in transcribed

Could someone do the rest from f to j ?

7. (A*.m script file is required for this question) a. Write a line of code that asks the user what their favorite number is, that only accepts numeric input, and saves the answer in variable D1. D1=input("Enter your favourite number: "); b. Write a line of code that asks the user what their favorite color is, that only accepts string input, and saves the answer in variable D2. D2=input("Enter your favourite color: ","s") c. Construct a 1x2 string matrix L1 where the string "HYPE" is the first element and the string "EXHAUSTED" is the second element. L1=["HYPE":"EXHAUSTED"] d. Using the menu command, write a line of code that asks the user (via GUI) whether they are feeling "ENERGETIC" or "TIRED", and saves the selection in variable D3. You should be using L1 in your answer. D3=menu("ARE YOU FEELING ","1.ENERGETIC","2. TIRED") e. Write a line of code that shows the variable D3 and its value, without using fprintf. disp(D3) f. Display the option user picked in part (d). If the user picked ENERGETIC", you should print HYPE". If the user picked TIRED, you should print EXHAUSTED. You cannot use if or switch statements. Hint: Think about indexing, you should be using L1 in your answer. g. Write a line of code that shows the variable D3 and its value, by using fprintf. h. Write a line of code that shows the value of D2, with & without using fprintt. Write a line of code using fprintf, that forms output based on user's previous inputs from parts a, b, and c: "Your favorite number is 3, and your favorite color is blue. You are feeling HYPE today." 7. (A*.m script file is required for this question) a. Write a line of code that asks the user what their favorite number is, that only accepts numeric input, and saves the answer in variable D1. D1=input("Enter your favourite number: "); b. Write a line of code that asks the user what their favorite color is, that only accepts string input, and saves the answer in variable D2. D2=input("Enter your favourite color: ","s") c. Construct a 1x2 string matrix L1 where the string "HYPE" is the first element and the string "EXHAUSTED" is the second element. L1=["HYPE":"EXHAUSTED"] d. Using the menu command, write a line of code that asks the user (via GUI) whether they are feeling "ENERGETIC" or "TIRED", and saves the selection in variable D3. You should be using L1 in your answer. D3=menu("ARE YOU FEELING ","1.ENERGETIC","2. TIRED") e. Write a line of code that shows the variable D3 and its value, without using fprintf. disp(D3) f. Display the option user picked in part (d). If the user picked ENERGETIC", you should print HYPE". If the user picked TIRED, you should print EXHAUSTED. You cannot use if or switch statements. Hint: Think about indexing, you should be using L1 in your answer. g. Write a line of code that shows the variable D3 and its value, by using fprintf. h. Write a line of code that shows the value of D2, with & without using fprintt. Write a line of code using fprintf, that forms output based on user's previous inputs from parts a, b, and c: "Your favorite number is 3, and your favorite color is blue. You are feeling HYPE today

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Database Design Application Development And Administration

Authors: Michael V. Mannino

4th Edition

0615231047, 978-0615231044

More Books

Students also viewed these Databases questions

Question

Find the derivative. f(x) 8 3 4 mix X O 4 x32 4 x32 3 -4x - x2

Answered: 1 week ago

Question

2. How were various roles filled?

Answered: 1 week ago