Latest Tutorials| Questions and Answers|Ask Questions?|Site Map



Home Answers Viewqa Java-Beginners search for a name
Login         

View Questions and Answers by Category

Advertisements


 
Have Programming Question? Ask it here!
 
 
 


Rosmi Stephen
search for a name
1 Answer(s)      3 years and 10 months ago
Posted in : Java Beginners


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?}


Advertisement
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
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   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
search
search  how to develop search box and how to retrive data from database..   Please visit the following link: Search box
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 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 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
Search index
Search index  how to write code for advanced search button
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
SEARCH AND SORT
SEARCH AND SORT  Cam any one provide me the code in java that : Program to search for MAX,MIN and then SORT the set using any of the Divide and conquer method
iPhone Baby Name App, iPhone Baby Name, Baby Names application for iPhone
. In our iPhone baby name application search is very fast and you can search... internet to search a baby name Baby names application runs...iPhone Baby Name App - World Baby Names
Search Engine
Search Engine  I have gone through the below mentioned link document to create search engine and fetch the data from mysql database.But i am getting errors. http://www.roseindia.net/sql/mysql-table/sql-search.shtml Error: Notice
sql query search function
sql query search function  i have a textbox on a form , i like a search a data in the form, when i give whatever name and id or etc..its will search and show the same form , so help me using jsp
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
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
Google Search
Google Search  I have a textbox and submit button in my JSP page. On giving word in the textbox and click submit it should redirct to google search page and fetch all the results based on my input word automatically. JSP/Servlet
Array search
for the search operation. he value with one or more of the array items. Search begins
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
personal name aliase from the web
personal name aliase from the web  enter the name to search result in internet connection
php search variable
php search variable  Search variable in PHP
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
AJAX Search
.. <?php $db_host = 'Your database host name'; $db_username = 'Your datbase username'; $db_password = 'Your database password'; $db_name = 'Your database name'; $db = new mysqli($db_host, $db_username ,$db_password, $db
simple java search engine
simple java search engine  i have already downloaded the project simple java search engine.but i am not able to run it.can anyone help me.i have.... ABSTRACT Title : Simple Search Engine System Specification: The system on which
Lucene Search in JSP - JSP-Servlet
Lucene Search in JSP  Hello Sir, I want to Develop lucene - Search engine in Jsp page which can Search full text from XML file..through XML parser.. Example: in Search interface there are one textbox after putting some value
search filter and JTable
search filter and JTable  I first im not speak englis very well, so my question is: how can i make search data in JTable of java? i wan to search... java.sql.*; import java.awt.event.*; import javax.swing.*; class Search{ public
email search code in php
email search code in php  email search with multiple option in php
javascript code for search in html file
javascript code for search in html file  Hi, I am looking for javascript code through which we can search data with specific name find in any rows in the table. Example: Id Name P001 A P002 B P003 C P004 P002 P005
JAVA: Recusrion, Binary Search
. Search medical records by animal name, owner, and animal kind (like show all...JAVA: Recusrion, Binary Search  I want to learn about Binary Search... information: Owner. Name of the animal. Age of the animal. Medical history
Advertisements
 

 

 

DMCA.com