Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

This assignment consist of writing a program that will demonstrate your ability to use selection statements (if/if-else/switch) in a C program. Your objective if to

image text in transcribed

image text in transcribed

This assignment consist of writing a program that will demonstrate your ability to use selection statements (if/if-else/switch) in a C program. Your objective if to write a program that prompts the user to enter a non-negative decimal value of less than 1000. Once a valid input is entered, your program will print the dollar and cent values of the input in words. If the entered numerical value fall outside the valid range, then your program will print an error message and successfully terminate. For this program you only need to consider two up to 2 significant digits after the decimal point. If the cent value of the input is sufficiently close to zero, then you should not mention "zero cent" in your output. For example, a decimal value of 0.0082 should print as "zero dollar" Some example runs of the program is provided in the following. The underlined texts represent user inputs. Example run: 1 Please enter the dollar amount in decimal fornat(9-999.99):62 Your entered nonetary value in words seven dollars and sixty-nine cents Example run: 2 Please enter the dollar amount in decimal fornat (-999.99): $9.12673 Your entered nonetary value in words twelve cents Example run: 3 Please enter the dollar amount in decimal fornat (8-999.99): $3.e Your entered nonetary value in words three dollars Example run: 4 Please enter the dollar amount in decimal fornat(8-999.99): $-5.12 The entered monetary value is outside the valid range. Terminatin Example run: 5 Please enter the dollar anount in decinal fornat (-999.99): $1234.12 g progran The entered monetary value is outside the valid range. Terninating progran Assumptions: The user input is assumed to be a numerical value. Therefore, you do not need to consider scenarios involving erroneous, non-numeric input

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_2

Step: 3

blur-text-image_step3

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

e. What ethnic groups were represented in the good-guy roles?

Answered: 1 week ago