Database System Concepts
Database System Concepts
7th Edition
ISBN: 9780078022159
Author: Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher: McGraw-Hill Education
Bartleby Related Questions Icon

Related questions

bartleby

Concept explainers

Question
[画像:PART 2: Variables, Constants, and Arithmetic The following are sample runs of the program to help you write your code and format your output: Sample Output 1: Please enter your first name: Alfred Please enter your last name: Johnson W/ Hello Alfred Johnson //\\ The length of your full name is 13 characters Your standard username is: AJohnson Your initials are: A.J. If we switch the first and last characters of your first name, we get: dlfreA ----jGRASP: operation complete. Sample Output 2: Please enter your f£irst name: Jennifer Please enter your last name: Todd W/ Hello Jennifer Todd //\\ The length of your full name is 12 characters Your standard userame is: JTodd Your initials are: J.T. If we switch the first and last characters of your first name, we get: rennifeJ ----jGRASP: operation complete. Instructions for Part 2: 1. Go to the following URL to complete the project: Project 1B 2. If using and IDE (jGrasp or Eclipse), create a new class file named StringFun.java (optional) 3. You will be filling in code everywhere you see the ellipses (...) in the code. Please follow the instructions and use the Sample Outputs to guide you. 4. Write the Class comment and eauthor and eversion tags 5. Create a variable to store the input for the first name and use a Scanner method to read the value from the Console. 6. Create a variable to store the input for the last name and use a Scanner method to read the value from the Console. 7. Output the welcome message with concatenated full name and the escape strings (see sample output). Use your variables from Steps 5 & 6. 8. Output the standard username of the user using methods of the String class (to get first initial) and concatenation. 9. Output the initials of the user using methods of the String class and concatenation. 10. Declare an integer variable to store the last index of the first name. Use a method of the String class to assign this index to the variable. 11. Declare a String variable to store the switched first and last letters of the first name. 12. Use method(s) of the String class (substring, charAt, length) to assign the switched name to the variable. See 2.5.6 and substring video in iCollege additional videos 13. Output the switched name (see sample output). 14. Submit your code and check the tests and correct any error messages or output formatting issues. ]
expand button
Transcribed Image Text:PART 2: Variables, Constants, and Arithmetic The following are sample runs of the program to help you write your code and format your output: Sample Output 1: Please enter your first name: Alfred Please enter your last name: Johnson W/ Hello Alfred Johnson //\\ The length of your full name is 13 characters Your standard username is: AJohnson Your initials are: A.J. If we switch the first and last characters of your first name, we get: dlfreA ----jGRASP: operation complete. Sample Output 2: Please enter your f£irst name: Jennifer Please enter your last name: Todd W/ Hello Jennifer Todd //\\ The length of your full name is 12 characters Your standard userame is: JTodd Your initials are: J.T. If we switch the first and last characters of your first name, we get: rennifeJ ----jGRASP: operation complete. Instructions for Part 2: 1. Go to the following URL to complete the project: Project 1B 2. If using and IDE (jGrasp or Eclipse), create a new class file named StringFun.java (optional) 3. You will be filling in code everywhere you see the ellipses (...) in the code. Please follow the instructions and use the Sample Outputs to guide you. 4. Write the Class comment and eauthor and eversion tags 5. Create a variable to store the input for the first name and use a Scanner method to read the value from the Console. 6. Create a variable to store the input for the last name and use a Scanner method to read the value from the Console. 7. Output the welcome message with concatenated full name and the escape strings (see sample output). Use your variables from Steps 5 & 6. 8. Output the standard username of the user using methods of the String class (to get first initial) and concatenation. 9. Output the initials of the user using methods of the String class and concatenation. 10. Declare an integer variable to store the last index of the first name. Use a method of the String class to assign this index to the variable. 11. Declare a String variable to store the switched first and last letters of the first name. 12. Use method(s) of the String class (substring, charAt, length) to assign the switched name to the variable. See 2.5.6 and substring video in iCollege additional videos 13. Output the switched name (see sample output). 14. Submit your code and check the tests and correct any error messages or output formatting issues.
Transcribed Image Text:StringFun.java import java.util.Scanner; // Needed for the Scanner class 2 3 /** Add a class comment and @tags 4 5 */ 6 7 public class StringFun { /** * @param args not used 8 9 10 11 12 public static void main(String[] args) { Scanner in = new Scanner(System.in); System.out.print("Please enter your first name: "); 13 14 15 16 17 18 System.out.print("Please enter your last name: "); 19 20 21 //Output the welcome message with name 22 23 24 //Output the length of the name 25 26 27 //Output the username 28 29 30 //Output the initials 31 32 33 //Find and output the first name with switched characters 34 //All Done! } } 35 36 37
Expert Solution
Check Mark
Knowledge Booster
Background pattern image
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
    Recommended textbooks for you
    Text book image
    Database System Concepts
    Computer Science
    ISBN:9780078022159
    Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
    Publisher:McGraw-Hill Education
    Text book image
    Starting Out with Python (4th Edition)
    Computer Science
    ISBN:9780134444321
    Author:Tony Gaddis
    Publisher:PEARSON
    Text book image
    Digital Fundamentals (11th Edition)
    Computer Science
    ISBN:9780132737968
    Author:Thomas L. Floyd
    Publisher:PEARSON
    Text book image
    C How to Program (8th Edition)
    Computer Science
    ISBN:9780133976892
    Author:Paul J. Deitel, Harvey Deitel
    Publisher:PEARSON
    Text book image
    Database Systems: Design, Implementation, & Manag...
    Computer Science
    ISBN:9781337627900
    Author:Carlos Coronel, Steven Morris
    Publisher:Cengage Learning
    Text book image
    Programmable Logic Controllers
    Computer Science
    ISBN:9780073373843
    Author:Frank D. Petruzella
    Publisher:McGraw-Hill Education