help in java please

help in java please

Define a class named Money whose objects represent amounts of U.S. money. The class will have two instance variables of type int for the dollars and cents in the amount of money. Include a constructor with two parameters of type int for the dollars and cents, one with one parameter of type int for an amount of dollars with zero cents, and a no-argument constructor. Include the methods add for addition and minus for subtraction of amounts of money.

These methods should be a static methods and should each have two parameters of type Money and returns a value of type Money. Include a reasonable set of accessors (getter) and mutator (setter) methods as well as the methods equals and toString. Add a second version of the methods for addition and subtraction. These methods should have the same names as the static version but use a calling object and a single argument. For example, this version of add method (for addition) has calling object and one argument.

So m1.add(m2) returns the result of adding the Money objects m1 and m2. Note that your class should have all these methods; for example, there should be two methods named add.

Write a test program for your class.

Notes: You will need to implement the following methods:

â?? int getCents()
â?? int getDollars()
â?? void setDollars(int dollars)
â?? void setCents(int cents)
â?? boolean equals(Money amount)
â?? static Money add(Money amount1, Money amount2)
â?? static Money minus(Money amount1, Money amount2)
â?? Money add(Money m)
â?? Money minus(Money m)
â?? String toString()

View Answers









Related Tutorials/Questions & Answers:
java please please help
java please please help  Dear Friends plz help me to complete this program import java.util.*; public class StringDemo { static...[] to HashMap so that i can seperate key and value using Map.Entry.Please help me!  
New to Java Please help
New to Java Please help  Hi I need help, can some one help me.... Thanks!   If you are new in java, then you need to learn core java concepts.So go through the following link: Core Java Tutorials Here, you will find
Advertisements
PLEASE HELP WITH MY JAVA
PLEASE HELP WITH MY JAVA  Hey my name is Gavin and im a student... please help!!!!!!!! it is a for-loop question: Display the first 5 multiples... and average If u can please help...   
Java Help Please
Java Help Please  I can't seem to figure out how to make this program, can some one help me please? It is due soon!! 4) Write a program that will take an input (Date object will contain fields for the month, day, and year - all
Java Variables Help Please!
Java Variables Help Please!  Hi, I just started with java and i need help with my school project, this is it so far: import java.util.*; public class ProjectCS { public static void main(String[] args) { welcome
please help java
please help java  How to Change the background color of the dashboard to black with an opacity of 0.6. Change the opacity of the images in the dashboard to 0.5 before the dashboard slides out. Change the opacity
help please - Java Beginners
help please  i wrote this program but the function newLine dosnt work with me and i dont know where is exactly the error this is the code i... on Java visit to : http://www.roseindia.net/java Thanks   
help in java please
help in java please  Define a class named Money whose objects represent amounts of U.S. money. The class will have two instance variables of type int for the dollars and cents in the amount of money. Include a constructor
Help me please!!! - Java Beginners
Help me please!!!  im badly needing the complete code for this project in java!!! can you please help me???!!! it is about 1-dimensional array... the answers 8Hours from now!!! Kindly help me!! please!!please!!! NOTE
please help me - Java Beginners
please help me   I have some error in this programe //write acomputer programe using java to generate following series : //output: //1,2,3,0,-2,7,-4..... class Series1HW { public static void main(String args
please help
please help  please send me the code of dynamic stack in java without using the built in functions
help please?
help please?  Define a class named Circle with the following properties: â?¢ An integer data field named radius with protected access modifier... the properties of both objects and also their surface area and circumference. java
please help//
please help//  Number square cube 1 1 1 3 9 27 5 25 125 7 49 343 9 81 729 total 165 1225 â?? this is the ouput..;;; i
please help//
please help//  Number square cube 1 1 1 3 9 27 5 25 125 7 49 343 9 81 729 total 165 1225 â?? this is the ouput..;;; i
please help//
please help//  Number square cube 1 1 1 3 9 27 5 25 125 7 49 343 9 81 729 total 165 1225 â?? this is the ouput..;;; i
help please?
help please?  Define a class named Circle with the following properties: List item â?¢ An integer data field named radius with protected access modifier, and a String data field named colour with private access modifier. Both
help please?
help please?  Define a class named Circle with the following properties: List item An integer data field named radius with protected access modifier, and a String data field named colour with private access modifier. Both
help please?
help please?  Define a class named Circle with the following properties: List item An integer data field named radius with protected access modifier, and a String data field named colour with private access modifier. Both
help please?
help please?  Define a class named Circle with the following properties: List item An integer data field named radius with protected access modifier, and a String data field named colour with private access modifier. Both
help please?
help please?  Define a class named Circle with the following properties: ? An integer data field named radius with protected access modifier... are and volume of the Sphere object. Question 3: Write a Java program that will declare
Please Help
Please Help  How do I create an attribute that represents the following: A grayscale 'color' value, that is, an integer between 0 and 255 inclusive, where 0 corresponds to the darkest black and 255 to the brightest white
Please Help
Please Help  How do I create an attribute that represents the following: A grayscale â??colorâ?? value, that is, an integer between 0 and 255 inclusive, where 0 corresponds to the darkest black and 255 to the brightest white
Please help
Please help  Problem: Write a program that does addition, subtraction, multiplication and division operation on real numbers. The operation started with a user entered 2 numbers and click one of the operation buttons
Please help
Please help  Problem: Write a program that does addition, subtraction, multiplication and division operation on real numbers. The operation started with a user entered 2 numbers and click one of the operation buttons
help please
help please  hi i am done with register application using jsps servlets htmls. But i couldnt imp one thing that.. Wen u login to ur account browser... file.. Or atleast help me with code here.. I tried checking session alive
please help
please help  public class AllContact extends javax.swing.JFrame { /** Creates new form AllContact */ public AllContact() { initComponents(); try{ Connection1 con =new Connection1(); Connection conobj
urgent...pleAse help me.....please!
urgent...pleAse help me.....please!  please help me urgent! how can i do dictionary with the use of array code in java, where i will type the word then the corresponding meaning for that word will appear...thanks
please help me to give code - Java Beginners
please help me to give code  Write a program that prints an n-level stair case made of text. The user should choose the text character..., http://www.roseindia.net/java
please help me to give code - Java Beginners
please help me to give code  Write a function, sliding(word, num)that behaves as follows. It should print out each slice of the original word having length num, aligned vertically as shown below. A call to sliding(examples, 4
please help me to give code - Java Beginners
please help me to give code  Write a function with a signature cheerlead(word) that prints a typical cheer as follows. The word robot: Gimme an R Gimme an O Gimme a B Gimme an O Gimme a T What did you give me? ROBOT
please help me to give code - Java Beginners
please help me to give code  Write a program that reads a file named famous.txt and prints out the line with the longest length. In the case...(); } } } ------------------------------- read for more information, http://www.roseindia.net/java/beginners/read
please help me here.. - Java Beginners
please help me here..  ..uhhmm.. im a little bit new to java and i go... if the first string is part of the second string... ..help..  Hi friend...."); } } } ---------------------------------------------------- Read for more information, http://www.roseindia.net/java
please help me for this program - Java Beginners
please help me for this program   Write a program that asks the user for a starting value and an ending value and then writes all the integers (inclusive) between those two values. Enter Start: 10 Enter End: 14 10
please help me to give code - Java Beginners
please help me to give code  Write a program that uses loops to generate an n x n times table. The program should get n from the user. As a model here is a 4 x4 version: | 1 2 3 4
please help me in a java program !! - Java Beginners
please help me in a java program !!  the porgram should use kosaraju's algorithm to detect the strong connected components in a graph (http://en.wikipedia.org/wiki/Kosaraju_algorithm) there are 4 classes in my program : Vertex
please help me.
please help me.  How to read a properties file in java with a suitable example. Please send me. Thanks Trinath   Please visit the following link: Java read properties file
I need help on my Java code.... please please help me out!?
I need help on my Java code.... please please help me out!?  Well my code is supposed to ask for an input file and then (ex: input.txt), read... the anagram on screen or the output file! Please show me whats wrong. Thanks i
please help me.
please help me.  Please send me a code of template in opencms and its procedure.so i can implement the code. Thanks trinath
please help me.
please help me.  Please send me the validation of this below link. the link is http://www.roseindia.net/answers/viewqa/JSP-Servlet/9584-JSP-Servlet-Search-and-Edit.html Thanks Trinath
Please help me to learn - WebSevices
Please help me to learn  Please help me to learn Java Fast
Confusion on Functions. Help Please?!
Confusion on Functions. Help Please?!  Write a program which has a number of functions for getting the area i.e. area of circle, area of square, area... not getting anywhere with it really :( Some help please
Please Help Now
Please Help Now  i want to put this map in ajax oriented codeigniter website thanks in advance plz help me now plz very urgent
please help me.
please help me.  How to move the edits.jsp in below link? http://www.roseindia.net/answers/viewqa/JSP-Servlet/9584-JSP-Servlet-Search-and-Edit.html
Please help me
Please help me  program for when a user enter his card number, it has to create default security pin in the database
help me please
help me please   Hello I want helping for this question , Please Write a program that reads some friendsââ?¬â?¢ names, stores them in an array, and then prints out on the screen all friends who start by a particular letter
please help me.
please help me.  I have a jsp page under that i add a list box under i get the countries through my database. so how can i do
please help me
please help me  interface Test1 { String toString(); } public class Test { public static void main(String[] args) { System.out.println(new Test1() { public String toString() { return "test
need help please
need help please  Dear sir, my name is logeswaran. I have a big problem that I can't find the solution for a program. How can I block a user from enter a page second time. Please help me. By the way I'm using Access database
please help me
please help me  Dear sir, I have a problem. How to write JSP coding, if a user select a value from drop down list for example department, the another... before. This name list should get from the database. Please help me. By the way, I'm
help please!!! T_T
help please!!! T_T  what is wrong in this?: import java.io.*; class...("please enter your name:"); name1= input.readline(); System.out.println("please... { String name1; String name2; System.out.println("please enter

Ads