so I am writing a house class and one of my methods calculates the total area of a house. And then one more method prints of all the details of the house
that is my area method
public double getTotalArea(){
return ((300 * bedRooms) + familyRoomArea + livingRoomArea );
}
this is my print method
public String toString() {
return ("House Style =" + this.style + ",bedrooms = " + this.bedRooms +
",family room area = " + this.familyRoomArea + ",living room area = "
+ this.livingRoomArea + ",plot = " + this.plot + ", and square feet = " + (double)Math.round(this.getTotalArea() * 100)/100.0);
}
and this is my tester
String style1 = "colonial";
double familyRoomArea1 = 700;
double livingRoomArea1 = 500;
int bedRooms1 = 3;
double plot1 = 0.7;
House house1 = new House(style1,familyRoomArea1,livingRoomArea1,bedRooms1,plot1);
System.out.print("House 1: ");
System.out.print(house1.toString());
this is the current output I get when I run the program
House 1: House Style =colonial,bedrooms = 3,family room area = 700.0,living room area = 500.0,plot = 0.7, and square feet = 2100.01
I don't know what I am doing wrong here because of the total area I should get 2100.00 but I keep on getting 2100.01 I tried many different things I even used it without the Math.round functions but still, it gives me this answer.
Can I know what might be the issue and how I can fix this please thank you.