From the course: Java 11+ 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: A simple calculator

Challenge: A simple calculator - Java Tutorial

From the course: Java 11+ Essential Training

Start my 1-month free trial

Challenge: A simple calculator

(upbeat music) - [Instructor] In previous videos I described how to collect user input, and then gave an example of collecting integer values and adding them together. In this challenge I'd like you to do something similar. Collect user input, but this time get values that are cast as primitive doubles. These are numbers that have fractional values. And then divide one by the other. Now, I'm hiding my code so you can't see it here. And I'll just run the application to show you what should happen. I'm prompted for one value, and I'll enter any numeric value with a fraction. Then I'll enter another one, and the first number is divided by the second number. I'll run it again. And this time I'll set the first number as 24.2. And the second as 12.1, one half of that value. And this time I get back an answer of two. Try coding this yourself. Then look at the solution in the next video, and see if our two solutions are the…

Contents