Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

I need help with this program! In C++ please Instructions In elementary school, you learned how to express a number in an English word format.

I need help with this program! In C++ please

image text in transcribedimage text in transcribedimage text in transcribed

Instructions In elementary school, you learned how to express a number in an English word format. For example: the number 1 is spelled as "one", 2 is "two", 3 is "three", and so on. In this program, we are going to create a new class called "WordedNumber" which has the capability to produce a string with the English word of the number it is storing. To make this simple, we will only support the numbers from -999 to 999. If a number is negative, then the number should have "negative" as a prefix. Example: "negative one," "negative two hundred twenty three," etc. Below is a chart of the words to use: Note: "zero" should only be used when the value is exactly 0. Do NOT spell 20 as "twenty zero", for example. Class Design Description of Methods - constructor - either accepts an initial number or defaults to zero. Additionally, rejects any number outside the supported range as described in the instructions. - getNumber - returns the numerical version of the number the object is storing. - setNumber - sets a new number to be stored. Additionally, rejects any number outside the supported range as described in the instructions. - toWord - generates the English word of the number being stored and returns it as a string. Testing To test your program, create a WordedNumber object in main. Write a for loop that does the following: Loop from i=0 to 999 : Set the WordedNumber object's value to i Output i + ": " + conversion to English Word + "In" For negative numbers, loop from 1 to 999. See the screenshots below for a better idea of how to test. Sample Outputs

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

Repairing And Querying Databases Under Aggregate Constraints

Authors: Sergio Flesca ,Filippo Furfaro ,Francesco Parisi

2011th Edition

146141640X, 978-1461416401

More Books

Students also viewed these Databases questions

Question

Discuss the key people management challenges that Dorian faced.

Answered: 1 week ago