+ 1

JAVA - Invalid Method Declaration with two (2) input

Attached are the codes, kindly help to point out which function needed to fix. Thanks! P.S I have no knowledge to lil about JAVA prog. but I somehow understand the flow of the program. Was trying to know one to work. https://code.sololearn.com/c5djG86j3YfB/?ref=app

26th Oct 2021, 6:36 PM
Al3xooom
Al3xooom - avatar
7 Réponses
+ 2
Line 31 Return type "double" missing public static double computeChange() {
26th Oct 2021, 6:48 PM
Coding Cat
Coding Cat - avatar
+ 2
Yes, but you have to define it in the function Signatur! Like you have done it in all other functions.
26th Oct 2021, 6:51 PM
Coding Cat
Coding Cat - avatar
+ 1
Its finally working, thanks!
26th Oct 2021, 6:52 PM
Al3xooom
Al3xooom - avatar
+ 1
And also do proper formatting of your code so it will be more readable for others
26th Oct 2021, 6:54 PM
A S Raghuvanshi
A S Raghuvanshi - avatar
+ 1
I just copied it to some documents just for try outs, gonna clean it up now that its working. Thanks!
26th Oct 2021, 6:55 PM
Al3xooom
Al3xooom - avatar
0
Line no 31 it should be with return type u missed public static double computeChange() { double ch; ch= payment- costtax; return ch; }
26th Oct 2021, 6:49 PM
A S Raghuvanshi
A S Raghuvanshi - avatar
0
You are returning value its correct but your function need any return type int ,float , double or void or anything if u dont want to write then make it constructor. you have written only access specifiers see your other functions u have added return type properly
26th Oct 2021, 6:52 PM
A S Raghuvanshi
A S Raghuvanshi - avatar