Concept # on Java Subset Required for AP Exam print and println 10. Testing of output is restricted to System.out.print and System.out.println String literals & Concatenation 8. String concatenation + is part of the AP Java subset Escape sequences: produce backslash, double quotes, new line 9. The escape sequences inside strings \\, \", \n are part of the AP Java subset. Data types 1, 7. primitive types int, double, and boolean Variables and assignment 4 Chapter 2 Programming Exercises: 1. Create a class called EscapeCharPractice Write each two lines in one println statement. Use the newline escape sequence to produce the output below. Make sure you leave the two blank lines between lines 4-5 and 7-8. 2. This is a test of your 3. knowledge of "quotes" used 4. in 'string literals.' 5. You're bound to "get it right" 6. if you read the section on 7. ''quotes.'' 8. It can be found at C:\myfiles\documents 2 Create a class called PrintPractice Look at the code below and notice how it would be outputted. Rewrite the following code to produce the same output using println statements instead. System.out.print("Twas "); System.out.print("brillig and the "); System.out.println(" "); System.out.print(" slithy toves did"); System.out.print(" "); System.out.println("gyre and"); System.out.println( "gimble"); System.out.println(); System.out.println( "in the wabe." ); 3. Create a class called Poem that will produce the output below. Use only one println statement for the entire thing. 1. Hey Diddly Diddle 2 The mouse and the Fiddle 3 The cow jumped over the moon 4 5 And the dish ran away with the spoon. 6 7 TheEnd. 4. Create a class called FullName. Create two String variables to create your first name and one for your last name. Create an int variable that will store your age Create another int variable to store the number 10. Create four print statements to concatenate the String literal to the variable you created to produce the output below. Remember you want to add the two ints together at the end of the String. What do you do? 1. 2. 3. 4. What is your first name? firstName What is your last name? lastName Your full name is firstName LastName. My age in ______ years will be _age + years___________. 5. Create a class called DistanceTraveled Declare and initialize variables that would be used when writing a program that calculates the distance of a trip. The distance is calculated by subtracting the starting odometer reading from the ending odometer reading. Inputs: 3 variables for starting odometer reading, ending odometer reading and difference between the two. Use 30549 for starting Odometer and 37659 for ending odometer reading. Output: Statements that say 1. Your beginning odometer reading was ______. 2. Your ending odometer reading was ________ 3. You traveled _____________ distance on this trip.