Hey, I'm having some problems a basic calculator that I'm messing about with in Java. Would be appreciated if some of you guys could give me some pointers as to where I'm going wrong...
Code :import java.util.Scanner; public class Calculator { Scanner kybd; kybd = new Scanner(System.in); public void main(String[] args) { String calcname = "Calculator"; System.out.println("Welcome to " + calcname + "please enter your name"); String name = kybd.readString(); System.out.println("Welcome. Press 1 to multiply and 2 to divide"); int choice = kybd.readInt(); choice = kybd.nextInt(); if (choice == 1) { System.out.println("Enter your first number"); int num1 = kybd.readInt(); System.out.println("Enter your second number"); int num2 = kybd.readInt(); System.out.println(num1 + " times " + num2 + "equals" + num1 * num2 + "."); } else if (choice == 2) { System.out.println("Enter your first number"); int Dnum1 = kybd.readInt(); System.out.println("Enter your second number"); int Dnum2 = kybd.readInt(); System.out.println(Dnum1 + " divided by " + Dnum2 + "equals" + Dnum1 / Dnum2 + "."); } else { System.out.println("Please check your input"); } } }
Cheers!

