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
Plagiarism occurs when writers
Law Incorporation [45]
The answer is A. <span>Use others' ideas and writing as their own </span>
7 0
4 years ago
Read 2 more answers
Electronic type is often considered to be the latest step in the evolution of the written ______________.
Allisa [31]
It isn’t people but im really confused. I think its A but dont come at me if its wrong
4 0
3 years ago
In the context of the components of a typical expert system, _____ is a software package with manual or automated methods for ac
Pani-rosa [81]

Answer:

knowledge acquisition facility

Explanation:

In the context of the components of a typical expert system, Knowledge acquisition facility is defined as that component of an expert system that is responsible for providing an effective and efficient medium for collecting and incorporating relevant information such as data, new rules, relationships and facts used by the expert system.

6 0
3 years ago
Implement a metho d to nd the k-th largest element in an array of size N using a minimum priority queue (MinPQ). Assume that the
diamong [38]

Sorry don't understand spanish,I am sure you can get it wrong,for crying out loud you people get checks for coming to United States

3 0
3 years ago
Computer forensics is practiced _____. A. Only by specially trained government and law-enforcement personnel B. By many organiza
laiz [17]

Answer:

Option B is the correct answer.

<h3>Computer forensics is practiced by many organizations, including public- and private-sector organizations such as hospitals, law enforcement, and businesses. </h3><h3 />

Explanation:

Computer forensics can be defined as a branch of digital forensics that deals with the evidences and and proofs found on all digital storage media such as computers.

It is basically a step for enhancing security bases of communication. Therefore it is mainly used by law-enforcement personnel but it can also be practiced by other institutions for the purpose of self security.

<h3>I hope it will help you!</h3>
4 0
3 years ago
Other questions:
  • Some files appear dimmed in one of the default folders on your computer. What would be the best course of action?
    15·1 answer
  • Please help! i need to answer this soon!
    13·1 answer
  • Who initially developed what is now known as the internet?
    5·1 answer
  • What is considered to be the core of the Unix operating system ?
    14·1 answer
  • Which statement gives an advantage of multicellular organisms?
    7·2 answers
  • A pizza delivery restaurant decides to stop hiring drivers and start hiring cyclers to deliver its pizza. The restaurant thinks
    15·1 answer
  • Which of the following is a characteristic of a college savings plan
    6·2 answers
  • What type of platform is SAP?
    9·1 answer
  • Coordination in a global information system requires a _____ architecture for data, standardization within departments.
    15·1 answer
  • How can you create a messages to look like an IMessage?
    8·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!