Problem Solving with C++ (9th Edition)
Problem Solving with C++ (9th Edition)
9th Edition
ISBN: 9780133591743
Author: Walter Savitch
Publisher: PEARSON
Question
Book Icon
Chapter 12, Problem 3P
Program Plan Intro

“Money” ADT Class

Program plan:

  • For file “MoneyADT.h”:
    • Include required header file.
    • Define a class for “Money”.
      • Declare the function for overload operator “<”, “<=”, “>’, “>=”, “+”, “-” and “==”.
      • Declare the constructor for “Money” class.
      • Declare the function for compute total amount, total dollars and total cents.
      • Declare the function for operator “>>” and “<<”.
      • Declare required variables.
  • For file “MoneyADT.cpp”:
    • Define function for overload operator “<”, “<=”, “>” and “>=”.
    • Define function for “percent”.
      • This function is used to compute the percentage amount for given money.
    • Define function for arithmetic operator “+” and “-” with two arguments.
    • Define function for overload operator “==”.
    • Define function for overload operator “-” with one parameter.
    • Define default constructor for “Money” class, constructor with one argument and two arguments.
    • Define function “computeTotalAmount”.
      • This function is used to compute the total amount.
    • Define function “computeTotalDollars”.
      • This function is used to compute the dollars in given amount.
    • Define function “computeTotalCents”.
      • This function is used to compute the cents in given amount.
    • Define function “forDollarConversion” which is used to convert amount to dollar
    • Define function “forCentsConversion” which is used to convert the amount to cents.
    • Define function “forRoundedValue” which is used for convert the result in rounded value.
    • Define function for input and output operator.
  • For file “main.cpp”:
    • Include required header file.
    • Create an object for “Money” class.
    • Create an object for “Money” class with argument.
    • Declare variable for file input and file output.
    • Open the given input file.
    • Check the given file is found or not using “if” loop.
    • Read the amount from file.
    • Display the purse amount.
    • Compare the given amount and purse amount.
    • Compute sum of amount and purse and display it.
    • Compute the difference of two amount and display it.
    • Check the amount using the comparison operator “>=”.
    • Check the amount using the comparison operator “>”.
    • Check the amount using the comparison operator “<=”.
    • Check the amount using the comparison operator “<”.
    • Finally close input and output file.

Blurred answer
Students have asked these similar questions
Write a program that simulates a Magic 8 Ball, which is a fortune-telling toy that displays a random response to a yes or no question. In the student sample programs for this book, you will find a text file named 8_ball_responses.txt. The file contains 12 responses, such as “I don’t think so”, “Yes, of course!”, “I’m not sure”, and so forth. The program should read the responses from the file into a list. It should prompt the user to ask a question, then display one of the responses, randomly selected from the list. The program should repeat until the user is ready to quit. Contents of 8_ball_responses.txt:  Yes, of course! Without a doubt, yes. You can count on it. For sure! Ask me later. I'm not sure. I can't tell you right now. I'll tell you after my nap. No way! I don't think so. Without a doubt, no. The answer is clearly NO. (You can access the Computer Science Portal at www.pearsonhighered.com/gaddis.)
Start with the initial angles within the integration and just integrate them without mapping them to specific quadrants. Use python and radians
How does encryption prevent a hacker from getting your data
Knowledge Booster
Background pattern image
Similar questions
SEE MORE QUESTIONS
Recommended textbooks for you
Text book image
Microsoft Visual C#
Computer Science
ISBN:9781337102100
Author:Joyce, Farrell.
Publisher:Cengage Learning,
Text book image
C++ Programming: From Problem Analysis to Program...
Computer Science
ISBN:9781337102087
Author:D. S. Malik
Publisher:Cengage Learning
Text book image
Programming Logic & Design Comprehensive
Computer Science
ISBN:9781337669405
Author:FARRELL
Publisher:Cengage
Text book image
EBK JAVA PROGRAMMING
Computer Science
ISBN:9781337671385
Author:FARRELL
Publisher:CENGAGE LEARNING - CONSIGNMENT
Text book image
C++ for Engineers and Scientists
Computer Science
ISBN:9781133187844
Author:Bronson, Gary J.
Publisher:Course Technology Ptr
Text book image
Programming with Microsoft Visual Basic 2017
Computer Science
ISBN:9781337102124
Author:Diane Zak
Publisher:Cengage Learning