Da mihi sis bubulae frustum assae, solana tuberosa in modo Gallico fricta ac quassum lactatum coagulatum crassum.
~ Mansukh
Chris Maske wrote:I have a method in this account class called "add" and so far I know that the structure should look something like this:
public void add(MonetaryValue addend) {
(But I have no idea what goes here or how to get this to work.)...
"Leadership is nature's way of removing morons from the productive flow" - Dogbert
Articles by Winston can be found here
Aj Prieto wrote:First off, read this WhatNotHow.
Next, I'm curious, why not just use doubles?
That way, you don't have to deal with multiple numbers. All you'd do is manipulate one value rather than two.
Pseudo code solution (main method of application class):
Prompt user for input values
Read input values
Create MonetaryValue object for the balance of the account
Set the value of the object with the start dollar and cents values ..........................setValue()
Create MonetaryValue object for the amount to deposit each month
Set the value of the object with the dollar and cents values for monthly deposit .....setValue()
Repeat for correct number of years
Repeat for the correct number of months
Add interest to the balance ..............................................................................addInterest()
Add the monthly deposit amount to the deposit ..................................................add()
Display the new balance
Chris Maske wrote:So above is the solution that he wants us to use in order to solve the problem. And I also should have mentioned that I do have an addinterest method in my class. I've pretty well got the whole code finished except for that one add method... and he wants us to do it like this:
"add the addend dollars and the addend cents to the dollars and cents of the object"
"Leadership is nature's way of removing morons from the productive flow" - Dogbert
Articles by Winston can be found here
I just solved my own problem
~ Mansukh
Chris Maske wrote:So here's what I have coded in MonetaryValue so far:
"Leadership is nature's way of removing morons from the productive flow" - Dogbert
Articles by Winston can be found here
Right! We're on it! Let's get to work tiny ad!
We need your help - Coderanch server fundraiser
https://coderanch.com/wiki/782867/Coderanch-server-fundraiser
|