Answer:
The method in C++ is as follows:
void dollarextract(double money){
int dollar = int (money);
int cent = (money - dollar) * 100;
cout<<dollar<<" dollar "<<cent<<" cent";
}
Step-by-step explanation:
This defines the method
void dollarextract(double money){
This gets the dollar part of the amount
int dollar = int (money);
This gets the cent part of the amount
int cent = (money - dollar) * 100;
This prints the amount in dollars and cent
cout<<dollar<<" dollar "<<cent<<" cent";
}
To call the method from main, use:
dollarextract(2.95);
The above will return 2 dollar 95 cent