 Here's a program that asks for your age in years and prints out your age in days. We're using three separate statements to create the output. The first two use print, not println, so the output will appear on a single line. Let's run the program and see that it works. That's a lot of work to create a single line of output. There must be a better way. One better way is to use a plus sign. Let's go into JShell, a tool that comes with Java 9 and above. It lets us try out Java expressions without having to write a whole program. We know that plus works with integers and with doubles. It also works with strings by tacking them together. So the string door plus the string bell results in the single string doorbell. What happens if I try to add a string and a number? For example, 2 plus the word space doesn't. It works. That's because Java converts the number 2 to a string and then tax on the word doesn't. Now that we know that this works, we can go back and modify our program. Instead of these three lines, we'll make one line and use a plus sign to join all the parts together. We need to put the blanks in ourselves to make sure they appear in the output. Let's compile and run and it works great. Here's a program that lets you enter a price and it tells you the amount you pay with a 15% discount. Let's run the program with a price of $25. Looks good. Now let's run it again and this time put in a price of $20. That output isn't quite as lovely. And if we run the program with an initial price of $4.90, the output is really ugly. To solve this problem, to get exactly two digits after the decimal point, we need to use string formatting. Let's start investigating formatting by going back to the Agent Days program and change the output to this. Instead of println, we're going to use format and we're going to have one string that is about %d days. What's that %d? It's a format specifier. Whenever you see a % sign, think of it as a placeholder where a value will go into the string. The d specifies that we want an integer to fill in that placeholder. The letter d is used for integers for historical reasons, by the way. After the string, we give the variable that fills in the placeholder. Days will fill in this %d placeholder. Just like print, format does not give us a new line. So we have to explicitly give a new line character, which we write in Java as backslashn. Let's compile this program and run it and it works great. You can have multiple placeholders and specify multiple variables to fill them in. I can change my output to say placeholder years is about placeholder days and then provide the variables that fill in those placeholders, compile, run it again, and get my nicely formatted output, all without needing a plus sign anywhere. Let's return to the discount program. To build a format specifier for doubles, you use the f specifier and tell how many digits you want to the right of the decimal. Instead of println, we're going to use format. We're going to say % sign dot 2f, which says I want two decimal places in my double placeholder. We'll also put in our new line and there's one other thing we need to do. We don't want format to think that this % sign is part of a new placeholder. To tell format that this % sign is not part of a placeholder, that we really do want a % sign in our output, we need to put two % signs in a row. Now that we have our format string with its placeholder, we give the variable to fill in that placeholder. Let's compile that and when we run it with our $20, we get $17.00 and when we run it with the initial price of $4.90, we get $4.17, you'll notice that format has rounded the number for us. There are many other format specifiers and you can add information that tells how many spaces a number should take up. This lets you produce output where everything lines up nicely. Here's a URL where you can get the details about formatting.