J
J
JavaBeginer2019-03-17 21:54:45
Java
JavaBeginer, 2019-03-17 21:54:45

When calculating the volume, it gives an error. What is the error?

package com.company;
import java.util.Scanner;
public   class Main {
    public static class Person_Volume{
        public double volume;
        Scanner scan=new Scanner(System.in);
        double  ODD_Volume = scan.nextDouble();
       public  void Set_Volume(double Weight){
            ODD_Volume =  Weight;
        }
       double Get_Volume(){
           int P = 1000;
           double volume = P/ODD_Volume;
           return volume;
       }

    }
    public static void main(String[] args){
        Person_Volume dmitriy = new Person_Volume();
        dmitriy.Set_Volume();
        dmitriy.Get_Volume();
        System.out.println(dmitriy.volume);
    }
}

Error:(20, 16) java: method Set_Volume in class com.company.Main.Person_Volume cannot be applied to given types;
required: double
found: no arguments
reason: actual and formal argument lists differ in length

Answer the question

In order to leave comments, you need to log in

1 answer(s)
O
Orkhan, 2019-03-17
@JavaBeginer

Set_Volume Method

public  void Set_Volume(double Weight){
            ODD_Volume =  Weight;
}

accepts type double.
Here, you need to pass the double type to the Set_Volume() method

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question