SlideShare ist ein Scribd-Unternehmen logo
1 von 2
Write a program that prompts the user to input a sequence of characters and outputs the number
of vowels. (Use the function is Vowel written in Programming Exercise 2.)
Solution
VowelTest.java
import java.util.Scanner;
public class VowelTest {
/**
* @param args
*/
public static void main(String[] args) {
// TODO Auto-generated method stub
Scanner scan = new Scanner(System.in);
System.out.println("Please enter the sequence of characters :");
String s = scan.nextLine();
boolean status = false;
int vowelCount = 0;
for(int i=0; i<s.length(); i++){
status = isVowel(s.charAt(i));
if(status == true){
vowelCount++;
}
}
System.out.println("The Number of Vowels : "+vowelCount);
}
public static boolean isVowel(char c){
boolean status = false;
char vowels[] = {'a','e','i','o','u','A','E','I','O','U'};
for(int i=0; i<vowels.length; i++){
if(vowels[i] == c){
status = true;
break;
}
}
return status;
}
}
Output:
Please enter the sequence of characters :
Hai Good Morning
The Number of Vowels : 6

Weitere Àhnliche Inhalte

Ähnlich wie Write a program that prompts the user to input a sequence of character.docx

Review Questions for Exam 10182016 1. public class .pdf
Review Questions for Exam 10182016 1. public class .pdfReview Questions for Exam 10182016 1. public class .pdf
Review Questions for Exam 10182016 1. public class .pdfmayorothenguyenhob69
 
Internet and Web Technology (CLASS-16) [Basic Elements of Java Program] | NIC...
Internet and Web Technology (CLASS-16) [Basic Elements of Java Program] | NIC...Internet and Web Technology (CLASS-16) [Basic Elements of Java Program] | NIC...
Internet and Web Technology (CLASS-16) [Basic Elements of Java Program] | NIC...Ayes Chinmay
 
JAVA Question : Programming Assignment
JAVA Question : Programming AssignmentJAVA Question : Programming Assignment
JAVA Question : Programming AssignmentCoding Assignment Help
 
InsertionSorting.javaimport java.util.Arrays; import java.util.S.pdf
InsertionSorting.javaimport java.util.Arrays; import java.util.S.pdfInsertionSorting.javaimport java.util.Arrays; import java.util.S.pdf
InsertionSorting.javaimport java.util.Arrays; import java.util.S.pdfinfo54093
 
Lab01.pptx
Lab01.pptxLab01.pptx
Lab01.pptxKimVeeL
 
The sample program for above series in JAVA will be like belowimpo.pdf
The sample program for above series in JAVA will be like belowimpo.pdfThe sample program for above series in JAVA will be like belowimpo.pdf
The sample program for above series in JAVA will be like belowimpo.pdfrajat630669
 
The sample program for above series in JAVA will be like belowimpo.pdf
The sample program for above series in JAVA will be like belowimpo.pdfThe sample program for above series in JAVA will be like belowimpo.pdf
The sample program for above series in JAVA will be like belowimpo.pdfrajat630669
 
Lab101.pptx
Lab101.pptxLab101.pptx
Lab101.pptxKimVeeL
 
import java.util.;public class Program{public static void.pdf
import java.util.;public class Program{public static void.pdfimport java.util.;public class Program{public static void.pdf
import java.util.;public class Program{public static void.pdfoptokunal1
 
KOLEJ KOMUNITI - Sijil Aplikasi Perisian Komputer
KOLEJ KOMUNITI - Sijil Aplikasi Perisian KomputerKOLEJ KOMUNITI - Sijil Aplikasi Perisian Komputer
KOLEJ KOMUNITI - Sijil Aplikasi Perisian KomputerAiman Hud
 
Assume you have a scanner object (called input).Declare an integer.pdf
Assume you have a scanner object (called input).Declare an integer.pdfAssume you have a scanner object (called input).Declare an integer.pdf
Assume you have a scanner object (called input).Declare an integer.pdfezzi552
 
SumNumbers.java import java.util.Scanner;public class SumNumbe.pdf
SumNumbers.java import java.util.Scanner;public class SumNumbe.pdfSumNumbers.java import java.util.Scanner;public class SumNumbe.pdf
SumNumbers.java import java.util.Scanner;public class SumNumbe.pdfankkitextailes
 

Ähnlich wie Write a program that prompts the user to input a sequence of character.docx (14)

Review Questions for Exam 10182016 1. public class .pdf
Review Questions for Exam 10182016 1. public class .pdfReview Questions for Exam 10182016 1. public class .pdf
Review Questions for Exam 10182016 1. public class .pdf
 
Internet and Web Technology (CLASS-16) [Basic Elements of Java Program] | NIC...
Internet and Web Technology (CLASS-16) [Basic Elements of Java Program] | NIC...Internet and Web Technology (CLASS-16) [Basic Elements of Java Program] | NIC...
Internet and Web Technology (CLASS-16) [Basic Elements of Java Program] | NIC...
 
JAVA Question : Programming Assignment
JAVA Question : Programming AssignmentJAVA Question : Programming Assignment
JAVA Question : Programming Assignment
 
InsertionSorting.javaimport java.util.Arrays; import java.util.S.pdf
InsertionSorting.javaimport java.util.Arrays; import java.util.S.pdfInsertionSorting.javaimport java.util.Arrays; import java.util.S.pdf
InsertionSorting.javaimport java.util.Arrays; import java.util.S.pdf
 
Lab01.pptx
Lab01.pptxLab01.pptx
Lab01.pptx
 
The sample program for above series in JAVA will be like belowimpo.pdf
The sample program for above series in JAVA will be like belowimpo.pdfThe sample program for above series in JAVA will be like belowimpo.pdf
The sample program for above series in JAVA will be like belowimpo.pdf
 
The sample program for above series in JAVA will be like belowimpo.pdf
The sample program for above series in JAVA will be like belowimpo.pdfThe sample program for above series in JAVA will be like belowimpo.pdf
The sample program for above series in JAVA will be like belowimpo.pdf
 
Lab101.pptx
Lab101.pptxLab101.pptx
Lab101.pptx
 
import java.util.;public class Program{public static void.pdf
import java.util.;public class Program{public static void.pdfimport java.util.;public class Program{public static void.pdf
import java.util.;public class Program{public static void.pdf
 
KOLEJ KOMUNITI - Sijil Aplikasi Perisian Komputer
KOLEJ KOMUNITI - Sijil Aplikasi Perisian KomputerKOLEJ KOMUNITI - Sijil Aplikasi Perisian Komputer
KOLEJ KOMUNITI - Sijil Aplikasi Perisian Komputer
 
Assume you have a scanner object (called input).Declare an integer.pdf
Assume you have a scanner object (called input).Declare an integer.pdfAssume you have a scanner object (called input).Declare an integer.pdf
Assume you have a scanner object (called input).Declare an integer.pdf
 
SumNumbers.java import java.util.Scanner;public class SumNumbe.pdf
SumNumbers.java import java.util.Scanner;public class SumNumbe.pdfSumNumbers.java import java.util.Scanner;public class SumNumbe.pdf
SumNumbers.java import java.util.Scanner;public class SumNumbe.pdf
 
Java file
Java fileJava file
Java file
 
Java file
Java fileJava file
Java file
 

Mehr von lez31palka

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
 
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
 
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
 
Create software that can encrypt and decrypt using a general substitut.docx
Create software that can encrypt and decrypt using a general substitut.docxCreate software that can encrypt and decrypt using a general substitut.docx
Create software that can encrypt and decrypt using a general substitut.docxlez31palka
 
create a training to give to others on a skillset you are an expert on.docx
create a training to give to others on a skillset you are an expert on.docxcreate a training to give to others on a skillset you are an expert on.docx
create a training to give to others on a skillset you are an expert on.docxlez31palka
 
Create a tic tac toe game using Swift and taking input text input- You.docx
Create a tic tac toe game using Swift and taking input text input- You.docxCreate a tic tac toe game using Swift and taking input text input- You.docx
Create a tic tac toe game using Swift and taking input text input- You.docxlez31palka
 
Create a shell script file called q4-sh.docx
Create a shell script file called q4-sh.docxCreate a shell script file called q4-sh.docx
Create a shell script file called q4-sh.docxlez31palka
 
Create a python zork file based on the following UML- Use command func.docx
Create a python zork file based on the following UML- Use command func.docxCreate a python zork file based on the following UML- Use command func.docx
Create a python zork file based on the following UML- Use command func.docxlez31palka
 
Create a new python program- sniff_spoof_icmp-py- The program shall sn.docx
Create a new python program- sniff_spoof_icmp-py- The program shall sn.docxCreate a new python program- sniff_spoof_icmp-py- The program shall sn.docx
Create a new python program- sniff_spoof_icmp-py- The program shall sn.docxlez31palka
 
Create a new webpage called -activity2-html-- This new page must inclu.docx
Create a new webpage called -activity2-html-- This new page must inclu.docxCreate a new webpage called -activity2-html-- This new page must inclu.docx
Create a new webpage called -activity2-html-- This new page must inclu.docxlez31palka
 
Create a multi-client-single server application to check whether the n.docx
Create a multi-client-single server application to check whether the n.docxCreate a multi-client-single server application to check whether the n.docx
Create a multi-client-single server application to check whether the n.docxlez31palka
 
Create a list containing decimal numbers- Write a program to find the.docx
Create a list containing decimal numbers- Write a program to find the.docxCreate a list containing decimal numbers- Write a program to find the.docx
Create a list containing decimal numbers- Write a program to find the.docxlez31palka
 
Create a JAVA class called Staff that has the following attributes- St.docx
Create a JAVA class called Staff that has the following attributes- St.docxCreate a JAVA class called Staff that has the following attributes- St.docx
Create a JAVA class called Staff that has the following attributes- St.docxlez31palka
 
Create a Java class with the below attributes- Create a class called.docx
Create a Java class with the below attributes-  Create a class called.docxCreate a Java class with the below attributes-  Create a class called.docx
Create a Java class with the below attributes- Create a class called.docxlez31palka
 
Create a JAVA class called Faculty that has the following attributes-.docx
Create a JAVA class called Faculty that has the following attributes-.docxCreate a JAVA class called Faculty that has the following attributes-.docx
Create a JAVA class called Faculty that has the following attributes-.docxlez31palka
 
Create a garden project - Submit a project scope document - Submit R.docx
Create a garden project   - Submit a project scope document - Submit R.docxCreate a garden project   - Submit a project scope document - Submit R.docx
Create a garden project - Submit a project scope document - Submit R.docxlez31palka
 
Create a file named insert-php and add the new records in to your rese.docx
Create a file named insert-php and add the new records in to your rese.docxCreate a file named insert-php and add the new records in to your rese.docx
Create a file named insert-php and add the new records in to your rese.docxlez31palka
 
Corporate Fund started the year with o net asset value of $30-80- By y.docx
Corporate Fund started the year with o net asset value of $30-80- By y.docxCorporate Fund started the year with o net asset value of $30-80- By y.docx
Corporate Fund started the year with o net asset value of $30-80- By y.docxlez31palka
 

Mehr von lez31palka (20)

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
 
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
 
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
 
Create software that can encrypt and decrypt using a general substitut.docx
Create software that can encrypt and decrypt using a general substitut.docxCreate software that can encrypt and decrypt using a general substitut.docx
Create software that can encrypt and decrypt using a general substitut.docx
 
create a training to give to others on a skillset you are an expert on.docx
create a training to give to others on a skillset you are an expert on.docxcreate a training to give to others on a skillset you are an expert on.docx
create a training to give to others on a skillset you are an expert on.docx
 
Create a tic tac toe game using Swift and taking input text input- You.docx
Create a tic tac toe game using Swift and taking input text input- You.docxCreate a tic tac toe game using Swift and taking input text input- You.docx
Create a tic tac toe game using Swift and taking input text input- You.docx
 
Create a shell script file called q4-sh.docx
Create a shell script file called q4-sh.docxCreate a shell script file called q4-sh.docx
Create a shell script file called q4-sh.docx
 
Create a python zork file based on the following UML- Use command func.docx
Create a python zork file based on the following UML- Use command func.docxCreate a python zork file based on the following UML- Use command func.docx
Create a python zork file based on the following UML- Use command func.docx
 
Create a new python program- sniff_spoof_icmp-py- The program shall sn.docx
Create a new python program- sniff_spoof_icmp-py- The program shall sn.docxCreate a new python program- sniff_spoof_icmp-py- The program shall sn.docx
Create a new python program- sniff_spoof_icmp-py- The program shall sn.docx
 
Create a new webpage called -activity2-html-- This new page must inclu.docx
Create a new webpage called -activity2-html-- This new page must inclu.docxCreate a new webpage called -activity2-html-- This new page must inclu.docx
Create a new webpage called -activity2-html-- This new page must inclu.docx
 
Create a multi-client-single server application to check whether the n.docx
Create a multi-client-single server application to check whether the n.docxCreate a multi-client-single server application to check whether the n.docx
Create a multi-client-single server application to check whether the n.docx
 
Create a list containing decimal numbers- Write a program to find the.docx
Create a list containing decimal numbers- Write a program to find the.docxCreate a list containing decimal numbers- Write a program to find the.docx
Create a list containing decimal numbers- Write a program to find the.docx
 
Create a JAVA class called Staff that has the following attributes- St.docx
Create a JAVA class called Staff that has the following attributes- St.docxCreate a JAVA class called Staff that has the following attributes- St.docx
Create a JAVA class called Staff that has the following attributes- St.docx
 
Create a Java class with the below attributes- Create a class called.docx
Create a Java class with the below attributes-  Create a class called.docxCreate a Java class with the below attributes-  Create a class called.docx
Create a Java class with the below attributes- Create a class called.docx
 
Create a JAVA class called Faculty that has the following attributes-.docx
Create a JAVA class called Faculty that has the following attributes-.docxCreate a JAVA class called Faculty that has the following attributes-.docx
Create a JAVA class called Faculty that has the following attributes-.docx
 
Create a garden project - Submit a project scope document - Submit R.docx
Create a garden project   - Submit a project scope document - Submit R.docxCreate a garden project   - Submit a project scope document - Submit R.docx
Create a garden project - Submit a project scope document - Submit R.docx
 
Create a file named insert-php and add the new records in to your rese.docx
Create a file named insert-php and add the new records in to your rese.docxCreate a file named insert-php and add the new records in to your rese.docx
Create a file named insert-php and add the new records in to your rese.docx
 
Corporate Fund started the year with o net asset value of $30-80- By y.docx
Corporate Fund started the year with o net asset value of $30-80- By y.docxCorporate Fund started the year with o net asset value of $30-80- By y.docx
Corporate Fund started the year with o net asset value of $30-80- By y.docx
 

KĂŒrzlich hochgeladen

Inclusivity Essentials_ Creating Accessible Websites for Nonprofits .pdf
Inclusivity Essentials_ Creating Accessible Websites for Nonprofits .pdfInclusivity Essentials_ Creating Accessible Websites for Nonprofits .pdf
Inclusivity Essentials_ Creating Accessible Websites for Nonprofits .pdfTechSoup
 
ECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptx
ECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptxECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptx
ECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptxiammrhaywood
 
Earth Day Presentation wow hello nice great
Earth Day Presentation wow hello nice greatEarth Day Presentation wow hello nice great
Earth Day Presentation wow hello nice greatYousafMalik24
 
ICS2208 Lecture6 Notes for SL spaces.pdf
ICS2208 Lecture6 Notes for SL spaces.pdfICS2208 Lecture6 Notes for SL spaces.pdf
ICS2208 Lecture6 Notes for SL spaces.pdfVanessa Camilleri
 
MULTIDISCIPLINRY NATURE OF THE ENVIRONMENTAL STUDIES.pptx
MULTIDISCIPLINRY NATURE OF THE ENVIRONMENTAL STUDIES.pptxMULTIDISCIPLINRY NATURE OF THE ENVIRONMENTAL STUDIES.pptx
MULTIDISCIPLINRY NATURE OF THE ENVIRONMENTAL STUDIES.pptxAnupkumar Sharma
 
Full Stack Web Development Course for Beginners
Full Stack Web Development Course  for BeginnersFull Stack Web Development Course  for Beginners
Full Stack Web Development Course for BeginnersSabitha Banu
 
Concurrency Control in Database Management system
Concurrency Control in Database Management systemConcurrency Control in Database Management system
Concurrency Control in Database Management systemChristalin Nelson
 
Virtual-Orientation-on-the-Administration-of-NATG12-NATG6-and-ELLNA.pdf
Virtual-Orientation-on-the-Administration-of-NATG12-NATG6-and-ELLNA.pdfVirtual-Orientation-on-the-Administration-of-NATG12-NATG6-and-ELLNA.pdf
Virtual-Orientation-on-the-Administration-of-NATG12-NATG6-and-ELLNA.pdfErwinPantujan2
 
Active Learning Strategies (in short ALS).pdf
Active Learning Strategies (in short ALS).pdfActive Learning Strategies (in short ALS).pdf
Active Learning Strategies (in short ALS).pdfPatidar M
 
USPSÂź Forced Meter Migration - How to Know if Your Postage Meter Will Soon be...
USPSÂź Forced Meter Migration - How to Know if Your Postage Meter Will Soon be...USPSÂź Forced Meter Migration - How to Know if Your Postage Meter Will Soon be...
USPSÂź Forced Meter Migration - How to Know if Your Postage Meter Will Soon be...Postal Advocate Inc.
 
Global Lehigh Strategic Initiatives (without descriptions)
Global Lehigh Strategic Initiatives (without descriptions)Global Lehigh Strategic Initiatives (without descriptions)
Global Lehigh Strategic Initiatives (without descriptions)cama23
 
Visit to a blind student's school🧑‍🩯🧑‍🩯(community medicine)
Visit to a blind student's school🧑‍🩯🧑‍🩯(community medicine)Visit to a blind student's school🧑‍🩯🧑‍🩯(community medicine)
Visit to a blind student's school🧑‍🩯🧑‍🩯(community medicine)lakshayb543
 
HỌC TỐT TIáșŸNG ANH 11 THEO CHÆŻÆ NG TRÌNH GLOBAL SUCCESS ĐÁP ÁN CHI TIáșŸT - Cáșą NĂ...
HỌC TỐT TIáșŸNG ANH 11 THEO CHÆŻÆ NG TRÌNH GLOBAL SUCCESS ĐÁP ÁN CHI TIáșŸT - Cáșą NĂ...HỌC TỐT TIáșŸNG ANH 11 THEO CHÆŻÆ NG TRÌNH GLOBAL SUCCESS ĐÁP ÁN CHI TIáșŸT - Cáșą NĂ...
HỌC TỐT TIáșŸNG ANH 11 THEO CHÆŻÆ NG TRÌNH GLOBAL SUCCESS ĐÁP ÁN CHI TIáșŸT - Cáșą NĂ...Nguyen Thanh Tu Collection
 
Integumentary System SMP B. Pharm Sem I.ppt
Integumentary System SMP B. Pharm Sem I.pptIntegumentary System SMP B. Pharm Sem I.ppt
Integumentary System SMP B. Pharm Sem I.pptshraddhaparab530
 
How to do quick user assign in kanban in Odoo 17 ERP
How to do quick user assign in kanban in Odoo 17 ERPHow to do quick user assign in kanban in Odoo 17 ERP
How to do quick user assign in kanban in Odoo 17 ERPCeline George
 
How to Add Barcode on PDF Report in Odoo 17
How to Add Barcode on PDF Report in Odoo 17How to Add Barcode on PDF Report in Odoo 17
How to Add Barcode on PDF Report in Odoo 17Celine George
 
THEORIES OF ORGANIZATION-PUBLIC ADMINISTRATION
THEORIES OF ORGANIZATION-PUBLIC ADMINISTRATIONTHEORIES OF ORGANIZATION-PUBLIC ADMINISTRATION
THEORIES OF ORGANIZATION-PUBLIC ADMINISTRATIONHumphrey A Beña
 

KĂŒrzlich hochgeladen (20)

Inclusivity Essentials_ Creating Accessible Websites for Nonprofits .pdf
Inclusivity Essentials_ Creating Accessible Websites for Nonprofits .pdfInclusivity Essentials_ Creating Accessible Websites for Nonprofits .pdf
Inclusivity Essentials_ Creating Accessible Websites for Nonprofits .pdf
 
YOUVE GOT EMAIL_FINALS_EL_DORADO_2024.pptx
YOUVE GOT EMAIL_FINALS_EL_DORADO_2024.pptxYOUVE GOT EMAIL_FINALS_EL_DORADO_2024.pptx
YOUVE GOT EMAIL_FINALS_EL_DORADO_2024.pptx
 
ECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptx
ECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptxECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptx
ECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptx
 
Earth Day Presentation wow hello nice great
Earth Day Presentation wow hello nice greatEarth Day Presentation wow hello nice great
Earth Day Presentation wow hello nice great
 
ICS2208 Lecture6 Notes for SL spaces.pdf
ICS2208 Lecture6 Notes for SL spaces.pdfICS2208 Lecture6 Notes for SL spaces.pdf
ICS2208 Lecture6 Notes for SL spaces.pdf
 
MULTIDISCIPLINRY NATURE OF THE ENVIRONMENTAL STUDIES.pptx
MULTIDISCIPLINRY NATURE OF THE ENVIRONMENTAL STUDIES.pptxMULTIDISCIPLINRY NATURE OF THE ENVIRONMENTAL STUDIES.pptx
MULTIDISCIPLINRY NATURE OF THE ENVIRONMENTAL STUDIES.pptx
 
Raw materials used in Herbal Cosmetics.pptx
Raw materials used in Herbal Cosmetics.pptxRaw materials used in Herbal Cosmetics.pptx
Raw materials used in Herbal Cosmetics.pptx
 
Full Stack Web Development Course for Beginners
Full Stack Web Development Course  for BeginnersFull Stack Web Development Course  for Beginners
Full Stack Web Development Course for Beginners
 
Concurrency Control in Database Management system
Concurrency Control in Database Management systemConcurrency Control in Database Management system
Concurrency Control in Database Management system
 
Virtual-Orientation-on-the-Administration-of-NATG12-NATG6-and-ELLNA.pdf
Virtual-Orientation-on-the-Administration-of-NATG12-NATG6-and-ELLNA.pdfVirtual-Orientation-on-the-Administration-of-NATG12-NATG6-and-ELLNA.pdf
Virtual-Orientation-on-the-Administration-of-NATG12-NATG6-and-ELLNA.pdf
 
Active Learning Strategies (in short ALS).pdf
Active Learning Strategies (in short ALS).pdfActive Learning Strategies (in short ALS).pdf
Active Learning Strategies (in short ALS).pdf
 
USPSÂź Forced Meter Migration - How to Know if Your Postage Meter Will Soon be...
USPSÂź Forced Meter Migration - How to Know if Your Postage Meter Will Soon be...USPSÂź Forced Meter Migration - How to Know if Your Postage Meter Will Soon be...
USPSÂź Forced Meter Migration - How to Know if Your Postage Meter Will Soon be...
 
Global Lehigh Strategic Initiatives (without descriptions)
Global Lehigh Strategic Initiatives (without descriptions)Global Lehigh Strategic Initiatives (without descriptions)
Global Lehigh Strategic Initiatives (without descriptions)
 
Visit to a blind student's school🧑‍🩯🧑‍🩯(community medicine)
Visit to a blind student's school🧑‍🩯🧑‍🩯(community medicine)Visit to a blind student's school🧑‍🩯🧑‍🩯(community medicine)
Visit to a blind student's school🧑‍🩯🧑‍🩯(community medicine)
 
HỌC TỐT TIáșŸNG ANH 11 THEO CHÆŻÆ NG TRÌNH GLOBAL SUCCESS ĐÁP ÁN CHI TIáșŸT - Cáșą NĂ...
HỌC TỐT TIáșŸNG ANH 11 THEO CHÆŻÆ NG TRÌNH GLOBAL SUCCESS ĐÁP ÁN CHI TIáșŸT - Cáșą NĂ...HỌC TỐT TIáșŸNG ANH 11 THEO CHÆŻÆ NG TRÌNH GLOBAL SUCCESS ĐÁP ÁN CHI TIáșŸT - Cáșą NĂ...
HỌC TỐT TIáșŸNG ANH 11 THEO CHÆŻÆ NG TRÌNH GLOBAL SUCCESS ĐÁP ÁN CHI TIáșŸT - Cáșą NĂ...
 
FINALS_OF_LEFT_ON_C'N_EL_DORADO_2024.pptx
FINALS_OF_LEFT_ON_C'N_EL_DORADO_2024.pptxFINALS_OF_LEFT_ON_C'N_EL_DORADO_2024.pptx
FINALS_OF_LEFT_ON_C'N_EL_DORADO_2024.pptx
 
Integumentary System SMP B. Pharm Sem I.ppt
Integumentary System SMP B. Pharm Sem I.pptIntegumentary System SMP B. Pharm Sem I.ppt
Integumentary System SMP B. Pharm Sem I.ppt
 
How to do quick user assign in kanban in Odoo 17 ERP
How to do quick user assign in kanban in Odoo 17 ERPHow to do quick user assign in kanban in Odoo 17 ERP
How to do quick user assign in kanban in Odoo 17 ERP
 
How to Add Barcode on PDF Report in Odoo 17
How to Add Barcode on PDF Report in Odoo 17How to Add Barcode on PDF Report in Odoo 17
How to Add Barcode on PDF Report in Odoo 17
 
THEORIES OF ORGANIZATION-PUBLIC ADMINISTRATION
THEORIES OF ORGANIZATION-PUBLIC ADMINISTRATIONTHEORIES OF ORGANIZATION-PUBLIC ADMINISTRATION
THEORIES OF ORGANIZATION-PUBLIC ADMINISTRATION
 

Write a program that prompts the user to input a sequence of character.docx

  • 1. Write a program that prompts the user to input a sequence of characters and outputs the number of vowels. (Use the function is Vowel written in Programming Exercise 2.) Solution VowelTest.java import java.util.Scanner; public class VowelTest { /** * @param args */ public static void main(String[] args) { // TODO Auto-generated method stub Scanner scan = new Scanner(System.in); System.out.println("Please enter the sequence of characters :"); String s = scan.nextLine(); boolean status = false; int vowelCount = 0; for(int i=0; i<s.length(); i++){ status = isVowel(s.charAt(i)); if(status == true){ vowelCount++; } } System.out.println("The Number of Vowels : "+vowelCount); } public static boolean isVowel(char c){ boolean status = false; char vowels[] = {'a','e','i','o','u','A','E','I','O','U'}; for(int i=0; i<vowels.length; i++){ if(vowels[i] == c){ status = true;
  • 2. break; } } return status; } } Output: Please enter the sequence of characters : Hai Good Morning The Number of Vowels : 6