Survey
* Your assessment is very important for improving the workof artificial intelligence, which forms the content of this project
* Your assessment is very important for improving the workof artificial intelligence, which forms the content of this project
Assignment 2 1. Write a program to ask for a string from the user and then output the string in a reverse order. If the output string is exactly the same as the original one then you should also append “, and amazingly they are the same!” Here are a couple examples (the part in italic is the user’s input): Please enter a string: James The new string is: semaJ Please enter a string: sandnas The new string is: sandnas, and amazingly they are the same! 2. Write a program to ask for an integer from the user – please note this “integer” is only mentioned in the prompt so that the user won’t input a number of other types, while you, as the programmer, can still treat this input as a string – and then create a new number by switching the first half and the second half of the original integer. Here are a couple examples (the part in italic is the user’s input): Please enter a string: 123456 The new string is: 456123 Please enter a string: 56789 The new string is: 89756 3. Write a program to ask the user to enter a sequence of numbers (double type). The numbers are separated by the return key (and give a prompt for each enter). The user ends the sequence by entering a 0. Then output the maximum number of all the entered numbers. Here is an example (the part in italic is the user’s input): Please enter a sequence of numbers, separated by return, and then end this sequence with a 0 at last: 25 Next number: 35.6 Next number: 112.112 Next number: 0 The maximum among your enters is 112.112 For all above programs you must also first output your name and your student number. Submit your answers to question 1, and the .java files for questions 2 and 3 to [email protected]. Subject is 1903-002 Assignment 2 Student # Your Name. You must submit the source files (.java files) as attachments. The deadline for submission: 11:59pm February 5, 2017. 1