| 6 | public class CameraShop{ |
| 7 | private static final String CAMERA_NAME = "デジショットC6"; |
| 8 | private static final int CAMERA_PRICE = 5000; |
| 〜省略〜 |
| 12 | public static void main(String[] args){ |
| 13 | |
| 14 | int cameraStock = 10; |
| 15 | int cameraSales; |
| 〜省略〜 |
| 28 | while(true){ |
| 〜省略〜 |
| 35 | if(userInput.equals("y")){ |
| 36 | System.out.println("*** 商品名:"+ CAMERA_NAME); |
| 37 | System.out.println("*** 価 格:"+ CAMERA_PRICE + "円"); |
| 38 | System.out.println("*** 在庫数:" + cameraStock + "個"); |
| 39 | System.out.println("### 購入される数を入力してください。"); |
| 〜省略〜 |
| 45 | cameraSales = (int)(CAMERA_PRICE*((new Integer(userInput)).intValue())); |
| 46 | System.out.println("-------------------------------- 小計:" + cameraSales +"円です。"); |
| 47 | cameraStock = cameraStock -(new Integer(userInput)).intValue(); |
| 48 | |
| 49 | System.out.println("*** 商品名:"+ MEMORY_NAME); |
| 50 | System.out.println("*** 価 格:"+ MEMORY_PRICE + "円"); |
| 51 | System.out.println("*** 在庫数:" + memoryStock + "個"); |
| 52 | System.out.println("### 購入される数を入力してください。"); |
| 〜省略〜 |
| 58 | memorySales = (int)(MEMORY_PRICE*((new Integer(userInput)).intValue())); |