Code Coach Input Problem(Hovercraft) | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Code Coach Input Problem(Hovercraft)

How can I integrate the input into my code?

4th Feb 2020, 10:17 AM
Shania
Shania - avatar
9 Answers
+ 2
Just add: import java.util.Scanner;
4th Feb 2020, 10:29 AM
KnuckleBars
KnuckleBars - avatar
+ 1
how did you try? could post your attempt.
4th Feb 2020, 10:24 AM
Bahhaโตฃ
Bahhaโตฃ - avatar
+ 1
public class Program { public static void main(String[] args) { Scanner input = new Scanner(System.in); int customers = input.nextInt(); var costs = 20000000 + 1000000; var sales = customers * 3000000; if (sales > costs){ System.out.println("Profit"); } else if (costs > sales){ System.out.println("Loss"); } else if (costs == sales){ System.out.println("Broke Even"); } else{ System.out.println("?"); } } }
4th Feb 2020, 10:27 AM
Shania
Shania - avatar
+ 1
You forgot to import the Scanner class Shania
4th Feb 2020, 10:29 AM
KnuckleBars
KnuckleBars - avatar
0
Please put the used programming languages.
4th Feb 2020, 10:18 AM
KnuckleBars
KnuckleBars - avatar
0
Sorry, i meant Java
4th Feb 2020, 10:20 AM
Shania
Shania - avatar
0
I had no idea how to do it, so I just copied the pre written method from another code coach problem
4th Feb 2020, 10:28 AM
Shania
Shania - avatar
0
Thank you ๐Ÿ‘๐Ÿป๐Ÿ˜Š
4th Feb 2020, 10:35 AM
Shania
Shania - avatar
0
You're welcome Shania :)
4th Feb 2020, 10:36 AM
KnuckleBars
KnuckleBars - avatar