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

  Explain shortestpath() and printshortestdistance()

Explain the following code line by line, and submit your answer: shortestPath() & printShortestDistance() in weightedGraph.h

  Implement the program and find the item

This would be a function called into program. Struggling with the search aspect. Any clarification is greatly appreciated. File is 'inventory.dat'

  An application that instantiates five librarybook object

Write an application that instantiates five LibraryBook objects

  Create huffman codes

Write a C++ program to create Huffman codes. Program input is a file called freq.txt (make up your own file for testing) that contains data on the characters in some cleartext file in the form of each character's non-zero frequency of occurrence i..

  Write c program that allows user to make ledger transactions

Write a C program that allows the user to make some ledger transactions. The program should first prompt the user to enter the current balance of his/her ledger account (must allow for dollars and cents, and not less than zero).

  Write the prototype and header for a function

Write the prototype and header for a function called calculate. The function should have three parameters: an int, a reference to a double, and a long (not necessarily in that order). Only the int parameter should have a default argument, which is..

  Combination of memory technologies

Give an example of how an operating system may use a combination of memory technologies with varying speeds, capacities and costs to achieve overall good performance at acceptable cost.

  Create and utilize compound conditions

Eliminate redundancy within a program by applying loops and functions - Create structure charts for a given problem

  Think about the logic and design

Your goal is to solve the following programming lab activity. Write a program that prompts and accepts a number between 1 and 12. After getting the input, display the number with the appropriate month (e.g., "This is the 1st month...January, This ..

  Calculate the total expences

Trying to fugure out how to enter a formula in a cell(d10) that multiplies 30 by the value in another cell (c27), then make the other cell (c27) an absolute cell reference in the formula. Copy the formula to cells d11:d13, and then calculate the t..

  Write the code for the for-loop initializations

Write the code for the for-loop initializations and the for-loop body. Carefully study and compare the pseudocode and C++ for loops in the commentary.

  Design and implement a c++ program for find friends

MCS2514Pgm1- Design and implement a C++ program that will help find friends according to a defined method. In particular, your program will find and display the ten people in database who answered a set of survey questions closest to what the user..

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