SlideShare une entreprise Scribd logo
1  sur  1
Télécharger pour lire hors ligne
Write a method checkCharacter0 which has 2 parameters: A String, and a specified index (an int).
Method checkcharacter0 checks the character at the specified index of the String parameter, and
returns a String based on the type of character at that location indicating if the character is a letter,
digit, whitespace, or unknown character: Ex: The method calis below with the given arguments will
return the following Strings: checkCharacter " "happy birthday", 2) returns "Character "p' is a letter"
checkCharacter ("happy birthday", 5) returns "Character" is a white space" checkCharacter
("happy birthday 2 you", 15) returns "Character '2' is a digit' checkCharacter ("happy birthday!", 14)
returns "Character'" is unknown: Your program must define the method public String
checkCharacter(string word, int index)import java.util. Scanner; public class FunWithCharacters {
/* Type your code here */ public static void main(String [] args) { FunWithCharacters lab0bject =
new FunWithCharters(); String word = "happy birthday"; // Set string int index =2;1/ Set specified
index to 2 System. out.println(labobject. checkCharacter(word, index)); index =5;/1 Set specified
index to 5 System. out.println(labObject. checkCharacter(word, index)); word = "happy birthday 2
you"; index =15; // Set specified index to 15 System. out.println(labObject. checkCharacter(word,
index)); word = "happy birthday!"; index =14;// Set specified index to 14 System.
out.println(labObject. checkCharacter(word, index));

Contenu connexe

Plus de vivekemailid

Write a program that contains the following functions The i.pdf
Write a program that contains the following functions The i.pdfWrite a program that contains the following functions The i.pdf
Write a program that contains the following functions The i.pdfvivekemailid
 
Write a program named FavoriteWordsjava that prompts user t.pdf
Write a program named FavoriteWordsjava that prompts user t.pdfWrite a program named FavoriteWordsjava that prompts user t.pdf
Write a program named FavoriteWordsjava that prompts user t.pdfvivekemailid
 
Write a program in Python that implements Newtons method to.pdf
Write a program in Python that implements Newtons method to.pdfWrite a program in Python that implements Newtons method to.pdf
Write a program in Python that implements Newtons method to.pdfvivekemailid
 
Write a program called diagnosispy that simulates an expe.pdf
Write a program called diagnosispy that simulates an expe.pdfWrite a program called diagnosispy that simulates an expe.pdf
Write a program called diagnosispy that simulates an expe.pdfvivekemailid
 
Write a program that prints the message Hello my name is .pdf
Write a program that prints the message Hello my name is .pdfWrite a program that prints the message Hello my name is .pdf
Write a program that prints the message Hello my name is .pdfvivekemailid
 
Write a method called recAdd that will add the integer ele.pdf
Write a method called recAdd that will add the integer ele.pdfWrite a method called recAdd that will add the integer ele.pdf
Write a method called recAdd that will add the integer ele.pdfvivekemailid
 
Write a Python function named validInput that displays to .pdf
Write a Python function named validInput that displays to .pdfWrite a Python function named validInput that displays to .pdf
Write a Python function named validInput that displays to .pdfvivekemailid
 
Write a program defines a Person class that has private inst.pdf
Write a program defines a Person class that has private inst.pdfWrite a program defines a Person class that has private inst.pdf
Write a program defines a Person class that has private inst.pdfvivekemailid
 
Write a main method that will request the user to enter Stri.pdf
Write a main method that will request the user to enter Stri.pdfWrite a main method that will request the user to enter Stri.pdf
Write a main method that will request the user to enter Stri.pdfvivekemailid
 
Write a Java program using while loop or do while and swi.pdf
Write a Java program using while  loop or do while and swi.pdfWrite a Java program using while  loop or do while and swi.pdf
Write a Java program using while loop or do while and swi.pdfvivekemailid
 
Write a Java program to accept 10 integers from the user an.pdf
Write a Java program to accept 10 integers from the user an.pdfWrite a Java program to accept 10 integers from the user an.pdf
Write a Java program to accept 10 integers from the user an.pdfvivekemailid
 

Plus de vivekemailid (11)

Write a program that contains the following functions The i.pdf
Write a program that contains the following functions The i.pdfWrite a program that contains the following functions The i.pdf
Write a program that contains the following functions The i.pdf
 
Write a program named FavoriteWordsjava that prompts user t.pdf
Write a program named FavoriteWordsjava that prompts user t.pdfWrite a program named FavoriteWordsjava that prompts user t.pdf
Write a program named FavoriteWordsjava that prompts user t.pdf
 
Write a program in Python that implements Newtons method to.pdf
Write a program in Python that implements Newtons method to.pdfWrite a program in Python that implements Newtons method to.pdf
Write a program in Python that implements Newtons method to.pdf
 
Write a program called diagnosispy that simulates an expe.pdf
Write a program called diagnosispy that simulates an expe.pdfWrite a program called diagnosispy that simulates an expe.pdf
Write a program called diagnosispy that simulates an expe.pdf
 
Write a program that prints the message Hello my name is .pdf
Write a program that prints the message Hello my name is .pdfWrite a program that prints the message Hello my name is .pdf
Write a program that prints the message Hello my name is .pdf
 
Write a method called recAdd that will add the integer ele.pdf
Write a method called recAdd that will add the integer ele.pdfWrite a method called recAdd that will add the integer ele.pdf
Write a method called recAdd that will add the integer ele.pdf
 
Write a Python function named validInput that displays to .pdf
Write a Python function named validInput that displays to .pdfWrite a Python function named validInput that displays to .pdf
Write a Python function named validInput that displays to .pdf
 
Write a program defines a Person class that has private inst.pdf
Write a program defines a Person class that has private inst.pdfWrite a program defines a Person class that has private inst.pdf
Write a program defines a Person class that has private inst.pdf
 
Write a main method that will request the user to enter Stri.pdf
Write a main method that will request the user to enter Stri.pdfWrite a main method that will request the user to enter Stri.pdf
Write a main method that will request the user to enter Stri.pdf
 
Write a Java program using while loop or do while and swi.pdf
Write a Java program using while  loop or do while and swi.pdfWrite a Java program using while  loop or do while and swi.pdf
Write a Java program using while loop or do while and swi.pdf
 
Write a Java program to accept 10 integers from the user an.pdf
Write a Java program to accept 10 integers from the user an.pdfWrite a Java program to accept 10 integers from the user an.pdf
Write a Java program to accept 10 integers from the user an.pdf
 

Dernier

Z Score,T Score, Percential Rank and Box Plot Graph
Z Score,T Score, Percential Rank and Box Plot GraphZ Score,T Score, Percential Rank and Box Plot Graph
Z Score,T Score, Percential Rank and Box Plot GraphThiyagu K
 
URLs and Routing in the Odoo 17 Website App
URLs and Routing in the Odoo 17 Website AppURLs and Routing in the Odoo 17 Website App
URLs and Routing in the Odoo 17 Website AppCeline George
 
Industrial Policy - 1948, 1956, 1973, 1977, 1980, 1991
Industrial Policy - 1948, 1956, 1973, 1977, 1980, 1991Industrial Policy - 1948, 1956, 1973, 1977, 1980, 1991
Industrial Policy - 1948, 1956, 1973, 1977, 1980, 1991RKavithamani
 
How to Make a Pirate ship Primary Education.pptx
How to Make a Pirate ship Primary Education.pptxHow to Make a Pirate ship Primary Education.pptx
How to Make a Pirate ship Primary Education.pptxmanuelaromero2013
 
Q4-W6-Restating Informational Text Grade 3
Q4-W6-Restating Informational Text Grade 3Q4-W6-Restating Informational Text Grade 3
Q4-W6-Restating Informational Text Grade 3JemimahLaneBuaron
 
1029 - Danh muc Sach Giao Khoa 10 . pdf
1029 -  Danh muc Sach Giao Khoa 10 . pdf1029 -  Danh muc Sach Giao Khoa 10 . pdf
1029 - Danh muc Sach Giao Khoa 10 . pdfQucHHunhnh
 
“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...
“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...
“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...Marc Dusseiller Dusjagr
 
1029-Danh muc Sach Giao Khoa khoi 6.pdf
1029-Danh muc Sach Giao Khoa khoi  6.pdf1029-Danh muc Sach Giao Khoa khoi  6.pdf
1029-Danh muc Sach Giao Khoa khoi 6.pdfQucHHunhnh
 
Privatization and Disinvestment - Meaning, Objectives, Advantages and Disadva...
Privatization and Disinvestment - Meaning, Objectives, Advantages and Disadva...Privatization and Disinvestment - Meaning, Objectives, Advantages and Disadva...
Privatization and Disinvestment - Meaning, Objectives, Advantages and Disadva...RKavithamani
 
Grant Readiness 101 TechSoup and Remy Consulting
Grant Readiness 101 TechSoup and Remy ConsultingGrant Readiness 101 TechSoup and Remy Consulting
Grant Readiness 101 TechSoup and Remy ConsultingTechSoup
 
Paris 2024 Olympic Geographies - an activity
Paris 2024 Olympic Geographies - an activityParis 2024 Olympic Geographies - an activity
Paris 2024 Olympic Geographies - an activityGeoBlogs
 
Beyond the EU: DORA and NIS 2 Directive's Global Impact
Beyond the EU: DORA and NIS 2 Directive's Global ImpactBeyond the EU: DORA and NIS 2 Directive's Global Impact
Beyond the EU: DORA and NIS 2 Directive's Global ImpactPECB
 
Introduction to ArtificiaI Intelligence in Higher Education
Introduction to ArtificiaI Intelligence in Higher EducationIntroduction to ArtificiaI Intelligence in Higher Education
Introduction to ArtificiaI Intelligence in Higher Educationpboyjonauth
 
Contemporary philippine arts from the regions_PPT_Module_12 [Autosaved] (1).pptx
Contemporary philippine arts from the regions_PPT_Module_12 [Autosaved] (1).pptxContemporary philippine arts from the regions_PPT_Module_12 [Autosaved] (1).pptx
Contemporary philippine arts from the regions_PPT_Module_12 [Autosaved] (1).pptxRoyAbrique
 
Employee wellbeing at the workplace.pptx
Employee wellbeing at the workplace.pptxEmployee wellbeing at the workplace.pptx
Employee wellbeing at the workplace.pptxNirmalaLoungPoorunde1
 
Measures of Central Tendency: Mean, Median and Mode
Measures of Central Tendency: Mean, Median and ModeMeasures of Central Tendency: Mean, Median and Mode
Measures of Central Tendency: Mean, Median and ModeThiyagu K
 

Dernier (20)

Z Score,T Score, Percential Rank and Box Plot Graph
Z Score,T Score, Percential Rank and Box Plot GraphZ Score,T Score, Percential Rank and Box Plot Graph
Z Score,T Score, Percential Rank and Box Plot Graph
 
URLs and Routing in the Odoo 17 Website App
URLs and Routing in the Odoo 17 Website AppURLs and Routing in the Odoo 17 Website App
URLs and Routing in the Odoo 17 Website App
 
Industrial Policy - 1948, 1956, 1973, 1977, 1980, 1991
Industrial Policy - 1948, 1956, 1973, 1977, 1980, 1991Industrial Policy - 1948, 1956, 1973, 1977, 1980, 1991
Industrial Policy - 1948, 1956, 1973, 1977, 1980, 1991
 
How to Make a Pirate ship Primary Education.pptx
How to Make a Pirate ship Primary Education.pptxHow to Make a Pirate ship Primary Education.pptx
How to Make a Pirate ship Primary Education.pptx
 
Q4-W6-Restating Informational Text Grade 3
Q4-W6-Restating Informational Text Grade 3Q4-W6-Restating Informational Text Grade 3
Q4-W6-Restating Informational Text Grade 3
 
1029 - Danh muc Sach Giao Khoa 10 . pdf
1029 -  Danh muc Sach Giao Khoa 10 . pdf1029 -  Danh muc Sach Giao Khoa 10 . pdf
1029 - Danh muc Sach Giao Khoa 10 . pdf
 
“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...
“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...
“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...
 
Código Creativo y Arte de Software | Unidad 1
Código Creativo y Arte de Software | Unidad 1Código Creativo y Arte de Software | Unidad 1
Código Creativo y Arte de Software | Unidad 1
 
1029-Danh muc Sach Giao Khoa khoi 6.pdf
1029-Danh muc Sach Giao Khoa khoi  6.pdf1029-Danh muc Sach Giao Khoa khoi  6.pdf
1029-Danh muc Sach Giao Khoa khoi 6.pdf
 
Staff of Color (SOC) Retention Efforts DDSD
Staff of Color (SOC) Retention Efforts DDSDStaff of Color (SOC) Retention Efforts DDSD
Staff of Color (SOC) Retention Efforts DDSD
 
TataKelola dan KamSiber Kecerdasan Buatan v022.pdf
TataKelola dan KamSiber Kecerdasan Buatan v022.pdfTataKelola dan KamSiber Kecerdasan Buatan v022.pdf
TataKelola dan KamSiber Kecerdasan Buatan v022.pdf
 
INDIA QUIZ 2024 RLAC DELHI UNIVERSITY.pptx
INDIA QUIZ 2024 RLAC DELHI UNIVERSITY.pptxINDIA QUIZ 2024 RLAC DELHI UNIVERSITY.pptx
INDIA QUIZ 2024 RLAC DELHI UNIVERSITY.pptx
 
Privatization and Disinvestment - Meaning, Objectives, Advantages and Disadva...
Privatization and Disinvestment - Meaning, Objectives, Advantages and Disadva...Privatization and Disinvestment - Meaning, Objectives, Advantages and Disadva...
Privatization and Disinvestment - Meaning, Objectives, Advantages and Disadva...
 
Grant Readiness 101 TechSoup and Remy Consulting
Grant Readiness 101 TechSoup and Remy ConsultingGrant Readiness 101 TechSoup and Remy Consulting
Grant Readiness 101 TechSoup and Remy Consulting
 
Paris 2024 Olympic Geographies - an activity
Paris 2024 Olympic Geographies - an activityParis 2024 Olympic Geographies - an activity
Paris 2024 Olympic Geographies - an activity
 
Beyond the EU: DORA and NIS 2 Directive's Global Impact
Beyond the EU: DORA and NIS 2 Directive's Global ImpactBeyond the EU: DORA and NIS 2 Directive's Global Impact
Beyond the EU: DORA and NIS 2 Directive's Global Impact
 
Introduction to ArtificiaI Intelligence in Higher Education
Introduction to ArtificiaI Intelligence in Higher EducationIntroduction to ArtificiaI Intelligence in Higher Education
Introduction to ArtificiaI Intelligence in Higher Education
 
Contemporary philippine arts from the regions_PPT_Module_12 [Autosaved] (1).pptx
Contemporary philippine arts from the regions_PPT_Module_12 [Autosaved] (1).pptxContemporary philippine arts from the regions_PPT_Module_12 [Autosaved] (1).pptx
Contemporary philippine arts from the regions_PPT_Module_12 [Autosaved] (1).pptx
 
Employee wellbeing at the workplace.pptx
Employee wellbeing at the workplace.pptxEmployee wellbeing at the workplace.pptx
Employee wellbeing at the workplace.pptx
 
Measures of Central Tendency: Mean, Median and Mode
Measures of Central Tendency: Mean, Median and ModeMeasures of Central Tendency: Mean, Median and Mode
Measures of Central Tendency: Mean, Median and Mode
 

Write a method checkCharacter0 which has 2 parameters A Str.pdf

  • 1. Write a method checkCharacter0 which has 2 parameters: A String, and a specified index (an int). Method checkcharacter0 checks the character at the specified index of the String parameter, and returns a String based on the type of character at that location indicating if the character is a letter, digit, whitespace, or unknown character: Ex: The method calis below with the given arguments will return the following Strings: checkCharacter " "happy birthday", 2) returns "Character "p' is a letter" checkCharacter ("happy birthday", 5) returns "Character" is a white space" checkCharacter ("happy birthday 2 you", 15) returns "Character '2' is a digit' checkCharacter ("happy birthday!", 14) returns "Character'" is unknown: Your program must define the method public String checkCharacter(string word, int index)import java.util. Scanner; public class FunWithCharacters { /* Type your code here */ public static void main(String [] args) { FunWithCharacters lab0bject = new FunWithCharters(); String word = "happy birthday"; // Set string int index =2;1/ Set specified index to 2 System. out.println(labobject. checkCharacter(word, index)); index =5;/1 Set specified index to 5 System. out.println(labObject. checkCharacter(word, index)); word = "happy birthday 2 you"; index =15; // Set specified index to 15 System. out.println(labObject. checkCharacter(word, index)); word = "happy birthday!"; index =14;// Set specified index to 14 System. out.println(labObject. checkCharacter(word, index));