| 28.4 | 
						
						 Write statement(s) for each of the following: 
						
						
							- Print integer 40000 right justified in a 15-digit field.
 
							 - Print 200 with and without a sign.
 
							 - Print 100 in hexadecimal form preceded by 0x.
 
							 - Print 1.234 with three digits of precision in a nine-digit field with preceding zeros.
 
						  
						
						  | 
					
					
						| 28.5 | 
						
						 Show what is printed by each of the following statements. If a statement is incorrect, indicate why. 
						
						
							- System.out.printf( "%-10d
", 10000 );
 
							 - System.out.printf( "%c
", "This is a string" );
 
							 - System.out.printf( "%8.3f
", 1024.987654 );
 
							 - System.out.printf( "%#o
%#X
", 17, 17 );
 
							 - System.out.printf( "% d
%+d
", 1000000, 1000000 );
 
							 - System.out.printf( "%10.2e
", 444.93738 );
 
							 - System.out.printf( "%d
", 10.987 );
 
						  
						
						  | 
					
					
						| 28.6 | 
						
						 Find the error(s) in each of the following program segments. Show the corrected statement. 
						
						
							- System.out.printf( "%s
", 'Happy Birthday' );
 
							 - System.out.printf( "%c
", 'Hello' );
 
							 - System.out.printf( "%c
", "This is a string" );
 
							 - The following statement should print "Bon Voyage" with the double quotes:
							
							
System.out.printf( ""%s"", "Bon Voyage" );
							
							
							  
							 - The following statement should print "Today is Friday":
							
							
System.out.printf( "Today is %s
", "Monday", "Friday" );
							
							
							  
							 - System.out.printf( 'Enter your name: ' );
 
							 - System.out.printf( %f, 123.456 );
 
							 - The following statement should print the current time in the format "hh:mm:ss":
							
							
Calendar dateTime = Calendar.getInstance();
System.out.printf( "%1$tk:1$%tl:%1$tS
", dateTime );
							
							
							  
						  
						
						  | 
					
					
						| 28.7 | 
						
						 (Printing Dates and Times) Write a program that prints dates and times in the following forms: 
						
						
GMT-05:00 04/30/04 09:55:09 AM
GMT-05:00 April 30 2004 09:55:09
2004-04-30 day-of-the-month:30
2004-04-30 day-of-the-year:121
Fri Apr 30 09:55:09 GMT-05:00 2004
						
						 
						
						
						 [ Note: Depending on your location, you may get the time zone other than GMT-05:00.] 
						 | 
					
					
						| 28.8 | 
						
						 Write a program to test the results of printing the integer value 12345 and the floating-point value 1.2345 in various size fields. 
						 | 
					
					
						| 28.9 | 
						
						 (Rounding Numbers) Write a program that prints the value 100.453627 rounded to the nearest digit, tenth, hundredth, thousandth and ten thousandth. 
						 | 
					
					
						| 28.10 | 
						
						 Write a program that inputs a word from the keyboard and determines the length of the word. Print the word using twice the length as the field width. 
						 | 
					
					
						| 28.11 | 
						
						 (Converting Fahrenheit Temperature to Celsius) Write a program that converts integer Fahrenheit temperatures from 0 to 212 degrees to floating-point Celsius temperatures with three digits of precision. Use the formula 
						
						
celsius = 5.0 / 9.0 * ( fahrenheit - 32 );
						
						 
						 to perform the calculation. The output should be printed in two right-justified columns of 10 characters each, and the Celsius temperatures should be preceded by a sign for both positive and negative values. 
						 | 
					
					
						| 28.12 | 
						
						 Write a program to test all the escape sequences in Fig. 28.23. For the escape sequences that move the cursor, print a character before and after the escape sequence so that it is clear where the cursor has moved. 
						 | 
					
					
						| 28.13 | 
						
						 Write a program that uses the conversion character g to output the value 9876.12345. Print the value with precisions ranging from 1 to 9. 
						 |