I haven't tested the code, but if you're gonna use it, you're gonna have to switch up the input statements since I use a third party package. If anyone notices anything wrong, drop me a line.Code:import cs1.Keyboard; public class ifStatementPractice { public static void main(String args[]) { int price = 200; int width; int length; int surface; int wood; int drawers; System.out.print("Enter table surface's width (inches): "); width = Keyboard.readInt(); System.out.print("Enter table surface's length (inches): "); length = Keyboard.readInt(); surface = width * length; if((surface > 1000) && (surface < 2000)) { price += 75; } if(surface > 2000) { price += 125; } System.out.println("Wood Selection!"); System.out.println("1. Oak - $100"); System.out.println("2. Mahogany - $150"); System.out.println("3. Pine - $0"); System.out.print("Which type of wood: "); wood = Keyboard.readInt(); switch(wood) { case 1: price += 100; case 2: price += 150; case 3: price += 0; } System.out.print("How many drawers would you like - $30/drawer: "); drawers = Keyboard.readInt(); price += (drawers * 30); System.out.println("Your new desk is going to cost: $" + price); } }




Reply With Quote