SlideShare uma empresa Scribd logo
1 de 1
Baixar para ler offline
Practice 1: Write code that reads in a user's first and last name. Create a username for the user.
The user name is: the first initial of their first name, the first six characters of their last name (or
the whole last name if shorter than six chars long), and a two-digit random number. For example,
my user name might be jmaster53. A user name for Jane Doe might be jdoe81.
Solution
public class FirstNameLastName { public static void main(String[] args) { String input; // The
input line entered by the user. int space; // The location of the space in the input. String
firstName; // The first name, extracted from the input. String lastName; // The last name,
extracted from the input. System.out.println(); System.out.println("Please enter your first name
and last name, separated by a space."); System.out.print("? "); input = TextIO.getln(); space =
input.indexOf(' '); firstName = input.substring(0, space); lastName = input.substring(space+1);
System.out.println("Your first name is " + firstName + ", which has " + firstName.length() +
" characters."); System.out.println("Your last name is " + lastName + ", which has " +
lastName.length() + " characters."); System.out.println("Your initials are " +
firstName.charAt(0) + lastName.charAt(0)); } } ** * This program reads the user's first name
and last name, * separated by a space. It then prints the user's first and * last names separately,
along with the number of characters * in each name. It also prints the user's initials. Note that *
this program will crash if the user's input does not contain * a space. */

Mais conteúdo relacionado

Semelhante a Practice 1- Write code that reads in a user-'s first and last name- Cr.docx

CodeCamp Iasi 10 march 2012 - Practical Groovy
CodeCamp Iasi 10 march 2012 - Practical GroovyCodeCamp Iasi 10 march 2012 - Practical Groovy
CodeCamp Iasi 10 march 2012 - Practical GroovyCodecamp Romania
 
Simple class and object examples in java
Simple class and object examples in javaSimple class and object examples in java
Simple class and object examples in javaHarish Gyanani
 
KOLEJ KOMUNITI - Sijil Aplikasi Perisian Komputer
KOLEJ KOMUNITI - Sijil Aplikasi Perisian KomputerKOLEJ KOMUNITI - Sijil Aplikasi Perisian Komputer
KOLEJ KOMUNITI - Sijil Aplikasi Perisian KomputerAiman Hud
 
Python ProgramDo not use import please. Problem 1 Rolodex (Note .pdf
Python ProgramDo not use import please. Problem 1 Rolodex (Note .pdfPython ProgramDo not use import please. Problem 1 Rolodex (Note .pdf
Python ProgramDo not use import please. Problem 1 Rolodex (Note .pdffortmdu
 
Write a computer program as a Win32 console application in C to proc.pdf
Write a computer program as a Win32 console application in C to proc.pdfWrite a computer program as a Win32 console application in C to proc.pdf
Write a computer program as a Win32 console application in C to proc.pdfsuresh640714
 
Object Oriented Solved Practice Programs C++ Exams
Object Oriented Solved Practice Programs C++ ExamsObject Oriented Solved Practice Programs C++ Exams
Object Oriented Solved Practice Programs C++ ExamsMuhammadTalha436
 
public class Person { private String name; private int age;.pdf
public class Person { private String name; private int age;.pdfpublic class Person { private String name; private int age;.pdf
public class Person { private String name; private int age;.pdfarjuncp10
 
This is my code but not complete, please complete my.pdf
This is my code but not complete, please complete my.pdfThis is my code but not complete, please complete my.pdf
This is my code but not complete, please complete my.pdffashionbigchennai
 
In this project you will define some interfaces, abstract classes, a.pdf
In this project you will define some interfaces, abstract classes, a.pdfIn this project you will define some interfaces, abstract classes, a.pdf
In this project you will define some interfaces, abstract classes, a.pdffathimaoptical
 
Java căn bản - Chapter2
Java căn bản - Chapter2Java căn bản - Chapter2
Java căn bản - Chapter2Vince Vo
 

Semelhante a Practice 1- Write code that reads in a user-'s first and last name- Cr.docx (14)

CodeCamp Iasi 10 march 2012 - Practical Groovy
CodeCamp Iasi 10 march 2012 - Practical GroovyCodeCamp Iasi 10 march 2012 - Practical Groovy
CodeCamp Iasi 10 march 2012 - Practical Groovy
 
Simple class and object examples in java
Simple class and object examples in javaSimple class and object examples in java
Simple class and object examples in java
 
KOLEJ KOMUNITI - Sijil Aplikasi Perisian Komputer
KOLEJ KOMUNITI - Sijil Aplikasi Perisian KomputerKOLEJ KOMUNITI - Sijil Aplikasi Perisian Komputer
KOLEJ KOMUNITI - Sijil Aplikasi Perisian Komputer
 
C# 3.5 Features
C# 3.5 FeaturesC# 3.5 Features
C# 3.5 Features
 
OOP Lab Report.docx
OOP Lab Report.docxOOP Lab Report.docx
OOP Lab Report.docx
 
Rd
RdRd
Rd
 
Java practical
Java practicalJava practical
Java practical
 
Python ProgramDo not use import please. Problem 1 Rolodex (Note .pdf
Python ProgramDo not use import please. Problem 1 Rolodex (Note .pdfPython ProgramDo not use import please. Problem 1 Rolodex (Note .pdf
Python ProgramDo not use import please. Problem 1 Rolodex (Note .pdf
 
Write a computer program as a Win32 console application in C to proc.pdf
Write a computer program as a Win32 console application in C to proc.pdfWrite a computer program as a Win32 console application in C to proc.pdf
Write a computer program as a Win32 console application in C to proc.pdf
 
Object Oriented Solved Practice Programs C++ Exams
Object Oriented Solved Practice Programs C++ ExamsObject Oriented Solved Practice Programs C++ Exams
Object Oriented Solved Practice Programs C++ Exams
 
public class Person { private String name; private int age;.pdf
public class Person { private String name; private int age;.pdfpublic class Person { private String name; private int age;.pdf
public class Person { private String name; private int age;.pdf
 
This is my code but not complete, please complete my.pdf
This is my code but not complete, please complete my.pdfThis is my code but not complete, please complete my.pdf
This is my code but not complete, please complete my.pdf
 
In this project you will define some interfaces, abstract classes, a.pdf
In this project you will define some interfaces, abstract classes, a.pdfIn this project you will define some interfaces, abstract classes, a.pdf
In this project you will define some interfaces, abstract classes, a.pdf
 
Java căn bản - Chapter2
Java căn bản - Chapter2Java căn bản - Chapter2
Java căn bản - Chapter2
 

Mais de helenc18

The total electromagnetic power emitted by the sun is 3-8 x 1026 W- Th.docx
The total electromagnetic power emitted by the sun is 3-8 x 1026 W- Th.docxThe total electromagnetic power emitted by the sun is 3-8 x 1026 W- Th.docx
The total electromagnetic power emitted by the sun is 3-8 x 1026 W- Th.docxhelenc18
 
The Tinsley Company exchanged land that it had been holding for future.docx
The Tinsley Company exchanged land that it had been holding for future.docxThe Tinsley Company exchanged land that it had been holding for future.docx
The Tinsley Company exchanged land that it had been holding for future.docxhelenc18
 
The State of Rhode Island publishes its budget and the various support.docx
The State of Rhode Island publishes its budget and the various support.docxThe State of Rhode Island publishes its budget and the various support.docx
The State of Rhode Island publishes its budget and the various support.docxhelenc18
 
The SRLY rules for consolidated tax returns are designed to keep corpo.docx
The SRLY rules for consolidated tax returns are designed to keep corpo.docxThe SRLY rules for consolidated tax returns are designed to keep corpo.docx
The SRLY rules for consolidated tax returns are designed to keep corpo.docxhelenc18
 
The sound strikes the cantina walls and bounces off at the same angle.docx
The sound strikes the cantina walls and bounces off at the same angle.docxThe sound strikes the cantina walls and bounces off at the same angle.docx
The sound strikes the cantina walls and bounces off at the same angle.docxhelenc18
 
The six platforms below are initially at rest in deep space- The indic.docx
The six platforms below are initially at rest in deep space- The indic.docxThe six platforms below are initially at rest in deep space- The indic.docx
The six platforms below are initially at rest in deep space- The indic.docxhelenc18
 
The rise of various digital communication methods in the past decade h.docx
The rise of various digital communication methods in the past decade h.docxThe rise of various digital communication methods in the past decade h.docx
The rise of various digital communication methods in the past decade h.docxhelenc18
 
The reason that the increase in population growth in the 19th and 20th.docx
The reason that the increase in population growth in the 19th and 20th.docxThe reason that the increase in population growth in the 19th and 20th.docx
The reason that the increase in population growth in the 19th and 20th.docxhelenc18
 
The sale of stock and the sale of bonds are reported as financing acti.docx
The sale of stock and the sale of bonds are reported as financing acti.docxThe sale of stock and the sale of bonds are reported as financing acti.docx
The sale of stock and the sale of bonds are reported as financing acti.docxhelenc18
 
Precipitation volumetric analysis involves formation reactions of solu.docx
Precipitation volumetric analysis involves formation reactions of solu.docxPrecipitation volumetric analysis involves formation reactions of solu.docx
Precipitation volumetric analysis involves formation reactions of solu.docxhelenc18
 
POST-LAB QUESTIONS 1- Based on your observations- what aimilarities di.docx
POST-LAB QUESTIONS 1- Based on your observations- what aimilarities di.docxPOST-LAB QUESTIONS 1- Based on your observations- what aimilarities di.docx
POST-LAB QUESTIONS 1- Based on your observations- what aimilarities di.docxhelenc18
 
Portman Corporation has retained earnings of $675-000 at January 1- 20.docx
Portman Corporation has retained earnings of $675-000 at January 1- 20.docxPortman Corporation has retained earnings of $675-000 at January 1- 20.docx
Portman Corporation has retained earnings of $675-000 at January 1- 20.docxhelenc18
 
Please write it in Microsoft Word- Not in handwritten form- I-'ll give.docx
Please write it in Microsoft Word- Not in handwritten form- I-'ll give.docxPlease write it in Microsoft Word- Not in handwritten form- I-'ll give.docx
Please write it in Microsoft Word- Not in handwritten form- I-'ll give.docxhelenc18
 
please write carefully and explain clearly- Thank you-SolutionKsp of C.docx
please write carefully and explain clearly- Thank you-SolutionKsp of C.docxplease write carefully and explain clearly- Thank you-SolutionKsp of C.docx
please write carefully and explain clearly- Thank you-SolutionKsp of C.docxhelenc18
 
Prioritize the three themes of integrated solid waste management- 1^st.docx
Prioritize the three themes of integrated solid waste management- 1^st.docxPrioritize the three themes of integrated solid waste management- 1^st.docx
Prioritize the three themes of integrated solid waste management- 1^st.docxhelenc18
 
present synchronized savage code while (1) { getServingFromPot ()- ea.docx
present synchronized savage code while (1) {  getServingFromPot ()- ea.docxpresent synchronized savage code while (1) {  getServingFromPot ()- ea.docx
present synchronized savage code while (1) { getServingFromPot ()- ea.docxhelenc18
 
Prepare general journal entries to record the following transactions f.docx
Prepare general journal entries to record the following transactions f.docxPrepare general journal entries to record the following transactions f.docx
Prepare general journal entries to record the following transactions f.docxhelenc18
 
Prepare functional specifications for the company-'s use of the Web an.docx
Prepare functional specifications for the company-'s use of the Web an.docxPrepare functional specifications for the company-'s use of the Web an.docx
Prepare functional specifications for the company-'s use of the Web an.docxhelenc18
 
Prepare a 3 to 5 paragraph briefing statement which explains the 3 mos.docx
Prepare a 3 to 5 paragraph briefing statement which explains the 3 mos.docxPrepare a 3 to 5 paragraph briefing statement which explains the 3 mos.docx
Prepare a 3 to 5 paragraph briefing statement which explains the 3 mos.docxhelenc18
 

Mais de helenc18 (19)

The total electromagnetic power emitted by the sun is 3-8 x 1026 W- Th.docx
The total electromagnetic power emitted by the sun is 3-8 x 1026 W- Th.docxThe total electromagnetic power emitted by the sun is 3-8 x 1026 W- Th.docx
The total electromagnetic power emitted by the sun is 3-8 x 1026 W- Th.docx
 
The Tinsley Company exchanged land that it had been holding for future.docx
The Tinsley Company exchanged land that it had been holding for future.docxThe Tinsley Company exchanged land that it had been holding for future.docx
The Tinsley Company exchanged land that it had been holding for future.docx
 
The State of Rhode Island publishes its budget and the various support.docx
The State of Rhode Island publishes its budget and the various support.docxThe State of Rhode Island publishes its budget and the various support.docx
The State of Rhode Island publishes its budget and the various support.docx
 
The SRLY rules for consolidated tax returns are designed to keep corpo.docx
The SRLY rules for consolidated tax returns are designed to keep corpo.docxThe SRLY rules for consolidated tax returns are designed to keep corpo.docx
The SRLY rules for consolidated tax returns are designed to keep corpo.docx
 
The sound strikes the cantina walls and bounces off at the same angle.docx
The sound strikes the cantina walls and bounces off at the same angle.docxThe sound strikes the cantina walls and bounces off at the same angle.docx
The sound strikes the cantina walls and bounces off at the same angle.docx
 
The six platforms below are initially at rest in deep space- The indic.docx
The six platforms below are initially at rest in deep space- The indic.docxThe six platforms below are initially at rest in deep space- The indic.docx
The six platforms below are initially at rest in deep space- The indic.docx
 
The rise of various digital communication methods in the past decade h.docx
The rise of various digital communication methods in the past decade h.docxThe rise of various digital communication methods in the past decade h.docx
The rise of various digital communication methods in the past decade h.docx
 
The reason that the increase in population growth in the 19th and 20th.docx
The reason that the increase in population growth in the 19th and 20th.docxThe reason that the increase in population growth in the 19th and 20th.docx
The reason that the increase in population growth in the 19th and 20th.docx
 
The sale of stock and the sale of bonds are reported as financing acti.docx
The sale of stock and the sale of bonds are reported as financing acti.docxThe sale of stock and the sale of bonds are reported as financing acti.docx
The sale of stock and the sale of bonds are reported as financing acti.docx
 
Precipitation volumetric analysis involves formation reactions of solu.docx
Precipitation volumetric analysis involves formation reactions of solu.docxPrecipitation volumetric analysis involves formation reactions of solu.docx
Precipitation volumetric analysis involves formation reactions of solu.docx
 
POST-LAB QUESTIONS 1- Based on your observations- what aimilarities di.docx
POST-LAB QUESTIONS 1- Based on your observations- what aimilarities di.docxPOST-LAB QUESTIONS 1- Based on your observations- what aimilarities di.docx
POST-LAB QUESTIONS 1- Based on your observations- what aimilarities di.docx
 
Portman Corporation has retained earnings of $675-000 at January 1- 20.docx
Portman Corporation has retained earnings of $675-000 at January 1- 20.docxPortman Corporation has retained earnings of $675-000 at January 1- 20.docx
Portman Corporation has retained earnings of $675-000 at January 1- 20.docx
 
Please write it in Microsoft Word- Not in handwritten form- I-'ll give.docx
Please write it in Microsoft Word- Not in handwritten form- I-'ll give.docxPlease write it in Microsoft Word- Not in handwritten form- I-'ll give.docx
Please write it in Microsoft Word- Not in handwritten form- I-'ll give.docx
 
please write carefully and explain clearly- Thank you-SolutionKsp of C.docx
please write carefully and explain clearly- Thank you-SolutionKsp of C.docxplease write carefully and explain clearly- Thank you-SolutionKsp of C.docx
please write carefully and explain clearly- Thank you-SolutionKsp of C.docx
 
Prioritize the three themes of integrated solid waste management- 1^st.docx
Prioritize the three themes of integrated solid waste management- 1^st.docxPrioritize the three themes of integrated solid waste management- 1^st.docx
Prioritize the three themes of integrated solid waste management- 1^st.docx
 
present synchronized savage code while (1) { getServingFromPot ()- ea.docx
present synchronized savage code while (1) {  getServingFromPot ()- ea.docxpresent synchronized savage code while (1) {  getServingFromPot ()- ea.docx
present synchronized savage code while (1) { getServingFromPot ()- ea.docx
 
Prepare general journal entries to record the following transactions f.docx
Prepare general journal entries to record the following transactions f.docxPrepare general journal entries to record the following transactions f.docx
Prepare general journal entries to record the following transactions f.docx
 
Prepare functional specifications for the company-'s use of the Web an.docx
Prepare functional specifications for the company-'s use of the Web an.docxPrepare functional specifications for the company-'s use of the Web an.docx
Prepare functional specifications for the company-'s use of the Web an.docx
 
Prepare a 3 to 5 paragraph briefing statement which explains the 3 mos.docx
Prepare a 3 to 5 paragraph briefing statement which explains the 3 mos.docxPrepare a 3 to 5 paragraph briefing statement which explains the 3 mos.docx
Prepare a 3 to 5 paragraph briefing statement which explains the 3 mos.docx
 

Último

BIOCHEMISTRY-CARBOHYDRATE METABOLISM CHAPTER 2.pptx
BIOCHEMISTRY-CARBOHYDRATE METABOLISM CHAPTER 2.pptxBIOCHEMISTRY-CARBOHYDRATE METABOLISM CHAPTER 2.pptx
BIOCHEMISTRY-CARBOHYDRATE METABOLISM CHAPTER 2.pptxSayali Powar
 
Geoffrey Chaucer Works II UGC NET JRF TGT PGT MA PHD Entrance Exam II History...
Geoffrey Chaucer Works II UGC NET JRF TGT PGT MA PHD Entrance Exam II History...Geoffrey Chaucer Works II UGC NET JRF TGT PGT MA PHD Entrance Exam II History...
Geoffrey Chaucer Works II UGC NET JRF TGT PGT MA PHD Entrance Exam II History...DrVipulVKapoor
 
Objectives n learning outcoms - MD 20240404.pptx
Objectives n learning outcoms - MD 20240404.pptxObjectives n learning outcoms - MD 20240404.pptx
Objectives n learning outcoms - MD 20240404.pptxMadhavi Dharankar
 
6 ways Samsung’s Interactive Display powered by Android changes the classroom
6 ways Samsung’s Interactive Display powered by Android changes the classroom6 ways Samsung’s Interactive Display powered by Android changes the classroom
6 ways Samsung’s Interactive Display powered by Android changes the classroomSamsung Business USA
 
physiotherapy in Acne condition.....pptx
physiotherapy in Acne condition.....pptxphysiotherapy in Acne condition.....pptx
physiotherapy in Acne condition.....pptxAneriPatwari
 
CLASSIFICATION OF ANTI - CANCER DRUGS.pptx
CLASSIFICATION OF ANTI - CANCER DRUGS.pptxCLASSIFICATION OF ANTI - CANCER DRUGS.pptx
CLASSIFICATION OF ANTI - CANCER DRUGS.pptxAnupam32727
 
An Overview of the Calendar App in Odoo 17 ERP
An Overview of the Calendar App in Odoo 17 ERPAn Overview of the Calendar App in Odoo 17 ERP
An Overview of the Calendar App in Odoo 17 ERPCeline George
 
Unraveling Hypertext_ Analyzing Postmodern Elements in Literature.pptx
Unraveling Hypertext_ Analyzing  Postmodern Elements in  Literature.pptxUnraveling Hypertext_ Analyzing  Postmodern Elements in  Literature.pptx
Unraveling Hypertext_ Analyzing Postmodern Elements in Literature.pptxDhatriParmar
 
PART 1 - CHAPTER 1 - CELL THE FUNDAMENTAL UNIT OF LIFE
PART 1 - CHAPTER 1 - CELL THE FUNDAMENTAL UNIT OF LIFEPART 1 - CHAPTER 1 - CELL THE FUNDAMENTAL UNIT OF LIFE
PART 1 - CHAPTER 1 - CELL THE FUNDAMENTAL UNIT OF LIFEMISSRITIMABIOLOGYEXP
 
4.9.24 Social Capital and Social Exclusion.pptx
4.9.24 Social Capital and Social Exclusion.pptx4.9.24 Social Capital and Social Exclusion.pptx
4.9.24 Social Capital and Social Exclusion.pptxmary850239
 
ICS 2208 Lecture Slide Notes for Topic 6
ICS 2208 Lecture Slide Notes for Topic 6ICS 2208 Lecture Slide Notes for Topic 6
ICS 2208 Lecture Slide Notes for Topic 6Vanessa Camilleri
 
4.11.24 Poverty and Inequality in America.pptx
4.11.24 Poverty and Inequality in America.pptx4.11.24 Poverty and Inequality in America.pptx
4.11.24 Poverty and Inequality in America.pptxmary850239
 
4.9.24 School Desegregation in Boston.pptx
4.9.24 School Desegregation in Boston.pptx4.9.24 School Desegregation in Boston.pptx
4.9.24 School Desegregation in Boston.pptxmary850239
 
Decoding the Tweet _ Practical Criticism in the Age of Hashtag.pptx
Decoding the Tweet _ Practical Criticism in the Age of Hashtag.pptxDecoding the Tweet _ Practical Criticism in the Age of Hashtag.pptx
Decoding the Tweet _ Practical Criticism in the Age of Hashtag.pptxDhatriParmar
 
Shark introduction Morphology and its behaviour characteristics
Shark introduction Morphology and its behaviour characteristicsShark introduction Morphology and its behaviour characteristics
Shark introduction Morphology and its behaviour characteristicsArubSultan
 
BÀI TẬP BỔ TRỢ TIẾNG ANH 8 - I-LEARN SMART WORLD - CẢ NĂM - CÓ FILE NGHE (BẢN...
BÀI TẬP BỔ TRỢ TIẾNG ANH 8 - I-LEARN SMART WORLD - CẢ NĂM - CÓ FILE NGHE (BẢN...BÀI TẬP BỔ TRỢ TIẾNG ANH 8 - I-LEARN SMART WORLD - CẢ NĂM - CÓ FILE NGHE (BẢN...
BÀI TẬP BỔ TRỢ TIẾNG ANH 8 - I-LEARN SMART WORLD - CẢ NĂM - CÓ FILE NGHE (BẢN...Nguyen Thanh Tu Collection
 

Último (20)

BIOCHEMISTRY-CARBOHYDRATE METABOLISM CHAPTER 2.pptx
BIOCHEMISTRY-CARBOHYDRATE METABOLISM CHAPTER 2.pptxBIOCHEMISTRY-CARBOHYDRATE METABOLISM CHAPTER 2.pptx
BIOCHEMISTRY-CARBOHYDRATE METABOLISM CHAPTER 2.pptx
 
Geoffrey Chaucer Works II UGC NET JRF TGT PGT MA PHD Entrance Exam II History...
Geoffrey Chaucer Works II UGC NET JRF TGT PGT MA PHD Entrance Exam II History...Geoffrey Chaucer Works II UGC NET JRF TGT PGT MA PHD Entrance Exam II History...
Geoffrey Chaucer Works II UGC NET JRF TGT PGT MA PHD Entrance Exam II History...
 
Objectives n learning outcoms - MD 20240404.pptx
Objectives n learning outcoms - MD 20240404.pptxObjectives n learning outcoms - MD 20240404.pptx
Objectives n learning outcoms - MD 20240404.pptx
 
6 ways Samsung’s Interactive Display powered by Android changes the classroom
6 ways Samsung’s Interactive Display powered by Android changes the classroom6 ways Samsung’s Interactive Display powered by Android changes the classroom
6 ways Samsung’s Interactive Display powered by Android changes the classroom
 
Plagiarism,forms,understand about plagiarism,avoid plagiarism,key significanc...
Plagiarism,forms,understand about plagiarism,avoid plagiarism,key significanc...Plagiarism,forms,understand about plagiarism,avoid plagiarism,key significanc...
Plagiarism,forms,understand about plagiarism,avoid plagiarism,key significanc...
 
prashanth updated resume 2024 for Teaching Profession
prashanth updated resume 2024 for Teaching Professionprashanth updated resume 2024 for Teaching Profession
prashanth updated resume 2024 for Teaching Profession
 
physiotherapy in Acne condition.....pptx
physiotherapy in Acne condition.....pptxphysiotherapy in Acne condition.....pptx
physiotherapy in Acne condition.....pptx
 
Mattingly "AI & Prompt Design" - Introduction to Machine Learning"
Mattingly "AI & Prompt Design" - Introduction to Machine Learning"Mattingly "AI & Prompt Design" - Introduction to Machine Learning"
Mattingly "AI & Prompt Design" - Introduction to Machine Learning"
 
CLASSIFICATION OF ANTI - CANCER DRUGS.pptx
CLASSIFICATION OF ANTI - CANCER DRUGS.pptxCLASSIFICATION OF ANTI - CANCER DRUGS.pptx
CLASSIFICATION OF ANTI - CANCER DRUGS.pptx
 
An Overview of the Calendar App in Odoo 17 ERP
An Overview of the Calendar App in Odoo 17 ERPAn Overview of the Calendar App in Odoo 17 ERP
An Overview of the Calendar App in Odoo 17 ERP
 
Unraveling Hypertext_ Analyzing Postmodern Elements in Literature.pptx
Unraveling Hypertext_ Analyzing  Postmodern Elements in  Literature.pptxUnraveling Hypertext_ Analyzing  Postmodern Elements in  Literature.pptx
Unraveling Hypertext_ Analyzing Postmodern Elements in Literature.pptx
 
Chi-Square Test Non Parametric Test Categorical Variable
Chi-Square Test Non Parametric Test Categorical VariableChi-Square Test Non Parametric Test Categorical Variable
Chi-Square Test Non Parametric Test Categorical Variable
 
PART 1 - CHAPTER 1 - CELL THE FUNDAMENTAL UNIT OF LIFE
PART 1 - CHAPTER 1 - CELL THE FUNDAMENTAL UNIT OF LIFEPART 1 - CHAPTER 1 - CELL THE FUNDAMENTAL UNIT OF LIFE
PART 1 - CHAPTER 1 - CELL THE FUNDAMENTAL UNIT OF LIFE
 
4.9.24 Social Capital and Social Exclusion.pptx
4.9.24 Social Capital and Social Exclusion.pptx4.9.24 Social Capital and Social Exclusion.pptx
4.9.24 Social Capital and Social Exclusion.pptx
 
ICS 2208 Lecture Slide Notes for Topic 6
ICS 2208 Lecture Slide Notes for Topic 6ICS 2208 Lecture Slide Notes for Topic 6
ICS 2208 Lecture Slide Notes for Topic 6
 
4.11.24 Poverty and Inequality in America.pptx
4.11.24 Poverty and Inequality in America.pptx4.11.24 Poverty and Inequality in America.pptx
4.11.24 Poverty and Inequality in America.pptx
 
4.9.24 School Desegregation in Boston.pptx
4.9.24 School Desegregation in Boston.pptx4.9.24 School Desegregation in Boston.pptx
4.9.24 School Desegregation in Boston.pptx
 
Decoding the Tweet _ Practical Criticism in the Age of Hashtag.pptx
Decoding the Tweet _ Practical Criticism in the Age of Hashtag.pptxDecoding the Tweet _ Practical Criticism in the Age of Hashtag.pptx
Decoding the Tweet _ Practical Criticism in the Age of Hashtag.pptx
 
Shark introduction Morphology and its behaviour characteristics
Shark introduction Morphology and its behaviour characteristicsShark introduction Morphology and its behaviour characteristics
Shark introduction Morphology and its behaviour characteristics
 
BÀI TẬP BỔ TRỢ TIẾNG ANH 8 - I-LEARN SMART WORLD - CẢ NĂM - CÓ FILE NGHE (BẢN...
BÀI TẬP BỔ TRỢ TIẾNG ANH 8 - I-LEARN SMART WORLD - CẢ NĂM - CÓ FILE NGHE (BẢN...BÀI TẬP BỔ TRỢ TIẾNG ANH 8 - I-LEARN SMART WORLD - CẢ NĂM - CÓ FILE NGHE (BẢN...
BÀI TẬP BỔ TRỢ TIẾNG ANH 8 - I-LEARN SMART WORLD - CẢ NĂM - CÓ FILE NGHE (BẢN...
 

Practice 1- Write code that reads in a user-'s first and last name- Cr.docx

  • 1. Practice 1: Write code that reads in a user's first and last name. Create a username for the user. The user name is: the first initial of their first name, the first six characters of their last name (or the whole last name if shorter than six chars long), and a two-digit random number. For example, my user name might be jmaster53. A user name for Jane Doe might be jdoe81. Solution public class FirstNameLastName { public static void main(String[] args) { String input; // The input line entered by the user. int space; // The location of the space in the input. String firstName; // The first name, extracted from the input. String lastName; // The last name, extracted from the input. System.out.println(); System.out.println("Please enter your first name and last name, separated by a space."); System.out.print("? "); input = TextIO.getln(); space = input.indexOf(' '); firstName = input.substring(0, space); lastName = input.substring(space+1); System.out.println("Your first name is " + firstName + ", which has " + firstName.length() + " characters."); System.out.println("Your last name is " + lastName + ", which has " + lastName.length() + " characters."); System.out.println("Your initials are " + firstName.charAt(0) + lastName.charAt(0)); } } ** * This program reads the user's first name and last name, * separated by a space. It then prints the user's first and * last names separately, along with the number of characters * in each name. It also prints the user's initials. Note that * this program will crash if the user's input does not contain * a space. */