search for a name

search for a name

Search for a name

Write a program to accept an array of names and a name and check whether the

name is present in the array. Return the count of occurrence. Use the following

array as input

{?Dave?, ?Ann?, ?George?, ?Sam?, ?Ted?, ?Gag?, ?Saj?, ?Agati?, ?Mary?, ?Sam?,

?Ayan?, ?Dev?, ?Kity?, ?Meery?, ?Smith?, ?Johnson?, ?Bill?, ?Williams?, ?Jones?,

?Brown?, ?Davis?, ?Miller?, ?Wilson?, ?Moore?, ?Taylor, ?Anderson?, ?Thomas?,

?Jackson?}

View Answers

May 26, 2011 at 11:51 PM

import java.io.*; import java.util.StringTokenizer;

public class CountOccurance { public static void main(String args[])throws Exception { InputStreamReader isr=new InputStreamReader(System.in); BufferedReader br=new BufferedReader(isr);

print("code sample");
System.out.println("ENTER ARRAY OF NAMES:"); String arrNames=br.readLine();

StringTokenizer st1=new StringTokenizer(arrNames);

System.out.println("ENTER THE NAME TO BE SEARCHED:");
String name=br.readLine();

int countNoOccurance=0;

while(st1.hasMoreTokens())
{
  if(name.equalsIgnoreCase(st1.nextToken()))
  {
    countNoOccurance++;

  }
}

System.out.println("THE NAME "+name+" HAS BEEN APPEARED "+countNoOccurance+" NO. OF TIMES");

}

}

*Sayem*









Related Tutorials/Questions & Answers:
search for a name
search for a name  Search for a name Write a program to accept an array of names and a name and check whether the name is present in the array. Return the count of occurrence. Use the following array as input {?Dave?, ?Ann
How to search the table name in MS SQL Database 2005 from application
How to search the table name in MS SQL Database 2005 from application  How to search the table name in MS SQL Database 2005 from application from our helpdesk application? application might be in html
Advertisements
ModuleNotFoundError: No module named 'odoo11-addon-base-name-search-improved'
ModuleNotFoundError: No module named 'odoo11-addon-base-name-search-improved...: ModuleNotFoundError: No module named 'odoo11-addon-base-name-search-improved' How...-name-search-improved After the installation of odoo11-addon-base-name-search
ModuleNotFoundError: No module named 'odoo8-addon-base-name-search-improved'
ModuleNotFoundError: No module named 'odoo8-addon-base-name-search-improved...: ModuleNotFoundError: No module named 'odoo8-addon-base-name-search-improved' How to remove the ModuleNotFoundError: No module named 'odoo8-addon-base-name-search
ModuleNotFoundError: No module named 'odoo9-addon-base-name-search-improved'
ModuleNotFoundError: No module named 'odoo9-addon-base-name-search-improved...: ModuleNotFoundError: No module named 'odoo9-addon-base-name-search-improved' How to remove the ModuleNotFoundError: No module named 'odoo9-addon-base-name-search
Name
Name  make a program that take a input from user in alphabet and show all the name of that character E.g User give character "B". The program shows all the human names which starts from B.   Java show all names
SEARCH
SEARCH  how can we do search in jsp...? option for search criteria like name and DOB...   Please visit the following links: http://www.roseindia.net/jsp/user-search.shtml http://www.roseindia.net/servlets/search.shtml
search
search  how to develop search box and how to retrive data from database..   Please visit the following link: Search box
Search
Search   Hi, I have a project in which I am trying to enter "Marathi" (Indian local language) data in JSP using JSTL and trying to search data... and tries to search then It shows no data from database
Name unique
Name unique  I want to check whether the value which I give for the name textfield already exists in the database. In case if it exists , it should.... In other words, value for the name should be unique
class name
class name  what is the class name of circle.java   how do i complie my jdk file, what happen s if i put in the correct commands and it still does not complie, what do i do next
iPhone Baby Name App, iPhone Baby Name, Baby Names application for iPhone
name application search is very fast and you can search the names... internet to search a baby name Baby names application runs...iPhone Baby Name App - World Baby Names
personal name aliases
personal name aliases  name to enter.but search in internet connection   Please visit the following links: http://www.roseindia.net/servlets/search.shtml http://www.roseindia.net/answers/viewqa/JSP
personal name aliases
personal name aliases  enter the name search result in internet connection using java code   Please visit the following links: http://www.roseindia.net/servlets/search.shtml http://www.roseindia.net/answers/viewqa/JSP
personal name aliase from the web
personal name aliase from the web  enter the name to search result in internet connection
SEARCH PAGE
SEARCH PAGE  search page:option for search criteria like name and DOB will be asked.on entering the detail,data matching search criteria will be displayed..criteria can be both or any one of them.. can you send code
Search index
Search index  how to write code for advanced search button
Java class name and file name are different
Java class name and file name are different  Can we run a Java program having class name and file name different?   Hi Friend, No, you can't. It is necessary to save the java file with its class name otherwise
Person have name field of Name type..??
Person have name field of Name type..??  Person have name field of Name type means i understood to create new Name class with fields firstname... name? can you please write code two two different class and show me how to use
search program
search program  i m writing program which takes company names from databse...serch on google...n try to find the best match WEBSITE...of company name....m confused....how can i find best match..between my company name ..and all
automatic discovery personal name aliases from the web
automatic discovery personal name aliases from the web  gogle web page display search the result
automatic discovery personal name aliases from the web
automatic discovery personal name aliases from the web  i want for web search area display code
Hibernate Search
Hibernate Search  Where to learn Hibernate Search module? Thanks   Hi, Check the tutorial: Hibernate Search - Complete tutorial on Hibernate Search Thanks
linear search
linear search  write a program to find string using linear search
automatic discovery personal name aliases from the web
automatic discovery personal name aliases from the web  enter the name and enter the button to search result for internet connection below
automatic discovery personal name aliases from the web
automatic discovery personal name aliases from the web  create a text field in enter the name and search button to below result in internet connection
"The folder name is not valid" netbeans
"The folder name is not valid" netbeans  "The folder name is not valid" while crating a jsp,html or any page in netbeans
Stoting file name in Map
Stoting file name in Map  how to store id and file name in map
Change the name of the grades
Change the name of the grades  Hi, i'm developing with polar chart and i want to change the name of the grades, for example: add("variable name",5) insted of add(20, 5). Somebody know how to do it? Tanks
search feature - JSP-Servlet
search feature  i need help to do a search feature servlet to search for employees from the database. the search will be done by search by employee name, department and email  Hi friend, As per your problem
NameError: name 'SparkConf' is not defined
NameError: name 'SparkConf' is not defined  Hi, What is solution of the error: NameError: name 'SparkConf' is not defined Thanks   Hi, You should import following line: from pyspark import SparkConf, SparkContext
Altering a Column name in a table
Altering a Column name in a table  how to alter column name in MSSQL server 2005 the codesample given using "change" keyword alter table tablename change oldcolumnname to newcolumnnameADS_TO_REPLACE_1 is not working
NameError: name 'SparkConf' is not defined
NameError: name 'SparkConf' is not defined  Hi, What is solution of the error: NameError: name 'SparkConf' is not defined Thanks   Hi, You should import following line: from pyspark import SparkConf, SparkContext
Java Program MY NAME
Java Program MY NAME   Write a class that displays your first name... with the following name (for example, for letter A, public displayLetterA... in the correct order to display your name
tag name in xml
tag name in xml  How to get tag name in xml?   <?xml...="http://www.w3.org/1999/XSL/Transform"> <xsl:variable name="outermostElementName" select="name(/*)" /> <xsl:template match="/"> <xsl
SQL Alter Column Name
SQL Alter Column Name       Alter Column Name in SQL is used to change or modify the name... The Tutorial explain you a simple example on SQL Alter Column Name
NameError: name 'np' is not defined
NameError: name 'np' is not defined  Hi, In my python program following error is coming: NameError: name 'np' is not defined How to solve this? Thanks   Hi, This error is coming because you have not imported
NameError: name 'metrics' is not defined
NameError: name 'metrics' is not defined  Hi, In one of my machine learning code following error is coming: NameError: name 'metrics' is not defined How to solve this? Thanks   Hi, You should import following
Impact on change of table name
the table name. If there are dependencies or anything else related to the table... Alwala   Use the given query to change the table name. RENAME TABLE.... Only the table name will get changed
name of year in chinese
name of year in chinese   hello my name kiemtheng i'm come from Cambodia, i would to write java programming to calculate a name of year for each birthday in Chinese but i dont know how to do.   import java.util.
My name, java project
My name, java project  Write a class that displays your first name vertically down the screen â?? where each letter uses up to 5 rows by 5 columns... that letter in a method with the following name (for example, for letter A, public
My name, java project
My name, java project  Write a class that displays your first name vertically down the screen â?? where each letter uses up to 5 rows by 5 columns... that letter in a method with the following name (for example, for letter A, public
How to register domain name
purposes or for your family then should take relevant name. Search...Domain name registration is the first step to start any website.  Website requires a name to be known and referred to on the web. Domain name
display the employee name
display the employee name  when i will select one employee designation based on that employee designation display the particular designation employee name display in another select box how it possible using servlet and mysql
NameError: name 'false' is not defined
NameError: name 'false' is not defined  Hi, My code is giving NameError: name 'false' is not defined. My code is below: if(filename.endswith(".txt") == true): print("Text file") How to solve? Thanks   HI, You
property name= hibernate.archive.autodetection
property name= hibernate.archive.autodetection  Hi, How to set the property name= hibernate.archive.autodetection in my Hibernate project. Can...;property name="hibernate.archive.autodetection" value="class, hbm"/> You
docker remove image by name
docker and trying some images. I want to delete an image by name or id. How to remove image by name or id in docker with command? What is command for docker removing image by name/id? Thanks   Hi. First of all you get the list
parser error xmlparseentityref no name
parser error xmlparseentityref no name  While parsing the error in my mobile application ..i'm getting the following error.. "parser error xmlparseentityref no name" and that is because of "&". I have also tried the "&
No SDK with the name or path
No SDK with the name or path  When i run any downloaded application on my mac professional ..it always returns a message no sdk with the name... Missing or No SDK with the name or path for XYZ version follow the steps below
name of year in chinese
name of year in chinese   hello my name kiemtheng i'm come from Cambodia, i would to write java programming to calculate a name of year for each birthday in Chinese but i dont know how to do.   import java.util.

Ads