Question: import java.util.Scanner; public class LabProgram { public static double milesToLaps(double userMiles){ double mileslaps=0.25; double total; total= userMiles/mileslaps; System.out.printf(%.2f,total); } public static void main(String[] args) {

import java.util.Scanner;

public class LabProgram {

public static double milesToLaps(double userMiles){

double mileslaps=0.25;

double total;

total= userMiles/mileslaps;

System.out.printf("%.2f",total);

}

public static void main(String[] args) {

Scanner scnr= new Scanner(System.in);

double miles;

miles= scnr.nextDouble();

milesToLaps(miles);

}

}

I wrote this code and works in my Jgrasp but in zybooks I have an error that said

zyLabsUnitTest.java:10: error: incompatible types: void cannot be converted to double

studentResult = studentMain.milesToLaps(1.5);

Why is this happening?

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!