Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

*****************FIX ERRORS IN CODE**************************** import java.text.DecimalFormat; /** * * @return fields * */ public class Dodecahedron { //declare and initialize private String label = ;

image text in transcribed*****************FIX ERRORS IN CODE****************************

import java.text.DecimalFormat; /** * * @return fields * */ public class Dodecahedron { //declare and initialize private String label = ""; //label of type string private String color = ""; // color of type string private double edge = 0; //edge type of double //Constructor /** * @param label * @param color * @param edge */ public Dodecahedron(String label, String color, double edge) { //use setters to initialize field this.label = label; this.color = color; this.edge = edge; } //getter

/** * * @return String representation of label field */ public String getLabel() { return label; }

/** * * @paramlabel * @return if nut null returns true */ public boolean setLabel(String label) { if (label != null) { this.label = label.trim(); return true; } else { return false; } }

/** * * @return String representation of color field */ public String getColor() { return color; }

/** * * @param color * @return true if not null */ public boolean setColor(String color) { if (color != null) { this.color = color.trim(); return true; } else { return false; } }

/** * @param color * @return double representing the edge field */ public double getEdge() { return edge; }

/** * * @param edge * @return true if is edge >0 */ public boolean setEdge(double edge) { if (edge > 0) { this.edge = edge; return true; } else { return false; } } /** *@return the total surface area * */ public double surfaceArea() { double a = 3 * (Math.sqrt(25 + 10 * Math.sqrt(5))) * Math.pow(edge, 2); return a; } /** * *@return the volume * */ public double volume() { double v = ((15 + 7 * Math.sqrt(5)) / 4) * Math.pow(edge, 3); return v; } /** * *@return the surfaceArea to volume ratio * */ public double surfaceToVolumeRatio() { return surfaceArea() / volume(); }

@Override public String toString() { DecimalFormat decimalFormat = new DecimalFormat("#,##0.0##"); return "Dodecahedron \"" + label + "\"" + " is \"" + color + "\" with 30" + " edges of length " + decimalFormat.format(edge) + " units. " + "\tsurface area = " + decimalFormat.format(surfaceArea()) + " square units " + "\tvolume = " + decimalFormat.format(volume()) + " cubic units. " + "\tsurface/volume ratio = " + decimalFormat.format(surfaceToVolumeRatio()); } }

15 public Dedecahedron String label, String color, double edge) 1 ublic boolean setLabel String label Error [Checkstyle]: -2 Missing a Jarvados comment Error (Checkstyle]: -2 Yaber hides a neid nan edge return true is edge Error [Checkstyle): -2 Tabelfrides a field public boolean setEdge double edge) Error (Checkstyle]: 0 (limit exceeded) Expected @osram teg for "abel if label - rull) this. Lab .labul.tria); return true Error (Checkstyle]: 0 (limit exceeded) edge'de a field Error (Checkstyle) -2 calor hides a field Error (Checkstyle): -2 cdge hvides a fin Error (Checkstyle): 0 (limit exceeded) Expected @param lag for edge if (dy > 0) { return talse; return true; return String representation of color field public String getColor() { return color; return true y not nuli public boolean setColor String color) Error (Checkstyle]: 0 (limit exceeded) Color Prides a field Error (Checkstyle]: 0 (limit exceeded) Expected @param tay for cafor

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Refactoring Databases Evolutionary Database Design

Authors: Scott Ambler, Pramod Sadalage

1st Edition

0321774515, 978-0321774514

More Books

Students also viewed these Databases questions

Question

8. Explain the relationship between communication and context.

Answered: 1 week ago

Question

d. How were you expected to contribute to family life?

Answered: 1 week ago