Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

image text in transcribed
image text in transcribed
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: Notestzero would onk be ysed whenthe value sexactlo? 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 Tatestyour program, create a WordedNumber object in main. Write a for loop that does the following: Loop from i=0 to 999 : Set the Worded Number object's value to i Outputi +":+ conversion to English word + 7nm For negative numbers, loop from 1 to 999. See the screenshats below for a better idea of how to test

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_2

Step: 3

blur-text-image_3

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

Database And Expert Systems Applications 31st International Conference Dexa 2020 Bratislava Slovakia September 14 17 2020 Proceedings Part 1 Lncs 12391

Authors: Sven Hartmann ,Josef Kung ,Gabriele Kotsis ,A Min Tjoa ,Ismail Khalil

1st Edition

303059002X, 978-3030590024

More Books

Students also viewed these Databases questions

Question

Are the physical properties of H2O different from D2O? Explain.

Answered: 1 week ago

Question

1. Select the job or jobs to be analyzed.

Answered: 1 week ago