Database System Concepts
Database System Concepts
7th Edition
ISBN: 9780078022159
Author: Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher: McGraw-Hill Education
expand_more
expand_more
format_list_bulleted
Bartleby Related Questions Icon
Related questions
bartleby
Concept explainers
Question
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 MarkThis question has been solved!
Explore an expertly crafted, step-by-step solution for a thorough understanding of key concepts.
bartleby
This is a popular solution
bartleby
Trending nowThis is a popular solution!
bartleby
Step by stepSolved in 3 steps with 2 images
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
- MUST BE IN PYTHON PROGRAMMING CODE!!!!! NO C++ or Java!! Directions: Design a program with a loop that lets the user enter a series of names (in no particular order). After the final person’s name has been entered, the program should display the name that is first alphabetically and the name that is last alphabetically. For example, if the user enters the names Kristin, Joel, Adam, Beth, Zeb, and Chris, the program would display Adam and Zeb. Additional requirements: Note that the possible set of input values can include negative, 0, or positive values, but not the sentinel value of -99. DESIGN HINT: • When determining the largest (or smallest) value in a set of numbers, remember to use variables to keep track of the current largest (or smallest) number found thus far. These variables can then be used as a comparison to each subsequent input number to see if the new number is larger (or smaller) than the current largest (or smallest) number and updated appropriately. At the end of all...arrow_forwardAC that adds two very large integers entered by the user on the keyboard write the program. Very large integers represent standard data types (long int, double, etc.) you cannot collect it using. Reading and adding numbers from the keyboard as a string As you learned the process in elementary school, starting from the units digit, you can add the mutual numbers one by one. you must realize by collecting. The numbers that the user has entered into a different number of digits. In order to have it, your program should work. The output of your program is the example below should be compatible with the program outputs. In the program output, as in the addition operation the numbers and the total should be written one under the other, with the mutual digits aligned. Sample program output - 1: First number: 111111111111111111111111 Second number: 999999999 11111111111u111. 9999999999 1111111111111120000000000 Sample program output - 2: First number: 11 Second number:...arrow_forwardPython code of part b pleasearrow_forward
- Python programming This example misses indentations, rewrite the code. Insert the missing indentation to make the code correct: if 1 == 1:print("One is equal to one!") --------------------------------------------------------------------------------------------------------------------------- Print "Python" if x is not equal to y. x = 2y = 10_____________print("Python") Thank you so much!!arrow_forwardPython Programming Only (PLEASE INCLUDE INPUT VALIDATION IF NEEDED) Write a function named maximum that accepts two integer values as arguments and returns the value that is the greater of the two. For example, if two numbers are one big and one small the function should return the bigger number. Use the function in a program that prompts the user to enter two integer values. The program should display the value that is the greater of the two.arrow_forwardWhat is the Pseudocode?arrow_forward
arrow_back_ios
arrow_forward_ios
Recommended textbooks for you
- Text book imageDatabase System ConceptsComputer ScienceISBN:9780078022159Author:Abraham Silberschatz Professor, Henry F. Korth, S. SudarshanPublisher:McGraw-Hill EducationText book imageStarting Out with Python (4th Edition)Computer ScienceISBN:9780134444321Author:Tony GaddisPublisher:PEARSONText book imageDigital Fundamentals (11th Edition)Computer ScienceISBN:9780132737968Author:Thomas L. FloydPublisher:PEARSON
- Text book imageC How to Program (8th Edition)Computer ScienceISBN:9780133976892Author:Paul J. Deitel, Harvey DeitelPublisher:PEARSONText book imageDatabase Systems: Design, Implementation, & Manag...Computer ScienceISBN:9781337627900Author:Carlos Coronel, Steven MorrisPublisher:Cengage LearningText book imageProgrammable Logic ControllersComputer ScienceISBN:9780073373843Author:Frank D. PetruzellaPublisher:McGraw-Hill Education
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