Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Write a script that prompts the user to enter the radius of a circle with units. For example, the user might enter 3.45 cm or

image text in transcribed

Write a script that prompts the user to enter the radius of a circle with units. For example, the user might enter "3.45 cm" or "5 inches". The user's input is read into a character variable called givena. Check that the user entered a valid answer .If the user didn't enter anything or their answer was not long enough (their answer should be at least three characters), print an error message telling them they did not answer the question. . If the user's answer was not formatted correctly, send an error message telling them their input was invalid. The following conditions must be met to ensure the correct format . There must be one, and only one. blank space in givena. . No characters before the blank space may be a letter . All characters after the blank space must be letters. . Otherwise, use fprintf to print a descriptive message stating the radius of the circle with units, as specified by the user Write the script using a single if statement else and elseif clauses are permitted). 30 Points Question Bonus: If the user ntered a valid radius format, then also print e area of the circle, to two decimal places ith units, to the Command Windovw Write a script that prompts the user to enter the radius of a circle with units. For example, the user might enter "3.45 cm" or "5 inches". The user's input is read into a character variable called givena. Check that the user entered a valid answer .If the user didn't enter anything or their answer was not long enough (their answer should be at least three characters), print an error message telling them they did not answer the question. . If the user's answer was not formatted correctly, send an error message telling them their input was invalid. The following conditions must be met to ensure the correct format . There must be one, and only one. blank space in givena. . No characters before the blank space may be a letter . All characters after the blank space must be letters. . Otherwise, use fprintf to print a descriptive message stating the radius of the circle with units, as specified by the user Write the script using a single if statement else and elseif clauses are permitted). 30 Points Question Bonus: If the user ntered a valid radius format, then also print e area of the circle, to two decimal places ith units, to the Command Windovw

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

Students also viewed these Databases questions