Here what I think you are doing wrong is that you are passing JOptionsPane.showMessageDialog() which is a GUI method and when you will see the docs for the method description you will get to know that showMessageDialog() has void in its return type. However, the method Double.parseDouble() expects some value which is void in this case hence the type checker is giving error. So to resolve this you must pass some value in the parseDouble() method.
i nedd to know how to fix it import javax.swing.JOptionPane: public class Conv void length (double...
I'm attempting to convert ch object array to double array public void calculateSalesPrice() { double salePrice[] = new double[ch.length]; int p = 0; for (int i = 0; i < ch.length; i += 3) { p = i + 1; for(int j = 0;j } } error message:items.java:16: error: cannot find symbol for(int j = 0;j ^ symbol: variable length location: class Object items.java:17: error: array required, but Object found salePrice[j] = (double full program import java.io.File; import java.util.Scanner; import...
I have this class determines how much petrol is being purchased and the cost. The gas is divided between regular, premium, and super unleaded. The program reads (R, P, or S) that designates which kind of gasoline was purchased. class Petrol { private static final double Premium = 0; private static final double Super = 0; char gas; String type; double amount, cost; private String free; private double regular; Petrol(char ch, double a) { gas = ch; amount = a;...
Hello, i need help with this homework: Code provided: public class DirectedWeightedExampleSlide18 { public static void main(String[] args) { int currentVertex, userChoice; Scanner input = new Scanner(System.in); // create graph using your WeightedGraph based on author's Graph WeightedGraph myGraph = new WeightedGraph(4); // add labels myGraph.setLabel(0,"Spot zero"); myGraph.setLabel(1,"Spot one"); myGraph.setLabel(2,"Spot two"); myGraph.setLabel(3,"Spot three"); // Add each edge (this directed Graph has 5 edges, // so we add 5 edges) myGraph.addEdge(0,2,9); myGraph.addEdge(1,0,7); myGraph.addEdge(2,3,12); myGraph.addEdge(3,0,15); myGraph.addEdge(3,1,6); // let's pretend we are on...