answersLogoWhite

0

import java.io.*;

import java.util.*;

public class Calculator

{

public static void main(String args[])

{

System.out.println("Make your arithmetic selection from the choices below:\n");

System.out.println(" 1. Addition");

System.out.println(" 2. Subtraction");

System.out.println(" 3. Multiplication");

System.out.println(" 4. Division\n");

System.out.print(" Your choice? ");

Scanner kbReader = new Scanner(System.in);

int choice = kbReader.nextInt();

if((choice<=4) && (choice>0))

{

System.out.print("\nEnter first operand. ");

double op1 = kbReader.nextDouble();

System.out.print("\nEnter second operand.");

double op2 = kbReader.nextDouble();

System.out.println("");

switch (choice)

{

case 1: //addition

System.out.println(op1 + " plus " + op2 + " = " + (op1 + op2) );

break;

case 2: //subtraction

System.out.println(op1 + " minus " + op2 + " = " + (op1 - op2) );

break;

case 3: //multiplication

System.out.println(op1 + " times " + op2 + " = " + (op1 * op2) );

break;

case 4: //division

System.out.println(op1 + " divided by " + op2 + " = " + (op1 / op2) );

}

}

else

{

System.out.println("Please enter a 1, 2, 3, or 4.");

}

}

}

User Avatar

Wiki User

14y ago

What else can I help you with?

Related Questions

Report on calculator project in core java?

yes


Is there any project report on KBC in java?

Hi, You can check this link http://javaadmin.com/kbc-project-in-java/ This is not a project report but a fully functional KBC project written in Java. Thanks, www.javaadmin.com


What is difference between java developer and java project manager?

In a typical development shop, a java developer does the actual work while a java project manager receives the credit in addition to a much larger pay check. Generally, the term "java project manager" implies that a resource knows neither java nor project management. However, the atypical title allows a java project manager to easily hide his/her lack of knowledge. Take the following conversations as examples of a typical verbal exchange with a java project manager: Java Developer: "Hey Java Project Manager, i am having problems with an out of memory exception in my servlet container, how do i view the contents of my heap?" Java Project Manager: "I am sorry, i am mostly a Project Manager, it has been along time since i have programmed java" or Senior Manager: "Hey Java Project Manager, how is your project plan going? When i tried to level your resources in M$Project, the end date was 2012" Java Project Manager: "I am sorry, i am not very good with M$Project, i have been working on solving an out of memory exception which is holding up one of my developers" Your mileage may vary however.


Download code for scientific calculator in java?

yes


Website of free java project to be download with source code?

which Website for free java project to be download with source code Free Download Project in asp.net,Java ,C#.Net ,Php on thisWebsite www.enggroom.com


What are topics for minor project which you can made using core java VB.net ASP.net?

i am make digital signature minor project in java


How do you program a reverse auto loan calculator in JAVA?

In order to program a reverse auto loan calculator in JAVA, you are going to need a lot of experience with JAVA. There are online tutorials that can help you set up with fundamentals of JAVA so that you will be able to create almost any basic program you want.


How do you create setup of core java project?

how to create setup file in core java


How do you create a project in Java?

It depends on what IDE you're using. For example, in JCreator, to create a new project you go to File &gt; New &gt; Project... (or press ctrl + shift + N) Or in Eclipse, click on File&gt; New &gt; Java Project


Where can I find an ira calculator online?

www.dinkytown.net/java/RothIRA.html is a good one


What are the Mini project topic for java?

online website


A system level project in java?

1.A web caching server in java. 2.VOIP