Edit this java code add the 3 amounts

Assignment Help Basic Computer Science
Reference no: EM13230428

Can anyone pls edit this Java code? I need to be able to add the 3 amounts listed on the main method public class Money { private Currency currency; private int wholenum; private int decnum; public Money(Currency currency, int wholenum, int decnum) { this.currency = currency; this.wholenum = wholenum; if (decnum > 99) this.wholenum = this.wholenum + decnum/100; this.decnum = decnum0; } public String toString() { if (decnum<10) return currency +" "+wholenum+".0"+decnum; return currency +" "+wholenum+"."+decnum; } public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (this.getClass() != obj.getClass()) return false; Money M = (Money) obj; // casting obj to Money if (this.currency != M.currency) return false; if (this.wholenum != M.wholenum) return false; return (this.decnum == M.decnum); } public int hashCode() { Integer I = this.decnum; return I.toString().hashCode(); } // TESTING public static void main(String[] args) { Money M1 = new Money(Currency.PHP, 500, 1); Money M2 = new Money(Currency.PHP, 500, 1234); Money M3 = new Money(Currency.PHP, 500, 1234); System.out.println(M1 +" "+ M1.equals(M2) +" "+ M2); System.out.println(M2 +" "+ M2.equals(M2) +" "+ M2); System.out.println(M2 +" "+ M2.equals(M3) +" "+ M3); System.out.println(M1 +" "+ M1.hashCode()); System.out.println(M2 +" "+ M2.hashCode()); System.out.println(M3 +" "+ M3.hashCode()); }

Reference no: EM13230428

Questions Cloud

How many units should emerson order for the coming holiday : How many units should Emerson order for the coming holiday season?
What is its default risk premium : An 8-year corporate bond has a yield of 8.3%, which includes a liquidity premium of 0.75%. What is its default risk premium?
Examine each of the cells and write a brief statement : Assume that a security model is needed for the protection of information in your class. Using the CNSS model, examine each of the cells and write a brief statement on how you would addess the component represented in that cell.
How to implement a turnaround strategy : Can someone give me some ideas of how to implement a turnaround strategy for a United Way dued to the fact that they have some ethcial problems and increase of competitve.
Edit this java code add the 3 amounts : Can anyone pls edit this Java code? I need to be able to add the 3 amounts listed on the main method public class Money { private Currency currency; private int wholenum; private int decnum; public Money(Currency currency, int wholenum, int decnum..
Calculate the degree of completion of the reaction : A gaseous mixture containing 50 mol% hydrogen and 50 mol% acetaldehyde (C2H4O) is initially contained in a rigid container at a total pressure of 760 mmHg absolute. The formation of ethanol occurs according to C2H4O + H2 C2H6O.
What is function of enable control input of tri-state buffer : What is the function of the enable control input of a tri-state buffer If the output of two or more tri-state buffers is connected to each other, what is the restriction on enable control input lines What does happen when this restriction is viola..
What activities would be included in the value added time : What activities would be included in the value added time of fast food hamburger preparation and delivery? Why are these part of the Value Added Time?
How many machines are required to meet the forecast : The standard time at Lensco Inc for grinding a set of prescription lenses is 18 minutes. If the typical efficiency for their operations is 80%, and typical machine reliability is 87% how many machines are required to meet the forecast of 17,247 le..

Reviews

Write a Review

Basic Computer Science Questions & Answers

  Identifies the cost of computer

identifies the cost of computer components to configure a computer system (including all peripheral devices where needed) for use in one of the following four situations:

  Input devices

Compare how the gestures data is generated and represented for interpretation in each of the following input devices. In your comparison, consider the data formats (radio waves, electrical signal, sound, etc.), device drivers, operating systems suppo..

  Cores on computer systems

Assignment : Cores on Computer Systems:  Differentiate between multiprocessor systems and many-core systems in terms of power efficiency, cost benefit analysis, instructions processing efficiency, and packaging form factors.

  Prepare an annual budget in an excel spreadsheet

Prepare working solutions in Excel that will manage the annual budget

  Write a research paper in relation to a software design

Research paper in relation to a Software Design related topic

  Describe the forest, domain, ou, and trust configuration

Describe the forest, domain, OU, and trust configuration for Bluesky. Include a chart or diagram of the current configuration. Currently Bluesky has a single domain and default OU structure.

  Construct a truth table for the boolean expression

Construct a truth table for the Boolean expressions ABC + A'B'C' ABC + AB'C' + A'B'C' A(BC' + B'C)

  Evaluate the cost of materials

Evaluate the cost of materials

  The marie simulator

Depending on how comfortable you are with using the MARIE simulator after reading

  What is the main advantage of using master pages

What is the main advantage of using master pages. Explain the purpose and advantage of using styles.

  Describe the three fundamental models of distributed systems

Explain the two approaches to packet delivery by the network layer in Distributed Systems. Describe the three fundamental models of Distributed Systems

  Distinguish between caching and buffering

Distinguish between caching and buffering The failure model defines the ways in which failure may occur in order to provide an understanding of the effects of failure. Give one type of failure with a brief description of the failure

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd