Question

a. Write a line of code that asks the user what their favorite number is, that...

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.

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.

c. Construct a 1x2 string matrix L1 where the string “HYPE” is the first element and the string “EXHAUSTED” is the second element.

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. e. Write a line of code that shows the variable D3 and its value, without using fprintf.

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.

0 0
Add a comment Improve this question Transcribed image text
Know the answer?
Add Answer to:
a. Write a line of code that asks the user what their favorite number is, that...
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
  • 1. Write a code snippet Write a code snippet that asks the user to enter a...

    1. Write a code snippet Write a code snippet that asks the user to enter a name and a major one at a time and creates a dictionary with keys corresponding to names and values corresponding to majors. Assume that the user enters “alice”, “bio”, “mark”, “engineering”. >>>d = {} >>> your code starts here 2.Based on your code above: >>> print(d) 3.Write a code snippet Write a code snippet that creates a dictionary (records) using keys from a frozenset...

  • 21 Write a program that asks the user to input the length and breadth of a...

    21 Write a program that asks the user to input the length and breadth of a soccer field, and then computes and returns the number of square meters of grass required to cover the field The formula for the area is the product of length and breadth (5) 22 The following program uses the break statement to terminate an infinite while loop to print 5 numbers Rewrite the program to use a while loop to display numbers from 1 to...

  • C++ not C please Lyric Search Write a program that asks the user for a file...

    C++ not C please Lyric Search Write a program that asks the user for a file name and a string to search for. The program should search the file for every occurrance of the string. When the string is found it should display the line that it iwas found on and report the total number of occurrances of the string at the end. Place a text file with your favorite song lyrics in it and use to to perform a...

  • Write a C Program that asks the user to input a string and then the user...

    Write a C Program that asks the user to input a string and then the user is prompted back whether the input string is a “Palindrome Word” or not. (A Palindrome Word reads the same backward or forward, eg. madam, racecar, etc.) Your program should contain a function that accepts the input string from the main function and returns a value indicating whether the input string is a Palindrome or not. Use Pointers to traverse the string.

  • Write a Python code that asks a string from the user and prints only the lower...

    Write a Python code that asks a string from the user and prints only the lower case letters in that string

  • Python Write a program that asks the user for a zip code and converts it to...

    Python Write a program that asks the user for a zip code and converts it to a postal bar code. A postal bar code uses two types of lines long and short. Since we can't print "long line” we will use: 0 - short line 1 - long line. The digits are represented by bars as explained in the below chart Value Encoding 1 00011 2 00101 00110 01001 01010 01100 10001 8 10010 9 10100 0 11000 The bar...

  • Write a Java program that: • Asks the user to enter the number of integers that...

    Write a Java program that: • Asks the user to enter the number of integers that he need to enter; • Asked him to enter integer by integer; • Print The number of Odd numbers entered and the number of Even numbers entered. Important notes: 1. You should have to copy and paste the Java as your answer for this question. DON’T take screen shot for your Java Code. It must be editable. 2. Take a screen shot for your...

  • Python Write a program which asks the user keep inputting values on a line followed by...

    Python Write a program which asks the user keep inputting values on a line followed by enter until they enter a blank line, at which point the program should print the number of lines entered (excluding the blank).

  • Write a javascript that asks the user to input a number. The number is then passed into a functio...

    Im lost I need help seriously Write a javascript that asks the user to input a number. The number is then passed into a function you write that contains a loop. The loop will loop the number you passed into the function and print out the word "CSU" that many times. For instance, if l entered 3, the function would print out "CSU CSU CSU". (20 points) 5. Write a javascript that asks the user to input a number. The...

  • 17. Write a simple HTML form that ask user for name and multiple options favorite fruits....

    17. Write a simple HTML form that ask user for name and multiple options favorite fruits. The form should be submitted to process_data.inc.php in folder includes using POST method. Hint: use <select multiple=”multiple"> tags. (5pts) Name: What are your favorite fruits? Apple Orange Banana Send Details 18. From above question, in file process_data.inc.php, write PHP code to print out what the user submitted in the following format. Assume that the form is filled. (10pts) Hi, my name is: Adam I...

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
ADVERTISEMENT