From the course: Java 8 Essential Training

Unlock the full course today

Join today to access over 22,400 courses taught by industry experts or purchase this course individually.

Challenge: Creating a simple calculator application

Challenge: Creating a simple calculator application - Java Tutorial

From the course: Java 8 Essential Training

Start my 1-month free trial

Challenge: Creating a simple calculator application

- So now it's time for a simple challenge, to create a simple console application that takes user input, translates strings to numerical values, executes a mathematical operation, and returns the result to the console. I'm working in the project SimpleCalc. Now, don't open it quite yet, but I'll show you what the finished application looks like when I run it. I'll run the application, and my run window opens at the bottom of the screen. I see a prompt, enter a numeric value. I'll type in a value of 15, and I'm prompted for a second value. This time I'll enter a fractional value, 16.5. And when I press enter, I get back the answer as 31.5, and the application finishes. So, that's the application you should create. I encourage you to create the project from scratch. Create a brand new Java project, and put all the code into the main method of the main class. Using the scanner class, get some input from the user, using the helper classes for the primitive data types, parse the strings…

Contents