Latest Tutorials| Questions and Answers|Ask Questions?|Site Map



Home Answers Viewqa Java3D help in java please
Login         

View Questions and Answers by Category

Advertisements


 
Have Programming Question? Ask it here!
 
 
 


zaara ahmad
help in java please
0 Answer(s)      3 years and 7 months ago
Posted in : Java3D


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()


Advertisement
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 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//
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 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
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
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 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
 

 

 

DMCA.com