Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

More C-Strings. Write a program that will accept a monetary amount from 0.00 to 11.99. This can be a float value . Pass it to

More C-Strings.

Write a program that will accept a monetary amount from 0.00 to 11.99. This can be a float value . Pass it to a method that will generate the "Check Book" or Text version of the number and generate a C-String result. Display the value of the generated C-String. Loop unit I enter X to exit. Note you do not need to code for 100s or 1000s - only up to eleven dollars.

Create a C-string for the output amount and use C-string related methods for processing. This implies you will have the following:

#include

#include

You may need to create additional methods. That is your choice.

Example actions: Entering 8.51 displays "Eight dollars and 51 cents" built as a C-String.
Entering 9.12 displays "Nine dollars and 12 cents" I will not deduct for stating "One dollars" or "1 cents" as plural as I did in the Week 1 assignment. 

This snippet may help:

 float myMoney;
 cin >> myMoney; int singles = int(myMoney);

int cents = int(round(100.00 * (myMoney - singles))); string centsS = to_string(cents); // string allowed for data conversion from int. Do not use to string to build the result.

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

Professional Microsoft SQL Server 2014 Integration Services

Authors: Brian Knight, Devin Knight

1st Edition

1118850904, 9781118850909

More Books

Students also viewed these Databases questions