Computers and Technology
uzeernabeel
5

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 a function that returns the dollar amount as a double. Add another function that returns the monetary amount in Euro currency (get current rates of conversion from the internet). Write a program that tests all of your functions. Input the amount. Then print the monetary amount first in dollars and cents and then in Euros.

+0
(1) Answers
Twerk

That's a Java program? import java.util.*; public class money { private int numberOfDollars; private int numberOfCents; public money(){ numberOfDollars = 0; numberOfCents = 0; } // Accessors public int getDollars(){ return numberOfDollars; } public int getCents(){ return numberOfCents; } // Getters public void setDollars( int newDollar){ NumberOfDollars = newDollar; } public void setCents(int newCent){ numberOfCents = newCent; } } //I hope that helps u

Add answer