1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
Tcecarenko [31]
2 years ago
6

Define a class named Money that stores a monetary amount. The class should have two private integer variables, one to store the

number of dollars and another to store the number of cents. Add accessor and mutator functions to read and set both member variables. Add another function that returns the monetary amount as a double. Write a program that tests all of your functions with at least two different Money objects.
Computers and Technology
1 answer:
WINSTONCH [101]2 years ago
6 0

Answer:

#include<iostream>

using namespace std;

class Money{

    private:

        int dollars;  

       int cents;

   public:

       Money(int d=0, int c=0){

          setDollar(d);

          setCent(c);

       }

       void setDollar(int d){

           dollars = d;

       }

       void setCent(int c){

           cents = c

       }

       int getDollar() {

           return dollars;

       }

       int getCent() {

           return cents;

       }

       double getMoney(){

          return (dollars + (cents/100));

       }

};

// testing the program.

int main(){

  Money Acc1(3,50);

  cout << M.getMoney() << endl;

  Money Acc2;

  Acc2.setDollars(20);

  Acc2.setCents(30);

  cout <<"$" << Acc2.getDollars() << "." << Acc2.getCents() << endl;

  return 0;

}

Explanation:

The C++ source code defines the Money class and its methods, the class is used in the main function as a test to create the instances of the money class Acc1 and Acc2.

The object Acc2 is mutated and displayed with the "setDollar and setCent" and "getDollar and getCent" methods respectively.

You might be interested in
A photo's color intensity can be modified by changing the brightness and content.
fiasKO [112]
The above statement is FALSE.

A photo's color intensity can be modified by changing the brightness and CONTRAST.

There are four common image controls that makes an image easy to view. These controls are brightness, contrast, saturation, and sharpness.

Brightness control simply brightens the whole image from the shadows to the highlights equally.

Contrast control is the separation between the darkest and brightest areas  of the image.

Saturation control is the separation of colors in the image.

Sharpness control is defined as the edge contrast, meaning the edges in the image are the ones being contrasted.
6 0
3 years ago
Andreas wants to insert an element into an email that will graphically display the values in a table. Which option should he cho
Montano1993 [528]

Answer:

D. chart

Explanation:

Correct on edg

5 0
3 years ago
Which organization has published more than 300 Web standards, and encourages manufacturers to follow these standards, many of wh
jek_recluse [69]

Answer:

c

Explanation:

6 0
3 years ago
While typing,a red squiggly line appears. What does that signify?
raketka [301]
You maybe spelled something incorrect
6 0
3 years ago
Read 2 more answers
What
AveGali [126]
Answer: Computers and cellular devices
Reason: Everyone every day watched entertainment with commercials of the internet all day on these technologies and proven by 92 percent. Make this brainly answer for everyone else that needs this. Hope this helps:)
8 0
3 years ago
Other questions:
  • Today car-buying customers can enter negotiation armed with accurate facts and figures about a car. Describe how car buyers felt
    9·1 answer
  • Computer a sends a packet intended to reach computer f. along its path it arrives at computer
    15·1 answer
  • A student is helping a friend with a home computer that can no longer access the Internet. Upon investigation, the student disco
    15·1 answer
  • A recipe for deducing the square root involves guessing a starting value for y. Without another recipe to be told how to pick a
    12·1 answer
  • What is the difference between a sequential program and an event-driven program?
    9·1 answer
  • * Create a list of places and situations in which we use a computer
    11·1 answer
  • We are sending a 30 Mbit MP3 file from a source host to a destination host. All links in the path between source and destination
    12·1 answer
  • Recommend how could you integrate positive aspects of digital literacy into your own
    13·1 answer
  • In the bremmer article, the author states that _________ translates into greater risks.
    9·1 answer
  • Transaction processing systems (TPSs) provide valuable input to management information systems, decision support systems, and kn
    8·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!