Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

I need help with my code. It has problems when it compiles. NEED Help. problem 1

ID: 3622571 • Letter: I

Question

I need help with my code. It has problems when it compiles. NEED Help.
problem 1 page 731

public class length
{
public static void main(String[] args)
{
double length_feet,length_inch,totalinches,centim;
double centi=2.54,inch=12;
String input;

input = JOptionPane.showInputDialog("Enter the value of feet : ");
length_feet = Double.parseDouble(input);

input = JOptionPane.showInputDialog("Enter the value of inches : ");
length_inch = Double.parseDouble(input);

try
{
if(length_feet<=0||length_inch<=0)
{
throw divbyzero();
}
else if(isalpha(length_feet)!=0 || isalpha(length_inch)!= 0)

{
throw divbyzero();
}
else
{
totalinches=inch*length_feet+length_inch;
centim=centi*totalinches;
JOptionPane.showMessageDialog(null,"you have entered " + length_feet + "feet and " + length_inch + "inch" + "equivalent in centimeter is " + centim + "centimeters" );
}
}catch( divbyzero e )
{
JOptionPane.showMessageDialog(null, "INVALID INPUT!! ENTER FEET AND INCHES HAS TO BE DIGITS GREATER THAN ZERO");;
}
System("pause");
}
}


Explanation / Answer

complie this as javac length.java import javax.swing.JOptionPane; public class length { public static void main(String[] args) throws Exception { double length_feet,length_inch,totalinches,centim; double centi=2.54,inch=12; String input; input = JOptionPane.showInputDialog("Enter the value of feet : "); length_feet = Double.parseDouble(input); input = JOptionPane.showInputDialog("Enter the value of inches : "); length_inch = Double.parseDouble(input); if(length_feet
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote