Created
July 18, 2013 14:14
-
-
Save shikajiro/6029680 to your computer and use it in GitHub Desktop.
上記のハンバーガーの合計金額に5%の消費税を足して画面に表示するプログラムを書いてください。
This file contains 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
public class HomeWork { | |
public static void main(String[] args) { | |
int[] menu = new int[3]; | |
menu[0] = 320; | |
menu[1] = 320; | |
menu[2] = 210; | |
int total = 0; | |
for (int i : menu) { | |
total += i; | |
} | |
double ans = total * 1.05; | |
//または、こういうのもあり | |
// total += total * 0.05; | |
System.out.println("合計は" + ans + "円です。"); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment