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]
3 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]3 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
Grade Co... ▶ Da'yana Stover - Aerospace Engineering.pdf
SVEN [57.7K]
The answer is Space shuttle.
8 0
1 year ago
Read 2 more answers
Henry is working from a USDA office. He has several tasks to perform today: 1) he logs onto his USDA computer to get started; 2)
Ksivusya [100]

Answer:

  A. Using a cell phone to discuss sensitive information

Explanation:

In general, cell phone signals are not secure. Cell phones without appropriate encryption should never be used to discuss sensitive information.

3 0
3 years ago
Explain how touch-tone dialing sends digits to the switch and write the name given to define touch-tone dialing.
Sergeu [11.5K]

Answer: Please see below as the answer is self-explanatory

Explanation:

Digital phones, normally uses a keyboard, with the digits 0-9, and special characters like # and *.

When the caller presses any keyboard, an electronic circuit within the phone generates two pure sinusoids, of frequencies within the vocal bandwidth (between 300 Hz and 3 khz, roughly), which identifies uniquely (as decoded by the receiving switch) which was the key pressed.

In this way, the switch reconstructs the phone number called, separating country code, area code and the local number as it receives the tones.

This system is called DTMF (dual tone multi frequency).

4 0
3 years ago
Which of the following is NOT essential for individuals to have to build their own web page?
natali 33 [55]
Linux. You do not need Linux as an operating system for your website.
5 0
4 years ago
Stella has captured this candid photograph of a man who was reunited with his son. She has used facial retouching in each of the
riadik2000 [5.3K]

Answer: The last picture it looks better.

Explanation: Welcome!

8 0
3 years ago
Read 2 more answers
Other questions:
  • What are some examples for Environmental Technology?
    5·2 answers
  • create a new Java application called "CheckString" (without the quotation marks) according to the following guidelines.** Each m
    7·1 answer
  • True or False? In C++, the expression (a + b / c) / 2 is implicitly parenthesized as ((a + b) / c) / 2.
    9·1 answer
  • What’s the best description of an opportunity cost
    5·1 answer
  • Provides images of weather systems, and helps to track storms at different altitudes
    7·1 answer
  • Pascal system . write the program that will calculate the perimeter of a rectangle if its area is A (m²) and one of its sides ha
    6·1 answer
  • Stages of reverse engineering
    8·1 answer
  • Hydraulic pressure is the same throughout the inside of a set of brake lines. What determines the amount of resulting mechanical
    7·1 answer
  • Pls help me!! I will give 35 points and mark brainliest !!!
    10·1 answer
  • he wants to customize the operating system to meet his needs. what types of tools should he use, and what can he do with each?
    6·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!