Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Currency input Withe a C+t program that wit allow the user to enter a currency amount and valdate that it is in a conect format.

image text in transcribed
Currency input Withe a C+t program that wit allow the user to enter a currency amount and valdate that it is in a conect format. For purposes of this program, the comect format of curoncy is the following: 51234 The $ sign followed by an integer number \$1234 56 The 5 agn followed by a real number. If a decimal point is incuded in the number, there must be exactly 2 digits to the right of the decimal point $1.23456 There can be conmes to the hight of the decinal point, but they mut always be in the correct place (hint - there must be 3 integer values to the right of tre comma. No commas aher the decimal point) $1,23456 There can be a negative sign belore the dotar sign 12e A one or two digit integer followed by a cent sign. Create a function that will do the validation and if valid, will convert the number to a "double" and return it to the calling function. Your main function should do the following: 1. Prompt the user to ead a currency amount 2. Read the inpot into a C-Style string 3. Call the function you created above to convert the amount. If the amount is valid, then display the amount in the form of a real (double) amount 4. Prompt the user if they wish to enter a new value (yes / no)

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

AWS Certified Database Study Guide Specialty DBS-C01 Exam

Authors: Matheus Arrais, Rene Martinez Bravet, Leonardo Ciccone, Angie Nobre Cocharero, Erika Kurauchi, Hugo Rozestraten

1st Edition

1119778956, 978-1119778950

More Books

Students also viewed these Databases questions

Question

2. Describe how technology can impact intercultural interaction.

Answered: 1 week ago