Created
March 16, 2020 09:58
-
-
Save swann44/378dc5aec47758fe795f19b88ef24b3e to your computer and use it in GitHub Desktop.
java 2
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| \CA\FE\BA\BE\00\00\007\00 | |
| \00 \00@(\CC\CC\CC\CC\CC\CD?\F3333333 \00\00 | |
| \00\00\00\00\00<init>\00()V\00Code\00LineNumberTable\00main\00([Ljava/lang/String;)V\00 | |
| StackMapTable\00 | |
| SourceFile\00CandyCount.java\00 | |
| \00\00\00\00\00\00\00\00 | |
| CandyCount\00java/lang/Object\00java/lang/System\00out\00Ljava/io/PrintStream;\00java/io/PrintStream\00println\00(I)V\00 \00\00 \00\00\00\00\00\00\00\00 | |
| \00\00\00\00\00\00\00\00\00\00\00*\B7\00\B1\00\00\00\00 | |
| \00\00\00\00\00\00\00\00 \00\00\00\00\00\00\00|\00\00\00\00\005\00H\00J6'\97\9E\00)\97\9E\00')g\97\9B\00`6')gH\A7\FF\EE\B2\00\B6\00\B1\00\00\00\00 | |
| \00\00\00&\00 \00\00\00\00\00\00\00\00\00\00\00 \00\00 | |
| \00%\00\00,\00\004\00\00\00\00\00 \00\FE\00\00\00\00\00\00\00 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| class CandyCount { | |
| public static void main(String[] args) { | |
| double money = 12.4; | |
| double price = 1.2; | |
| int candies = 0; | |
| if (money > 0 && price > 0) { | |
| while (money-price >= 0) { | |
| candies = candies + 1; | |
| money = money - price; | |
| } | |
| } | |
| System.out.println(candies); | |
| } | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| wilder@wilder-ThinkPad-T440p:~/JavaProjects/Candies$ javac CandyCount.java | |
| wilder@wilder-ThinkPad-T440p:~/JavaProjects/Candies$ java CandyCount | |
| 10 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment