0

My code is creating a bug and it's not suppose to

8th Dec 2022, 11:39 AM
Abdullah Olamide
Abdullah Olamide - avatar
7 Answers
+ 3
Link your code. Without seeing your code, nobody can tell what you did.
8th Dec 2022, 12:02 PM
Lisa
Lisa - avatar
+ 1
The variable "bill" is never defined. "num" is an integer but sc.nextDouble() returns a double.
31st Mar 2023, 4:33 PM
Lisa
Lisa - avatar
+ 1
define "num" with the appropriate type. define "bill" or just use "num" if that is what you intended
31st Mar 2023, 4:36 PM
Lisa
Lisa - avatar
0
import java.util.Scanner; class Demo { public static void main(String[ ] args) { Scanner sc = new Scanner(System.in); int num = sc.nextDouble(); System.out.println(bill *15/100); } }
31st Mar 2023, 4:16 PM
Abdullah Olamide
Abdullah Olamide - avatar
0
I'm stick for a few days now
31st Mar 2023, 4:16 PM
Abdullah Olamide
Abdullah Olamide - avatar
0
So, what is the correct code
31st Mar 2023, 4:35 PM
Abdullah Olamide
Abdullah Olamide - avatar
0
How
31st Mar 2023, 4:37 PM
Abdullah Olamide
Abdullah Olamide - avatar