Levels Tought:
Elementary,Middle School,High School,College,University,PHD
Teaching Since: | Apr 2017 |
Last Sign in: | 12 Weeks Ago, 5 Days Ago |
Questions Answered: | 4870 |
Tutorials Posted: | 4863 |
MBA IT, Mater in Science and Technology
Devry
Jul-1996 - Jul-2000
Professor
Devry University
Mar-2010 - Oct-2016
. Write a Java program in which you create two String variables str1 and str2; initialize str1 to have the value “first” and initialize str2 to have the value “second”. Then swap the values of the variables so that str1 contains the value “second” and str2 contains the value “first”. Display your results. 2. Modify #1 above to read in the values for str1 and str2 from the keyboard, and then swap them and display the results. Provide appropriate prompts for the user. 3. Write a Java program to prompt the user for three first names for girls and then concatenate them in every possible two-name combination with a blank in between so that new parents can choose a first name-middle name combination. 4. Write a Java program to read a three-word phrase (like Local Area Network or local area network) and produce the three-letter acronym in upper case. Your display should look like this: The acronym for the phrase “local area network” is LAN. 5. Write a Java program to read three characters from keyboard input and calculate and display the sum and average of their ASCII values. E.g., if the input is A B C, your output should read: The sum of the ASCII values of A, B and C is 65 + 66 + 67 = 198. The integer average is 66. The real (double) average is 66.0. 6. Write a Java program to read a name (like “yahoo”) from keyboard input and display www.yahoo.com 7. Write a Java program that reads a filename (like myProg.java) – you may assume that the name contains one “.” Separating the filename from its extension. You should display the original filename with extension, along with each of the filename and extension on a separate line. E.g., with myProg.java you should display: myProg.java filename: myProg extension: java 8. Write a Java program to read a sentence of two words (words are separated by blanks) and display the words and the punctuation on separate lines. E.g., if the sentence is Dogs rock! Your output should be: Dogs rock ! 9. Modify #8 to raise the characters to upper case: DOGS ROCK !