C++ program to design a class

Assignment Help Programming Languages
Reference no: EM13936329

Design a class Numbers that can be used to translate whole dollar amounts in the range 0 through 9999 into an English description of the number. For example, the number 713 would be translated into the string seven hundred thirteen, and 8203 would be translated into eight thousand two hundred three. The class should have a
single integer member variable: int number; and a static array of string objects that specify how to translate key dollar amounts into the desired format. For example, you might use static strings such as string lessThan20[20] = {"zero", "one", ..., "eighteen", "nineteen"}; string hundred = "hundred"; string thousand = "thousand";

The class should have a constructor that accepts a nonnegative integer and uses it to initialize the Numbers object. It should have a member function print() that prints the English description of the Numbers object. Demonstrate the class by writing a main program that asks the user to enter a number in the proper range and then prints out its English description.

Below is how the code would display:

This program translates whole dollar amount into words for the purpose of writing checks.

Entering a negative number terminatesthe program.

Enter an amount for be translated into words:<0-9999>1234

One thousand two hundred thirty four

Enter another number 0-9999:<negative number to stop> -3456

Press any key to continue.........

Reference no: EM13936329

Questions Cloud

Determine the average number of probes that each search algo : Determine the average number of probes that each search algorithm took. Do these values represent the theoretical values? Print out the averages for the two searches and their theoretical values.
Describe legal issues in operation of international banking : Describe the legal and ethical issues in the operation of international banking and reflect on how these contributed to the downfall of the capital market and its effect it may have on investments in Costa Pobre.
Fryer inc owns equipment for which it paid 90 million : Fryer, Inc., owns equipment for which it paid $90 million. At the end of 2011, it had accumulated depreciation on the equipment of $27 million. Due to adverse economic conditions, Fryer's management determined that it should assess whether an impairm..
Discuss the media release and newspaper article : Discuss the Media Release and newspaper article in the context of the statement "regulation is the output of a political process". Do you agree or disagree?
C++ program to design a class : The class should have a constructor that accepts a nonnegative integer and uses it to initialize the Numbers object. It should have a member function print() that prints the English description of the Numbers object. Demonstrate the class by writi..
Preparing and analyzing financial statements : As the CFO of your corporation, you are in charge of preparing and analyzing financial statements that will be presented to potential investors and creditors
What is expected relation between relative interest rates : Effects of real interest rates. What is the expected relationship between the relative real interest rates of two countries and the exchange rate of their currencies?
C# program to encrypt the letters : Consider this, the word is FEATHER. Remove duplicate letters, making FEATHR, and append the rest of the letters of the alphabet in reverse order.
Ensure data stored on file servers : Implement and install a website for a hospital. Needs to write an article that shows the WEBSITE DEVELOPMENT. Check and maintain the software which is installed in the network devices.

Reviews

Write a Review

Programming Languages Questions & Answers

  Write a haskell program to calculates a balanced partition

Write a program in Haskell which calculates a balanced partition of N items where each item has a value between 0 and K such that the difference b/w the sum of the values of first partition,

  Create an application to run in the amazon ec2 service

In this project you will create an application to run in the Amazon EC2 service and you will also create a client that can run on local machine and access your application.

  Explain the process to develop a web page locally

Explain the process to develop a Web page locally

  Write functions

These 14 questions covers java class, Array, link list , generic class.

  Programming assignment

If the user wants to read the input from a file, then the output will also go into a different file . If the user wants to read the input interactively, then the output will go to the screen .

  Write a prolog program using swi proglog

Write a Prolog program using swi proglog

  Create a custom application using eclipse

Create a custom Application Using Eclipse Android Development

  Create a application using the mvc architecture

create a application using the MVC architecture. No scripting elements are allowed in JSP pages.

  Develops bespoke solutions for the rubber industry

Develops bespoke solutions for the rubber industry

  Design a program that models the worms behavior

Design a program that models the worm's behavior.

  Writing a class

Build a class for a type called Fraction

  Design a program that assigns seats on an airplane

Write a program that allows an instructor to keep a grade book and also design and implement a program that assigns seats on an airplane.

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd