Can anyone pls edit this java code i need to be able to add


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

Request for Solution File

Ask an Expert for Answer!!
Basic Computer Science: Can anyone pls edit this java code i need to be able to add
Reference No:- TGS0566912

Expected delivery within 24 Hours