title: Printing with Java, how to mix "%.2f", variables, and regular strings on same print line?
body: <p>What is a better way to get the same output as the following code, but without all the <code>System.out</code> repeats?</p>
  
  <p>Whenever I try to combine it all one one line, the <code>printf</code> or <code>println</code> wants something else and I get an error with Netbeans.</p>
  
  <pre><code>    System.out.print("Thank you." + "\n" + "The resulting tip is ");
      System.out.printf("%.2f", tip);
      System.out.print(" and the total is ");
      System.out.printf("%.2f", total);
      System.out.println(".");
  </code></pre>
  
  <p>I'm trying to use the following on one line, how to include it on a single print attempt?</p>
  
  <pre><code>("Thank you." + "\n" + "The resulting tip is " + "%.2f", tip + "and the total is " %.2f", total + ".");
  </code></pre>
  
  <p>The program is a tip calculator, and I want to get the decimals rounded to two (ie xx.yy). </p>