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 - Java Tutorial
From the course: Java 8 Essential Training
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…
Practice while you learn with exercise files
Download the files the instructor uses to teach the course. Follow along and learn by watching, listening and practicing.
Contents
-
-
-
-
-
-
-
Working with object data types6m 27s
-
Using the String class5m 5s
-
Converting primitive values to strings4m 15s
-
Building a string from multiple values8m 44s
-
Comparing string values5m 51s
-
Formatting numeric values as strings4m 41s
-
Parsing string values3m 13s
-
Working with dates and times8m 35s
-
Challenge: Creating a simple calculator application1m 28s
-
Solution: Creating a simple calculator application1m 19s
-
-
-
-
-
-
-
-
-