Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

5. Write a line of code that asks the user the meaning of life, only accepts numeric input, and saves the answer in variable D1.

image text in transcribed
5. Write a line of code that asks the user the meaning of life, only accepts numeric input, and saves the answer in variable D1. Write a line of code that asks the user how the weather is like that day, only accepts string input, and saves the answer in variable D2. Using the menu command, write a line of code that asks the user (via GUI) whether they are hearing "Yanny" or "Laurel", and saves the selection in variable D3. Write a line of code that shows the variable D3 and its value, without using fprintf. Write a line of code that shows the value of D2, without using fprintf. Write a line of code using fprintf, that forms output based on user's previous inputs from parts a and b of question 4: "It was a rainy evening when I heard that the Answer to the Ultimate Question of Life, The Universe, and Everything turned out to be 42." 12 inches is 1 foot. Convert 340 inches to feet by calculation, print the result using fprintf. Use eight characters in the output, six of them should be after the decimal mark. a. b. c. d. e. f. g. 100 centimeters is 1 meter. Convert 505 centimeters to meters by calculation, print the result using fprintf. Use three characters in the output, two of them should be after the decimal mark. h. i. 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

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

More Books

Students also viewed these Databases questions

Question

3. Would you say that effective teamwork saved their lives?

Answered: 1 week ago