Method named isallvowels that returns

Assignment Help JAVA Programming
Reference no: EM13161168

Write a method named isAllVowels that returns whether a String consists entirely of vowels (a, e, i, o, or u, case-insensitively). If every character of the String is a vowel, your method should return true. If any character of the String is a non-vowel, your method should return false. Your method should return true if passed the empty string, since it does not contain any non-vowel characters.

For example, here are some calls to your method and their expected results:

CallValue Returned
isAllVowels("eIEiO") true
isAllVowels("oink") false

Code:

public static boolean isAllVowels(String s)
{
boolean flag = false;
for (int i = 0; i < s.length(); i++)
{
switch(Character.toLowerCase(s.charAt(i)))
{
case 'a':
case 'e':
case 'i':
case 'o':
case 'u':
//case " " :
flag = true;
break;
default:
flag = false;
}
}

return flag;
}


public static void main (String args[])
{

System.out.println(isAllVowels("eIEiO"));
System.out.println(isAllVowels("oink"));
}

Reference no: EM13161168

Questions Cloud

State what is the frequency of light : A red laser pointer emits light with a wavelength of 660. What is the frequency of this light? 2.What is the energy of one of these photons?
How can predator populations function as agents : How can predator populations function as agents of natural selection in prey populations? How can prey populations function as agents of natural selection in predator populations?
The arm assembly language routine : For the ARM assembly language routine below, what function does it perform for the calling program?
Method called wordlengths that accepts a scanner : Write a method called wordLengths that accepts a Scanner representing an input file as its argument. Your method should read from the given file.
Method named isallvowels that returns : Write a method named isAllVowels that returns whether a String consists entirely of vowels (a, e, i, o, or u, case-insensitively). If every character of the String is a vowel, your method should return true. If any character of the String is a non-vo..
Multidimensional arrays : multidimensional arrays to life, let's consider a specific example: How can you visualize a 4-dimensional array? How can you give meaning to each dimension this array has? What kind of application would such an array be useful for?
What is the energy required to move a mole of urea out : What is the energy required to move a mole of urea out of the kidney cells and into the urine?
What is the minimal total weight of cylinders : A scuba diver uses a special equipment for diving. He has a cylinder with two containers: one with oxygen and the other with nitrogen. Depending on the time he wants to stay under water and the depth of diving the scuba diver needs various amount of ..
Create a file, shared.txt : When your program starts, it shall do the following:1. Create a file, SHARED.txt, in the current directory (cwd). 2. Write it's pid (Process ID) followed by a Carriage Return and Newline in the file.

Reviews

Write a Review

JAVA Programming Questions & Answers

  Consider a typical certification hierarchy

Why might Bob still not trust that the certificate for Alice truly establishes Alice as the owner of the public key in the certificate?

  Prepare executable program and a dictionary program

Prepare executable program and a dictionary Program.

  A remote web-based file storage application

Develop a web-based application. The server-side part of the application must be developed using Java Servlets (possibly including JSP). The development of the client (browser) side will typically be a combination of HTML and Javascript.

  Design and implement a sorting algorithm

Your task is to design and implement a sorting algorithm and running time grows as a linear function of the array

  Construct java program named collegelist

Construct a set of classes for a college to use in many student service and personnel applications. Classes you require to design include following:

  Java program use breadth-first search closest broadcast

Write the java program which will use breadth-first search (which you implement as part of your program) to determine the closest broadcast vertex for each vertex in graph.

  Point of sale terminal

a software implementation of a Point of Sale terminal at a typical store. The users of the system are the cashiers sitting at the sales terminals of the store. The users can use the system to manage sales items in the store, customer details and of c..

  Write java programming to show number of credits for course

Write the java programming to solve following problem. We are given a student's marks in Calculus 1, CS1, and Physics 1 (each mark being between 0 and 100) also number of credits for each course.

  Write down the java code for the bank

Write down the java code for the bank of Fraud. User is presented with menu which looks something like this: 1. Deposit 2. Withdrawal 3. Check Balance 4. Exit.

  Multiple choice java programming questions

Determine which of the following may be a violation of information hiding if inserted for the comment above?

  Java program to find solution of cryptarithmetic puzzle

A solution to puzzle is S=9, R=8, O=0, M=1, Y=2, E=5, N=6, D=7. Write down a java program which finds solution to cryptarithmetic puzzle of: TOO + TOO + TOO + TOO = GOOD.

  Java project

Prompt the user for an int between lower and upper boundary.

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd