Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Question 1 (75 Points) Write a script that prompts the user to answer the question, On what day of the week were you born and

image text in transcribed

Question 1 (75 Points) Write a script that prompts the user to answer the question, On what day of the week were you born and in what year? Format example: "Wednesday 1992". 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, 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 o The last four characters cannot be letters or blank spaces. o A blank space must immediately precede the last four characters. o All other characters must be letters. Otherwise, use fprintf to tell the user what age they will turn this year Write the script using a single if statement (else and elseif clauses are permitted) Note: For publishing purposes, comment out the "input" line and manually assign the value for givena

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

Probabilistic Databases

Authors: Dan Suciu, Dan Olteanu, Christopher Re, Christoph Koch

1st Edition

3031007514, 978-3031007514

More Books

Students also viewed these Databases questions

Question

Explain the strategies for overcoming territorial behavior.

Answered: 1 week ago