Question: Question # 3. * a. Write a program that will write to a text file called output.txt the message Hello World * here are the

Question # 3. * a. Write a program that will write to a text file called output.txt the message "Hello World * here are the numbers 1 through 10"? Then displaying the numbers 1-10 with each number having its own line. * without using exception handling. * b.re-write the program using exception handling. * --------------------------------------------------------------------------------------------------------- * public static void main(String[] args) { } * --------------------------------------------------------------------------------------------------------- * Question # 4. Write a program that will read from the file provided and display the contents to the * console. In the catch block display to the user an error message that the file could not be read. * --------------------------------------------------------------------------------------------------------- * * public static void main(String[] args) { } * * --------------------------------------------------------------------------------------------------------- * Question # 5. Finish the code by displaying the contents of the two dimensional array in ascending order using only loops. * --------------------------------------------------------------------------------------------------------- * * public static void main(String[] args){ int[][] numbers = {{1, 2, 3}, {4, 5, 6}, {7, 8, 9}, {10, 11, 12}}; } * * * ---------------------------------------------------------------------------------------------------------- * Question # 6.Finish the code by writing a switch statement that will give the user legos if they are 6, a * bike if they are 12 and a new car if they are 18, if none of these conditions are met the user gets nothing. * --------------------------------------------------------------------------------------------------------- * * public static void main(String[] args){ int age; Scanner input = new Scanner(System.in); System.out.println("Please enter your age."); age = input.nextInt(); } * ---------------------------------------------------------------------------------------------------------- * Question # 7.Finish the code by writing if-else statements that will. * 1. Display the word baby if the user is or between 0 and 3. * 2. Display the word child if the user is or between 4 and 9. * 3. Display the word pre-teen if the user is or between 10 and 13. * 4. Display the word teen if the user is or between 14 an 17. * 5. Display the word young adult if the user is or between 18 and 23. * 6. if none of the above conditions are met then they are an adult. * --------------------------------------------------------------------------------------------------------- * public static void main(String[] args){ int age; Scanner input = new Scanner(System.in); System.out.println("Please enter your age."); age = input.nextInt(); }

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!