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 - Java Tutorial
From the course: Java 11+ Essential Training
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
-
-
-
-
-
-
Declare and initialize string values3m 55s
-
Build a string from multiple values4m
-
Clone the exercise files from GitHub3m 57s
-
Convert primitive values to strings3m 29s
-
Format numeric values as strings5m 55s
-
Interpolate strings with placeholders3m 7s
-
Compare string values4m 27s
-
Parse string values2m 36s
-
Get string values from user input3m 34s
-
Challenge: A simple calculator1m 9s
-
Solution: A simple calculator1m 18s
-
-
-
-
-
-
-