+ 1
why wont this code run properly ?
11 Respostas
+ 5
Sheldon 10110 I see a few issues at first glance
The import has a leading dot that should not be there .java. should be java.
The sales that is read from input is the number of sales, not the amount of revenue from sales. You must multiply the number of sales times 3,000,000 to get the total revenue for the month.
In your else if you use an assignment = rather than a comparison ==
+ 4
read the comments.
import java.util.Scanner; // dot before java is wrong
public class Program
{
public static void main(String[] args) {
Scanner hovercraft=new Scanner (System.in);
int sales=hovercraft.nextInt();
if (sales > 21000000){
System.out.println("profit");
}
else if(sales == 21000000){ // should be ==
System.out.println("broke even"); // should be System
}
else{
System.out.println("loss");
}
}
}
+ 4
No need to feel dumb. It's part of the learning process. Happy coding!
+ 3
Can you show your code, Sololearn does not allow somebody else to see your solution. The best way would be to save your solution in a code-bit and then add me to a comment in the code.
+ 2
First things first you make spelling mistakes in the spelling of "System" which will obviously throw an error.
So you should improve that first by writing more and more codes rather than going on ahead.
Here's the fix 👇
https://code.sololearn.com/cYDX0fQ898R8/?ref=app
+ 1
Paul K Sadler oh sorry
+ 1
+ 1
thanks guys.... I feel super dumb 😹but now I feel less dumb 😹
+ 1
I can answer the same problem in python
+ 1
Will u like if I answered the same problem in python?
0
Hilal