Design a class numbers that can be used to translate

Assignment Help C/C++ Programming
Reference no: EM132194191

Question: Numbers Class

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 then prints out its English description.

Reference no: EM132194191

Questions Cloud

Define ethics within the context of digital forensics : For this assignment, you will define ethics within the context of digital forensics. You will then apply what you learned to your life, developing an ethical.
What kind of data does it generate : Select a research method that is appropriate to use to answer your question. Explain the research method that you have selected. · What steps are involved? ·
Legislation pertaining to the minority group : Describe relevant legislation pertaining to the minority group.
What do you see as the biggest issue in the middle east : What do you see as the biggest issue in the Middle East and why? How does this issue affect the world currently and what do you think are the issues
Design a class numbers that can be used to translate : 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.
Describe a significant and material event missed by planned : What term is used to describe a significant and material event missed by planned that should have, in retrospect, been known and predictable?
Determine the new price of a movie ticket : For each of the annual inflation rates given in the following table, first determine the new price of a movie ticket, assuming it rises at the rate of inflation
Positive culture enhance a firm''s competitive advantage : Briefly explain, How can a strong, positive culture enhance a firm's competitive advantage?
Strong leisure orientation : If a person knew that group members all had a "strong leisure orientation," how would that help this person does a better job as a manager?

Reviews

Write a Review

C/C++ Programming Questions & Answers

  Practice with c functions

This homework will give you practice with C++ functions as well as string manipulation.

  Write a program that will compute and display x

Write a program that will prompt the user for a value x then compute and display X / (ln(X)+2)

  Write a program that reads in an integer

Write a program that prompts the user for a measurement in meters, and then converts it in to miles, feet, and inches.

  Write the function that converts us dollars to japanese yen

Write the function that converts U.S. dollars to Japanese Yen. Notice that the parameters are : exchange rate and U.S. dollar value. The function will return the Yen equivalent.

  Write a program that prints the day number of the year

Write a program that prints the day number of the year, given the date is in the form month-day-year.

  Write a program to perform a topological sort on a graph

Write a program to perform a topological sort on a graph in the language of your choice from the following list C, C++. Run your program on a sample of inputs.

  Develop a program that displays random numbers

Using a timer to generate a random number, develop a program that displays random numbers between 1 and 47 for your state's lottery.

  Write a body mass index calculator

Write a Body Mass Index calculator in C++. Input will be a person's height in feet and inches as well as their weight in pounds and ounces.

  Atlanta home loan - control failureuse the nine-step case

atlanta home loan - control failureuse the nine-step case analysis method as instructed in the required.requiredyou are

  Futures of anomaly based instruction detection scheme

Explain the futures of anomaly based instruction detection scheme.

  Calculate the celsius equivalent of a fahrenheit temperature

Prepare a program to calculate the Celsius equivalent of a Fahrenheit temperature

  Five elements similar to having different variables

How is an array with five elements similar to having five different variables?

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