SlideShare a Scribd company logo
1 of 2
Download to read offline
write a program that: Asks the user to enter a string that contains at least three letters. Stores that
number into a variable called s. Creates a variable called "ending", and sets it equal to the string
that contains the last three letters of s. Here you should think carefully how to do this, you may
need more than one line of code to achieve this type (hint: to figure out where the last three
letters are, you need to know the length of the string). Prints out the value of ending, using
EXACTLY the same format as shown below. For example: if the user enters the string
"Saturday", your program output should look EXACTLY like this: Please enter a string, at least
3 letters long: Saturday The last three letters are day.
Solution
StringTest1.java
import java.util.Scanner;
public class StringTest1 {
/**
* @param args
*/
public static void main(String[] args) {
// TODO Auto-generated method stub
Scanner scan = new Scanner(System.in);
System.out.println("Please enter a string, at least 3 letters long: ");
String s = scan.next();
String ending = s.substring(s.length()-3, s.length());
System.out.println("The last three letters are "+ending);
}
}
Output:
Please enter a string, at least 3 letters long:
Saturday
The last three letters are day

More Related Content

Similar to write a program that- Asks the user to enter a string that contains at (1).docx

Practical java
Practical javaPractical java
Practical javanirmit
 
Write a module called Largest that takes in 3 values as parameters- Th.docx
Write a module called Largest that takes in 3 values as parameters- Th.docxWrite a module called Largest that takes in 3 values as parameters- Th.docx
Write a module called Largest that takes in 3 values as parameters- Th.docxlez31palka
 
Write a program that asks a user to enter in two words- The program th.docx
Write a program that asks a user to enter in two words- The program th.docxWrite a program that asks a user to enter in two words- The program th.docx
Write a program that asks a user to enter in two words- The program th.docxlez31palka
 
Python assignment 4
Python assignment 4Python assignment 4
Python assignment 4ANILBIKAS
 
(1) Write a C program that includes a function called lobster() that.docx
(1) Write a C program that includes a function called lobster() that.docx(1) Write a C program that includes a function called lobster() that.docx
(1) Write a C program that includes a function called lobster() that.docxjoney4
 
Base code- Note- base code file is attached to help you get started! -.docx
Base code- Note- base code file is attached to help you get started! -.docxBase code- Note- base code file is attached to help you get started! -.docx
Base code- Note- base code file is attached to help you get started! -.docxJoeaP9Morgant
 
Summary In this lab- you complete a prewritten Python program that com.docx
Summary In this lab- you complete a prewritten Python program that com.docxSummary In this lab- you complete a prewritten Python program that com.docx
Summary In this lab- you complete a prewritten Python program that com.docxStewartt0kJohnstonh
 
Write and test the following function that accepts a string of one wo.docx
 Write and test the following function that accepts a string of one wo.docx Write and test the following function that accepts a string of one wo.docx
Write and test the following function that accepts a string of one wo.docxajoy21
 
Write and test the following function that accepts a string of one wor.docx
Write and test the following function that accepts a string of one wor.docxWrite and test the following function that accepts a string of one wor.docx
Write and test the following function that accepts a string of one wor.docxnoreendchesterton753
 
2. Word CounterWrite a method that accepts a String object as an a.pdf
2. Word CounterWrite a method that accepts a String object as an a.pdf2. Word CounterWrite a method that accepts a String object as an a.pdf
2. Word CounterWrite a method that accepts a String object as an a.pdfnishadvtky
 
#write java programWrite a method called evenNumbers that accepts .docx
#write java programWrite a method called evenNumbers that accepts .docx#write java programWrite a method called evenNumbers that accepts .docx
#write java programWrite a method called evenNumbers that accepts .docxajoy21
 
IN JAVA Write a method called deDup() following this pattern public.pdf
IN JAVA Write a method called deDup() following this pattern public.pdfIN JAVA Write a method called deDup() following this pattern public.pdf
IN JAVA Write a method called deDup() following this pattern public.pdfsiva009113
 
The ProgramYour program will be a line editor. A line editor is an.pdf
The ProgramYour program will be a line editor. A line editor is an.pdfThe ProgramYour program will be a line editor. A line editor is an.pdf
The ProgramYour program will be a line editor. A line editor is an.pdf4babies2010
 
Your task is to write methods for a program that analyzes an arbitrary.pdf
Your task is to write methods for a program that analyzes an arbitrary.pdfYour task is to write methods for a program that analyzes an arbitrary.pdf
Your task is to write methods for a program that analyzes an arbitrary.pdfDavidpzCSkinnerh
 
Instructions- Write a program that will read in 3 integers from a file.pdf
Instructions- Write a program that will read in 3 integers from a file.pdfInstructions- Write a program that will read in 3 integers from a file.pdf
Instructions- Write a program that will read in 3 integers from a file.pdfColinjSWDavidsonn
 
Using the string commands introduced in Lab 2- write a Python program.docx
Using the string commands introduced in Lab 2- write a Python program.docxUsing the string commands introduced in Lab 2- write a Python program.docx
Using the string commands introduced in Lab 2- write a Python program.docxStewartZQKChapmana
 
Ee java lab assignment 3
Ee java lab assignment 3Ee java lab assignment 3
Ee java lab assignment 3Kuntal Bhowmick
 
NOTE- THIS MUST BE CODED IN C++ Create programs using Visual C++ to so.pdf
NOTE- THIS MUST BE CODED IN C++ Create programs using Visual C++ to so.pdfNOTE- THIS MUST BE CODED IN C++ Create programs using Visual C++ to so.pdf
NOTE- THIS MUST BE CODED IN C++ Create programs using Visual C++ to so.pdfEdwardw5nSlaterl
 

Similar to write a program that- Asks the user to enter a string that contains at (1).docx (20)

Practical java
Practical javaPractical java
Practical java
 
Write a module called Largest that takes in 3 values as parameters- Th.docx
Write a module called Largest that takes in 3 values as parameters- Th.docxWrite a module called Largest that takes in 3 values as parameters- Th.docx
Write a module called Largest that takes in 3 values as parameters- Th.docx
 
Write a program that asks a user to enter in two words- The program th.docx
Write a program that asks a user to enter in two words- The program th.docxWrite a program that asks a user to enter in two words- The program th.docx
Write a program that asks a user to enter in two words- The program th.docx
 
Python assignment 4
Python assignment 4Python assignment 4
Python assignment 4
 
(1) Write a C program that includes a function called lobster() that.docx
(1) Write a C program that includes a function called lobster() that.docx(1) Write a C program that includes a function called lobster() that.docx
(1) Write a C program that includes a function called lobster() that.docx
 
Base code- Note- base code file is attached to help you get started! -.docx
Base code- Note- base code file is attached to help you get started! -.docxBase code- Note- base code file is attached to help you get started! -.docx
Base code- Note- base code file is attached to help you get started! -.docx
 
Summary In this lab- you complete a prewritten Python program that com.docx
Summary In this lab- you complete a prewritten Python program that com.docxSummary In this lab- you complete a prewritten Python program that com.docx
Summary In this lab- you complete a prewritten Python program that com.docx
 
Program
ProgramProgram
Program
 
Write and test the following function that accepts a string of one wo.docx
 Write and test the following function that accepts a string of one wo.docx Write and test the following function that accepts a string of one wo.docx
Write and test the following function that accepts a string of one wo.docx
 
Write and test the following function that accepts a string of one wor.docx
Write and test the following function that accepts a string of one wor.docxWrite and test the following function that accepts a string of one wor.docx
Write and test the following function that accepts a string of one wor.docx
 
05 c++-strings
05 c++-strings05 c++-strings
05 c++-strings
 
2. Word CounterWrite a method that accepts a String object as an a.pdf
2. Word CounterWrite a method that accepts a String object as an a.pdf2. Word CounterWrite a method that accepts a String object as an a.pdf
2. Word CounterWrite a method that accepts a String object as an a.pdf
 
#write java programWrite a method called evenNumbers that accepts .docx
#write java programWrite a method called evenNumbers that accepts .docx#write java programWrite a method called evenNumbers that accepts .docx
#write java programWrite a method called evenNumbers that accepts .docx
 
IN JAVA Write a method called deDup() following this pattern public.pdf
IN JAVA Write a method called deDup() following this pattern public.pdfIN JAVA Write a method called deDup() following this pattern public.pdf
IN JAVA Write a method called deDup() following this pattern public.pdf
 
The ProgramYour program will be a line editor. A line editor is an.pdf
The ProgramYour program will be a line editor. A line editor is an.pdfThe ProgramYour program will be a line editor. A line editor is an.pdf
The ProgramYour program will be a line editor. A line editor is an.pdf
 
Your task is to write methods for a program that analyzes an arbitrary.pdf
Your task is to write methods for a program that analyzes an arbitrary.pdfYour task is to write methods for a program that analyzes an arbitrary.pdf
Your task is to write methods for a program that analyzes an arbitrary.pdf
 
Instructions- Write a program that will read in 3 integers from a file.pdf
Instructions- Write a program that will read in 3 integers from a file.pdfInstructions- Write a program that will read in 3 integers from a file.pdf
Instructions- Write a program that will read in 3 integers from a file.pdf
 
Using the string commands introduced in Lab 2- write a Python program.docx
Using the string commands introduced in Lab 2- write a Python program.docxUsing the string commands introduced in Lab 2- write a Python program.docx
Using the string commands introduced in Lab 2- write a Python program.docx
 
Ee java lab assignment 3
Ee java lab assignment 3Ee java lab assignment 3
Ee java lab assignment 3
 
NOTE- THIS MUST BE CODED IN C++ Create programs using Visual C++ to so.pdf
NOTE- THIS MUST BE CODED IN C++ Create programs using Visual C++ to so.pdfNOTE- THIS MUST BE CODED IN C++ Create programs using Visual C++ to so.pdf
NOTE- THIS MUST BE CODED IN C++ Create programs using Visual C++ to so.pdf
 

More from lez31palka

Cuilumber Candle Supply makes candles- The sales mix (as a percmtage o.docx
Cuilumber Candle Supply makes candles- The sales mix (as a percmtage o.docxCuilumber Candle Supply makes candles- The sales mix (as a percmtage o.docx
Cuilumber Candle Supply makes candles- The sales mix (as a percmtage o.docxlez31palka
 
CT4-1 The financial statements of Apple Inc- are presented in Appendix.docx
CT4-1 The financial statements of Apple Inc- are presented in Appendix.docxCT4-1 The financial statements of Apple Inc- are presented in Appendix.docx
CT4-1 The financial statements of Apple Inc- are presented in Appendix.docxlez31palka
 
Cu are responsible for planning the parking needed for a new 2-56 - un.docx
Cu are responsible for planning the parking needed for a new 2-56 - un.docxCu are responsible for planning the parking needed for a new 2-56 - un.docx
Cu are responsible for planning the parking needed for a new 2-56 - un.docxlez31palka
 
CSCI 4617 (jblearning Cloud lab) Creating a Security Awareness Policy.docx
CSCI 4617 (jblearning Cloud lab) Creating a Security Awareness Policy.docxCSCI 4617 (jblearning Cloud lab) Creating a Security Awareness Policy.docx
CSCI 4617 (jblearning Cloud lab) Creating a Security Awareness Policy.docxlez31palka
 
ctivity-Based Product Costing 2oberts Company produces two weed eaters.docx
ctivity-Based Product Costing 2oberts Company produces two weed eaters.docxctivity-Based Product Costing 2oberts Company produces two weed eaters.docx
ctivity-Based Product Costing 2oberts Company produces two weed eaters.docxlez31palka
 
CSC 3020 Introduction to Cybersecurity Lab Assignment 2 CAE-CD Knowled.docx
CSC 3020 Introduction to Cybersecurity Lab Assignment 2 CAE-CD Knowled.docxCSC 3020 Introduction to Cybersecurity Lab Assignment 2 CAE-CD Knowled.docx
CSC 3020 Introduction to Cybersecurity Lab Assignment 2 CAE-CD Knowled.docxlez31palka
 
CS Cyber Security- 1- What would you say- are the four (4) common cy.docx
CS Cyber Security-   1- What would you say- are the four (4) common cy.docxCS Cyber Security-   1- What would you say- are the four (4) common cy.docx
CS Cyber Security- 1- What would you say- are the four (4) common cy.docxlez31palka
 
Crote ef irmution Aepore- a- Hankik a cost of erofuction refort- prepe.docx
Crote ef irmution Aepore- a- Hankik a cost of erofuction refort- prepe.docxCrote ef irmution Aepore- a- Hankik a cost of erofuction refort- prepe.docx
Crote ef irmution Aepore- a- Hankik a cost of erofuction refort- prepe.docxlez31palka
 
Cruse Cleaning is subject to an income tax rate of 22 percent- Require.docx
Cruse Cleaning is subject to an income tax rate of 22 percent- Require.docxCruse Cleaning is subject to an income tax rate of 22 percent- Require.docx
Cruse Cleaning is subject to an income tax rate of 22 percent- Require.docxlez31palka
 
Crystal Pepsi was a hit at first- and people were excited about the ne.docx
Crystal Pepsi was a hit at first- and people were excited about the ne.docxCrystal Pepsi was a hit at first- and people were excited about the ne.docx
Crystal Pepsi was a hit at first- and people were excited about the ne.docxlez31palka
 
Critical values for quick reference during this activity- Jump to leve.docx
Critical values for quick reference during this activity- Jump to leve.docxCritical values for quick reference during this activity- Jump to leve.docx
Critical values for quick reference during this activity- Jump to leve.docxlez31palka
 
Critical values for quick reference during this activity- Jump to leve (1).docx
Critical values for quick reference during this activity- Jump to leve (1).docxCritical values for quick reference during this activity- Jump to leve (1).docx
Critical values for quick reference during this activity- Jump to leve (1).docxlez31palka
 
Critical values for quick reference during this activity- Jump to leve (2).docx
Critical values for quick reference during this activity- Jump to leve (2).docxCritical values for quick reference during this activity- Jump to leve (2).docx
Critical values for quick reference during this activity- Jump to leve (2).docxlez31palka
 
Critical Thinking Questions- 18 (page 761) The U-S- government has shu.docx
Critical Thinking Questions- 18 (page 761) The U-S- government has shu.docxCritical Thinking Questions- 18 (page 761) The U-S- government has shu.docx
Critical Thinking Questions- 18 (page 761) The U-S- government has shu.docxlez31palka
 
Critical Reflection 2 is a reflective essay that connects a personal e.docx
Critical Reflection 2 is a reflective essay that connects a personal e.docxCritical Reflection 2 is a reflective essay that connects a personal e.docx
Critical Reflection 2 is a reflective essay that connects a personal e.docxlez31palka
 
Cristian pulls out his famous bag o' marbles- As everyone knows- there.docx
Cristian pulls out his famous bag o' marbles- As everyone knows- there.docxCristian pulls out his famous bag o' marbles- As everyone knows- there.docx
Cristian pulls out his famous bag o' marbles- As everyone knows- there.docxlez31palka
 
CRIMSON TIDE- INC- STATme-PROBLEM You have been hired at the prestigio.docx
CRIMSON TIDE- INC- STATme-PROBLEM You have been hired at the prestigio.docxCRIMSON TIDE- INC- STATme-PROBLEM You have been hired at the prestigio.docx
CRIMSON TIDE- INC- STATme-PROBLEM You have been hired at the prestigio.docxlez31palka
 
Creating a Webpage from a Template- Page 44-46- I completed the code b.docx
Creating a Webpage from a Template- Page 44-46- I completed the code b.docxCreating a Webpage from a Template- Page 44-46- I completed the code b.docx
Creating a Webpage from a Template- Page 44-46- I completed the code b.docxlez31palka
 
Credit Losses Based on Accounts Receivable Marvel- Inc-- analyzed its.docx
Credit Losses Based on Accounts Receivable Marvel- Inc-- analyzed its.docxCredit Losses Based on Accounts Receivable Marvel- Inc-- analyzed its.docx
Credit Losses Based on Accounts Receivable Marvel- Inc-- analyzed its.docxlez31palka
 
Credit rating agencies help investor to determine- A- If stock worth t.docx
Credit rating agencies help investor to determine- A- If stock worth t.docxCredit rating agencies help investor to determine- A- If stock worth t.docx
Credit rating agencies help investor to determine- A- If stock worth t.docxlez31palka
 

More from lez31palka (20)

Cuilumber Candle Supply makes candles- The sales mix (as a percmtage o.docx
Cuilumber Candle Supply makes candles- The sales mix (as a percmtage o.docxCuilumber Candle Supply makes candles- The sales mix (as a percmtage o.docx
Cuilumber Candle Supply makes candles- The sales mix (as a percmtage o.docx
 
CT4-1 The financial statements of Apple Inc- are presented in Appendix.docx
CT4-1 The financial statements of Apple Inc- are presented in Appendix.docxCT4-1 The financial statements of Apple Inc- are presented in Appendix.docx
CT4-1 The financial statements of Apple Inc- are presented in Appendix.docx
 
Cu are responsible for planning the parking needed for a new 2-56 - un.docx
Cu are responsible for planning the parking needed for a new 2-56 - un.docxCu are responsible for planning the parking needed for a new 2-56 - un.docx
Cu are responsible for planning the parking needed for a new 2-56 - un.docx
 
CSCI 4617 (jblearning Cloud lab) Creating a Security Awareness Policy.docx
CSCI 4617 (jblearning Cloud lab) Creating a Security Awareness Policy.docxCSCI 4617 (jblearning Cloud lab) Creating a Security Awareness Policy.docx
CSCI 4617 (jblearning Cloud lab) Creating a Security Awareness Policy.docx
 
ctivity-Based Product Costing 2oberts Company produces two weed eaters.docx
ctivity-Based Product Costing 2oberts Company produces two weed eaters.docxctivity-Based Product Costing 2oberts Company produces two weed eaters.docx
ctivity-Based Product Costing 2oberts Company produces two weed eaters.docx
 
CSC 3020 Introduction to Cybersecurity Lab Assignment 2 CAE-CD Knowled.docx
CSC 3020 Introduction to Cybersecurity Lab Assignment 2 CAE-CD Knowled.docxCSC 3020 Introduction to Cybersecurity Lab Assignment 2 CAE-CD Knowled.docx
CSC 3020 Introduction to Cybersecurity Lab Assignment 2 CAE-CD Knowled.docx
 
CS Cyber Security- 1- What would you say- are the four (4) common cy.docx
CS Cyber Security-   1- What would you say- are the four (4) common cy.docxCS Cyber Security-   1- What would you say- are the four (4) common cy.docx
CS Cyber Security- 1- What would you say- are the four (4) common cy.docx
 
Crote ef irmution Aepore- a- Hankik a cost of erofuction refort- prepe.docx
Crote ef irmution Aepore- a- Hankik a cost of erofuction refort- prepe.docxCrote ef irmution Aepore- a- Hankik a cost of erofuction refort- prepe.docx
Crote ef irmution Aepore- a- Hankik a cost of erofuction refort- prepe.docx
 
Cruse Cleaning is subject to an income tax rate of 22 percent- Require.docx
Cruse Cleaning is subject to an income tax rate of 22 percent- Require.docxCruse Cleaning is subject to an income tax rate of 22 percent- Require.docx
Cruse Cleaning is subject to an income tax rate of 22 percent- Require.docx
 
Crystal Pepsi was a hit at first- and people were excited about the ne.docx
Crystal Pepsi was a hit at first- and people were excited about the ne.docxCrystal Pepsi was a hit at first- and people were excited about the ne.docx
Crystal Pepsi was a hit at first- and people were excited about the ne.docx
 
Critical values for quick reference during this activity- Jump to leve.docx
Critical values for quick reference during this activity- Jump to leve.docxCritical values for quick reference during this activity- Jump to leve.docx
Critical values for quick reference during this activity- Jump to leve.docx
 
Critical values for quick reference during this activity- Jump to leve (1).docx
Critical values for quick reference during this activity- Jump to leve (1).docxCritical values for quick reference during this activity- Jump to leve (1).docx
Critical values for quick reference during this activity- Jump to leve (1).docx
 
Critical values for quick reference during this activity- Jump to leve (2).docx
Critical values for quick reference during this activity- Jump to leve (2).docxCritical values for quick reference during this activity- Jump to leve (2).docx
Critical values for quick reference during this activity- Jump to leve (2).docx
 
Critical Thinking Questions- 18 (page 761) The U-S- government has shu.docx
Critical Thinking Questions- 18 (page 761) The U-S- government has shu.docxCritical Thinking Questions- 18 (page 761) The U-S- government has shu.docx
Critical Thinking Questions- 18 (page 761) The U-S- government has shu.docx
 
Critical Reflection 2 is a reflective essay that connects a personal e.docx
Critical Reflection 2 is a reflective essay that connects a personal e.docxCritical Reflection 2 is a reflective essay that connects a personal e.docx
Critical Reflection 2 is a reflective essay that connects a personal e.docx
 
Cristian pulls out his famous bag o' marbles- As everyone knows- there.docx
Cristian pulls out his famous bag o' marbles- As everyone knows- there.docxCristian pulls out his famous bag o' marbles- As everyone knows- there.docx
Cristian pulls out his famous bag o' marbles- As everyone knows- there.docx
 
CRIMSON TIDE- INC- STATme-PROBLEM You have been hired at the prestigio.docx
CRIMSON TIDE- INC- STATme-PROBLEM You have been hired at the prestigio.docxCRIMSON TIDE- INC- STATme-PROBLEM You have been hired at the prestigio.docx
CRIMSON TIDE- INC- STATme-PROBLEM You have been hired at the prestigio.docx
 
Creating a Webpage from a Template- Page 44-46- I completed the code b.docx
Creating a Webpage from a Template- Page 44-46- I completed the code b.docxCreating a Webpage from a Template- Page 44-46- I completed the code b.docx
Creating a Webpage from a Template- Page 44-46- I completed the code b.docx
 
Credit Losses Based on Accounts Receivable Marvel- Inc-- analyzed its.docx
Credit Losses Based on Accounts Receivable Marvel- Inc-- analyzed its.docxCredit Losses Based on Accounts Receivable Marvel- Inc-- analyzed its.docx
Credit Losses Based on Accounts Receivable Marvel- Inc-- analyzed its.docx
 
Credit rating agencies help investor to determine- A- If stock worth t.docx
Credit rating agencies help investor to determine- A- If stock worth t.docxCredit rating agencies help investor to determine- A- If stock worth t.docx
Credit rating agencies help investor to determine- A- If stock worth t.docx
 

Recently uploaded

Protein Structure - threading Protein modelling pptx
Protein Structure - threading Protein modelling pptxProtein Structure - threading Protein modelling pptx
Protein Structure - threading Protein modelling pptxvidhisharma994099
 
How to Show Error_Warning Messages in Odoo 17
How to Show Error_Warning Messages in Odoo 17How to Show Error_Warning Messages in Odoo 17
How to Show Error_Warning Messages in Odoo 17Celine George
 
Prescribed medication order and communication skills.pptx
Prescribed medication order and communication skills.pptxPrescribed medication order and communication skills.pptx
Prescribed medication order and communication skills.pptxraviapr7
 
Diploma in Nursing Admission Test Question Solution 2023.pdf
Diploma in Nursing Admission Test Question Solution 2023.pdfDiploma in Nursing Admission Test Question Solution 2023.pdf
Diploma in Nursing Admission Test Question Solution 2023.pdfMohonDas
 
How to Manage Cross-Selling in Odoo 17 Sales
How to Manage Cross-Selling in Odoo 17 SalesHow to Manage Cross-Selling in Odoo 17 Sales
How to Manage Cross-Selling in Odoo 17 SalesCeline George
 
Quality Assurance_GOOD LABORATORY PRACTICE
Quality Assurance_GOOD LABORATORY PRACTICEQuality Assurance_GOOD LABORATORY PRACTICE
Quality Assurance_GOOD LABORATORY PRACTICESayali Powar
 
Optical Fibre and It's Applications.pptx
Optical Fibre and It's Applications.pptxOptical Fibre and It's Applications.pptx
Optical Fibre and It's Applications.pptxPurva Nikam
 
AUDIENCE THEORY -- FANDOM -- JENKINS.pptx
AUDIENCE THEORY -- FANDOM -- JENKINS.pptxAUDIENCE THEORY -- FANDOM -- JENKINS.pptx
AUDIENCE THEORY -- FANDOM -- JENKINS.pptxiammrhaywood
 
What is the Future of QuickBooks DeskTop?
What is the Future of QuickBooks DeskTop?What is the Future of QuickBooks DeskTop?
What is the Future of QuickBooks DeskTop?TechSoup
 
Unveiling the Intricacies of Leishmania donovani: Structure, Life Cycle, Path...
Unveiling the Intricacies of Leishmania donovani: Structure, Life Cycle, Path...Unveiling the Intricacies of Leishmania donovani: Structure, Life Cycle, Path...
Unveiling the Intricacies of Leishmania donovani: Structure, Life Cycle, Path...Dr. Asif Anas
 
How to Solve Singleton Error in the Odoo 17
How to Solve Singleton Error in the  Odoo 17How to Solve Singleton Error in the  Odoo 17
How to Solve Singleton Error in the Odoo 17Celine George
 
KARNAADA.pptx made by - saransh dwivedi ( SD ) - SHALAKYA TANTRA - ENT - 4...
KARNAADA.pptx  made by -  saransh dwivedi ( SD ) -  SHALAKYA TANTRA - ENT - 4...KARNAADA.pptx  made by -  saransh dwivedi ( SD ) -  SHALAKYA TANTRA - ENT - 4...
KARNAADA.pptx made by - saransh dwivedi ( SD ) - SHALAKYA TANTRA - ENT - 4...M56BOOKSTORE PRODUCT/SERVICE
 
How to Send Emails From Odoo 17 Using Code
How to Send Emails From Odoo 17 Using CodeHow to Send Emails From Odoo 17 Using Code
How to Send Emails From Odoo 17 Using CodeCeline George
 
3.26.24 Race, the Draft, and the Vietnam War.pptx
3.26.24 Race, the Draft, and the Vietnam War.pptx3.26.24 Race, the Draft, and the Vietnam War.pptx
3.26.24 Race, the Draft, and the Vietnam War.pptxmary850239
 
The basics of sentences session 10pptx.pptx
The basics of sentences session 10pptx.pptxThe basics of sentences session 10pptx.pptx
The basics of sentences session 10pptx.pptxheathfieldcps1
 
HED Office Sohayok Exam Question Solution 2023.pdf
HED Office Sohayok Exam Question Solution 2023.pdfHED Office Sohayok Exam Question Solution 2023.pdf
HED Office Sohayok Exam Question Solution 2023.pdfMohonDas
 
SOLIDE WASTE in Cameroon,,,,,,,,,,,,,,,,,,,,,,,,,,,.pptx
SOLIDE WASTE in Cameroon,,,,,,,,,,,,,,,,,,,,,,,,,,,.pptxSOLIDE WASTE in Cameroon,,,,,,,,,,,,,,,,,,,,,,,,,,,.pptx
SOLIDE WASTE in Cameroon,,,,,,,,,,,,,,,,,,,,,,,,,,,.pptxSyedNadeemGillANi
 
Education and training program in the hospital APR.pptx
Education and training program in the hospital APR.pptxEducation and training program in the hospital APR.pptx
Education and training program in the hospital APR.pptxraviapr7
 
In - Vivo and In - Vitro Correlation.pptx
In - Vivo and In - Vitro Correlation.pptxIn - Vivo and In - Vitro Correlation.pptx
In - Vivo and In - Vitro Correlation.pptxAditiChauhan701637
 

Recently uploaded (20)

Protein Structure - threading Protein modelling pptx
Protein Structure - threading Protein modelling pptxProtein Structure - threading Protein modelling pptx
Protein Structure - threading Protein modelling pptx
 
How to Show Error_Warning Messages in Odoo 17
How to Show Error_Warning Messages in Odoo 17How to Show Error_Warning Messages in Odoo 17
How to Show Error_Warning Messages in Odoo 17
 
Prescribed medication order and communication skills.pptx
Prescribed medication order and communication skills.pptxPrescribed medication order and communication skills.pptx
Prescribed medication order and communication skills.pptx
 
Diploma in Nursing Admission Test Question Solution 2023.pdf
Diploma in Nursing Admission Test Question Solution 2023.pdfDiploma in Nursing Admission Test Question Solution 2023.pdf
Diploma in Nursing Admission Test Question Solution 2023.pdf
 
How to Manage Cross-Selling in Odoo 17 Sales
How to Manage Cross-Selling in Odoo 17 SalesHow to Manage Cross-Selling in Odoo 17 Sales
How to Manage Cross-Selling in Odoo 17 Sales
 
Quality Assurance_GOOD LABORATORY PRACTICE
Quality Assurance_GOOD LABORATORY PRACTICEQuality Assurance_GOOD LABORATORY PRACTICE
Quality Assurance_GOOD LABORATORY PRACTICE
 
Optical Fibre and It's Applications.pptx
Optical Fibre and It's Applications.pptxOptical Fibre and It's Applications.pptx
Optical Fibre and It's Applications.pptx
 
AUDIENCE THEORY -- FANDOM -- JENKINS.pptx
AUDIENCE THEORY -- FANDOM -- JENKINS.pptxAUDIENCE THEORY -- FANDOM -- JENKINS.pptx
AUDIENCE THEORY -- FANDOM -- JENKINS.pptx
 
What is the Future of QuickBooks DeskTop?
What is the Future of QuickBooks DeskTop?What is the Future of QuickBooks DeskTop?
What is the Future of QuickBooks DeskTop?
 
Unveiling the Intricacies of Leishmania donovani: Structure, Life Cycle, Path...
Unveiling the Intricacies of Leishmania donovani: Structure, Life Cycle, Path...Unveiling the Intricacies of Leishmania donovani: Structure, Life Cycle, Path...
Unveiling the Intricacies of Leishmania donovani: Structure, Life Cycle, Path...
 
March 2024 Directors Meeting, Division of Student Affairs and Academic Support
March 2024 Directors Meeting, Division of Student Affairs and Academic SupportMarch 2024 Directors Meeting, Division of Student Affairs and Academic Support
March 2024 Directors Meeting, Division of Student Affairs and Academic Support
 
How to Solve Singleton Error in the Odoo 17
How to Solve Singleton Error in the  Odoo 17How to Solve Singleton Error in the  Odoo 17
How to Solve Singleton Error in the Odoo 17
 
KARNAADA.pptx made by - saransh dwivedi ( SD ) - SHALAKYA TANTRA - ENT - 4...
KARNAADA.pptx  made by -  saransh dwivedi ( SD ) -  SHALAKYA TANTRA - ENT - 4...KARNAADA.pptx  made by -  saransh dwivedi ( SD ) -  SHALAKYA TANTRA - ENT - 4...
KARNAADA.pptx made by - saransh dwivedi ( SD ) - SHALAKYA TANTRA - ENT - 4...
 
How to Send Emails From Odoo 17 Using Code
How to Send Emails From Odoo 17 Using CodeHow to Send Emails From Odoo 17 Using Code
How to Send Emails From Odoo 17 Using Code
 
3.26.24 Race, the Draft, and the Vietnam War.pptx
3.26.24 Race, the Draft, and the Vietnam War.pptx3.26.24 Race, the Draft, and the Vietnam War.pptx
3.26.24 Race, the Draft, and the Vietnam War.pptx
 
The basics of sentences session 10pptx.pptx
The basics of sentences session 10pptx.pptxThe basics of sentences session 10pptx.pptx
The basics of sentences session 10pptx.pptx
 
HED Office Sohayok Exam Question Solution 2023.pdf
HED Office Sohayok Exam Question Solution 2023.pdfHED Office Sohayok Exam Question Solution 2023.pdf
HED Office Sohayok Exam Question Solution 2023.pdf
 
SOLIDE WASTE in Cameroon,,,,,,,,,,,,,,,,,,,,,,,,,,,.pptx
SOLIDE WASTE in Cameroon,,,,,,,,,,,,,,,,,,,,,,,,,,,.pptxSOLIDE WASTE in Cameroon,,,,,,,,,,,,,,,,,,,,,,,,,,,.pptx
SOLIDE WASTE in Cameroon,,,,,,,,,,,,,,,,,,,,,,,,,,,.pptx
 
Education and training program in the hospital APR.pptx
Education and training program in the hospital APR.pptxEducation and training program in the hospital APR.pptx
Education and training program in the hospital APR.pptx
 
In - Vivo and In - Vitro Correlation.pptx
In - Vivo and In - Vitro Correlation.pptxIn - Vivo and In - Vitro Correlation.pptx
In - Vivo and In - Vitro Correlation.pptx
 

write a program that- Asks the user to enter a string that contains at (1).docx

  • 1. write a program that: Asks the user to enter a string that contains at least three letters. Stores that number into a variable called s. Creates a variable called "ending", and sets it equal to the string that contains the last three letters of s. Here you should think carefully how to do this, you may need more than one line of code to achieve this type (hint: to figure out where the last three letters are, you need to know the length of the string). Prints out the value of ending, using EXACTLY the same format as shown below. For example: if the user enters the string "Saturday", your program output should look EXACTLY like this: Please enter a string, at least 3 letters long: Saturday The last three letters are day. Solution StringTest1.java import java.util.Scanner; public class StringTest1 { /** * @param args */ public static void main(String[] args) { // TODO Auto-generated method stub Scanner scan = new Scanner(System.in); System.out.println("Please enter a string, at least 3 letters long: "); String s = scan.next(); String ending = s.substring(s.length()-3, s.length()); System.out.println("The last three letters are "+ending); } } Output:
  • 2. Please enter a string, at least 3 letters long: Saturday The last three letters are day