M
Michelle S
just a quick question about the logif for a program to add dollar and
cents memebers from too different objects together
public static Money operator + (Money m1, Money m2) {
Money tempMoney = new Money(m1);
tempMoney.dollars += m2.dollars;
tempMoney.cents += m2.cents;
if (tempMoney.cents > 99) {
dollars += cents div 100;
cents = cents - dollars % 100;
}
return tempMoney;
}
I am not sure exactly how to make use of mod to get the correct amount
of cents..
any suggestions appreciated
-----
cents memebers from too different objects together
public static Money operator + (Money m1, Money m2) {
Money tempMoney = new Money(m1);
tempMoney.dollars += m2.dollars;
tempMoney.cents += m2.cents;
if (tempMoney.cents > 99) {
dollars += cents div 100;
cents = cents - dollars % 100;
}
return tempMoney;
}
I am not sure exactly how to make use of mod to get the correct amount
of cents..
any suggestions appreciated
-----