Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

It should be perfectly run for xcode and please must add int main() in this assignment Currency. input Wibe a Ct+ progam that will ahow

image text in transcribed
It should be perfectly run for xcode and please must add int main() in this assignment image text in transcribed
Currency. input Wibe a Ct+ progam that will ahow the user to enter a currency anount and valdate that it is in a contect format. For purposes of this program, the corroct format of curoncy the following: \$1234 The $ aigh folowed by an intoger number $12345 the $ sign followed by a real number. If a decimal point is inchuded in the number, there must be exactly 2 digits fo the fight of the decimal point 51,234.56 There can be commis 6 the now of the decima point but they must awins be in the correct place (hint - here must be 3 integar values in the right of the comme. No commas aller the decimal point) $1,23456 There can be a negative sign betore the dolar 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 sbould do the following 1. Prompt the use to end a currency amount 2. Read the inpet into a C-Style string 3. Cill the function you created above to conven the amount. If the amount is valid, then display the amount in the form of a real (double) amount 4. Prompt the use if thcy wish to enter a new value (yea/ 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

Securing SQL Server Protecting Your Database From Attackers

Authors: Denny Cherry

1st Edition

1597496251, 978-1597496254

More Books

Students also viewed these Databases questions