Thursday, October 31, 2019

Econ Essay Example | Topics and Well Written Essays - 750 words

Econ - Essay Example This paper will look at the law of supply and demand and how it is applied in real life. The law of supply and demand is perhaps the most basic concepts taught in economics class. The law of supply and demand enables us to understand the setting of quantity demanded and price set in the market. It also stresses that the price level and quantity demanded varies according to changes in the markets through which there are movements within or shifts in demand and supply curves. First, the law of supply stresses that: (1) "at higher prices, producers are willing to offer more products for sale than at lower prices;" (2) "the supply increases as prices increases and decreases as prices decreases;" and (3) "those already in business will try to increase production as a way of increasing profits" (qtd from Reviews of Laws of Supply and Demand 1). This law creates a supply curve which is upward sloping. Logically speaking, manufacturers will tend to decide to supply more in the market if the price for their product is high. With lower prices, they have less motivation to increase production as profits are squeezed out. On the other hand, the law of demand states that: (1) "people will buy more of a product at a lower price than at a higher price;" (2) "at a lower price, more people can afford to buy more goods and more of an item more frequently, than they can at a higher price;" and (3) "at lower prices, people tend to buy some goods as a substitute for other more expensive"(qtd from Reviews of Laws of Supply and Demand 2). These reasons are consistent with the fact that people want to maximize utility through the consumption of more goods and services. Since they only have limited income, their overall aim is to find lower prices or lower priced goods in order to allocate this budget most efficiently. The law of demand and supply determines the price charged and the quantity demanded in the market. Through market forces, the prices tend to be at equilibrium where suppliers are willing to sell goods and buyers would be willing to pay at that level. With this intersection also is the quantity demanded which determines the amount that buyers are willing to buy and suppliers are willing to provide the market with. The operation of the law of supply and demand becomes more apparent in the present economic situation in the US. As customers struggle with lower income levels, they tend to buy lower priced goods than higher priced ones. This is true in my case; price becomes one of the primary considerations in my purchases because I would want to maximize the utility that I derive from my money. Also, I would demand more of a product if the price is lower. For instance, since burgers cost $4, I would only have to consume 1 in order to have money for drinks. However, if the price goes down to $2 each, then I will be willing to purchase two burgers. For a supplier, prices now also become more constraining. They wouldn't want to sell products which will not be profitable for them. Using the burger example and assumption of $4 as the equilibrium price, suppliers would be willing to supply 20 burgers at that level. Raise the price to $5 and they would say that they would even want to supply 30 or more because of the profit prospect. If prices decline to $2, then they might

Tuesday, October 29, 2019

Graduation Day Speech Essay Example for Free

Graduation Day Speech Essay April 1, 2007 our graduation day. Our final day in high school. The day weve been waiting for. The day wherein we are going to close another chapter of our lives, to finally cross the line, to reach the stars and sadly, to say goodbye. Four years. Four years of projects, assignments, examinations, bundles of research papers cramming so hard just to pass it on the deadly deadline clearances, and a whole lot more. But then, its still just the first phase, we still need to continue what we have started. And thats the college life. A lot will change, for sure. But the memories, the fun, the experiences It all cant be taken away just like that. High school life is still the best ever. Here, we can feel the hardships, sense of responsibility, the fun of life, the game of love, the puzzle of choices, the mending of heartaches, the signal to move on, the time that we are being pressured, the friends we can talk to, the teachers we once both loved and hated, the events we will never forget. Every start has an end. But hey, the question is: Is this really the end of it? I dont think so. I know that therell be more to come. Â  Think positive always. Set your choices and goals in life on the right track. Cite your target and aim to success! All of these, all of what we have now were made possible by our hard work, the sweat and blood of our parents and the guidance of God. May it be that what we have learned over the past years will mold us to be better people. People who dont just go along with this fast-paced world, but people who see the end of the road clearly. As what Mr. Gasapo said last Friday night, You must have a 20/20 vision. Fellow graduates, that paper your diploma is your key to that dimension. A dimension which will offer a lot of opportunities to choose from. And from these opportunities, will be your life. Live that life. Never waste it. Stand to what you believe in is right, as long as it is really the right one. Show the power of the youth. Dont put yourself down caused by the words of other people. Take it as a challenge in life and say, This will pass. Yes, this will pass. We have passed a lot of controversies. Our unique batch survived and will continue to survive the quest of life. From Qui Seperabit? to Con Brio, we held hands and fought the strong waves. And here we are, with our caps and togas on, ready to pursue what we really wanted. The class prophecy said it all. Who knows? During our alumni homecoming, it might all come true. Today, Ill take this opportunity to plug a website. It is where the farewell speeches of my fellow graduates are posted on. Please, if you have time, visit www.nmaconbrio.tk. With this simple site, may it bring back and reminisce thoughts of high school life to you. Con Brio 2007, we are indeed with vigor and brilliancy. Hold that name wherever you go and be proud! May I request the Con Brio 2007 to please sing with me the first stanza of our class song, Goodbye my Friend. (-) Yes, let us keep the knowledge we have learned. Let us live the dreams we have dreamed of. Let us show the world what we really have. Together, forever, we will stand. We will bid goodbye today, but never will we go away. We will look back to our alma mater for it is here, where it all began. Farewell! Farewell! Hope to see you again in the crossroads of life.

Sunday, October 27, 2019

The cause and effect of Gangs in Society

The cause and effect of Gangs in Society According to Street Wars by Tom Hayden, an estimate of over 25,000 young people in the United States, the majority of them African American and Latino, have been killed in street wars during the past two decades (Hayden, Foreword). Because of these violent events, those who live in poorer areas of the country are stereotyped: every child with a tattoo and street child is stigmatized as a criminal who is creating an unfriendly climate for investment or tourism in the country(Hayden, Preface, IX). Gangs never used to be called gangs, and some still do not call themselves gangs(Hayden, 2). Although several gang members see themselves as a family or neighborhood, it is pointed out that gangs are essentially a criminal enterprise(Hayden, 3). This review of literature will examine the factors that contribute to the cause of people coming together to commit crimes, as well as the question of whether the decisions made to join gangs are forced or made at free will. An explanation for the gro wth of gangs is the continuation of extreme poverty and isolation among the generation labeled at risk in our nations cities(Hayden, 16). The stereotype that these people are all criminals has become one of the reasons gangs rebel against the society just because it was wrong and violated societys standards of acceptable behavior(Carrigan, 278). Growing Up Without Proper Nurturing Gang members often come from dysfunctional, abusive, or broken homes, poor living conditions, lack of parental discipline, neglect and low incomes(Carrigan, 285). A variety of studies have shown that a lack of time spent nurturing and properly disciplining children can be a significant contributor to problem behavior(Carrigan, 305). The National Center of Health Statistics in 1988 discovered that, Childrens well being is associated with family structurechildren from divorced families and those living with single parents have been found to have more emotional, behavioral, and academic problems than children living with both of their biological parents (Carrigan, 287). For the upbringing of gang members from single parent households, it wasnt so much the family status that caused the problem. Rather, the status brought on stresses and strains that contributed to the deprivation of good parenting(Carrigan, 287). Jane Rodd, an experienced social worker, states that, What society has to l earn is that children growing up have needs: support, love, respect, fair discipline and a family with positive social values. If these elements are not a strong part of childhood development, the child may well become antisocial as a youth(Carrigan, 287). Study done for the Ministry of the Solicitor General of Canada (1985) reviewed the literature on family relationships and delinquency and reached the conclusions that family criminality, whether it be parents or siblings, is a powerful predictor of childrens delinquency, and parental supervision, followed by mothers affection during childhood, appear to be the two most important variables accounting for adult criminality(Carrigan, 286). Some of the gang members are even homeless, either because their parents are on drugs and they discard them, or they have no homes and the children drift away(Castro). Most gang members have nothing to live for, except their hood. They pledge allegiance to their neighborhood gang, and it becomes their whole wide world, their family. Their loyalty is fierce(Castro). Donald J. McKinnon suggests that the main cause of juvenile delinquency is the lack of a sense of responsibility on the part of parents in the matter of bringing up and training children, l eaving them out on the streets(Carrigan, 284). The particular culture of a lower-class community is seen as one of the major factors that causes gang delinquency(Carrigan, 278). The individual is influenced by the norms of the gang, which in turn reflect modes of behavior acceptable to a lower-class culture. These norms are different from the middle-class culture, which places a higher value on conformist behavior(Carrigan, 278). Throughout American history, a high percentage of delinquents has come from poor economic backgrounds. The correlation led to the easy conclusion that poverty causes crime(Carrigan, 283). It is conveniently forgotten that the sources of most street gangs lie in violent oppression, dispossession, and migration(Hayden, 200). In the twenty-first century, the new generation has been Brought up in a materialistic environment, indulged, protected, and taught by consumer-oriented society that instant gratification was a normal expectation in life, therefore youths often lacked patience and an ability to cope wi th frustration(Carrigan 299). Influences in the past that had helped to nurture values and character were, by the 1960s, either substantially diminished or gone(Carrigan, 300). The decline in the influence of the churches, less emphasis on values education in the schools, and the diminution of the role of the state as a moral agent have contributed to the lessening of interest in the role of values as a governor on human behavior(Carrigan, 288). Heredity While bad neighborhoods and lack of moral education is blamed for the formation of gangs, some studies indicate that the urge to join gangs might lie, at least in part, in their genes(Boys May Feel a Genetic Pull Toward Gangs). Cesare Lombroso (1835-1909), professor of medicine at the University of Turin in Italy, argues that more persistent and violent criminals were born that way. They were throwbacks to a more primitive stage of development(Carrigan, 273). He also defined a criminal as an atavistic being who reproduces in his person the ferocious instincts of primitive humanity and the inferior animals, stating that these people generally have enormous jaws, high cheekbones, prominent superciliary arches, solitary lines in the palms, extreme size of the orbits, handle-shaped or sessile ears found in criminals, savages, and apes; insensibility to pain, extremely acute sight, tattooing, excessive idleness, love of orgies, and the irresistible craving for evil for its own sake, the d esire not only to extinguish life in the victim, but to mutilate the corpse, tear its flesh, and drink its blood(Carrigan, 273). Also, those born with criminal traits start lawless activities at an early age, and constantly demonstrate anger, a spirit of revenge, idleness, volubility and lack of affection(Carrigan, 273). It is said that aggressive behavior is one of the early signs of antisocial and criminal tendencies(Carrigan, 306). Other traits are also said to be hints of rebellion when children grow older: a taste for risk; below average verbal intelligence; response to frustration more likely to involve resentment and anger rather than composure or anxiety, guilt or depression; egocentricism; moral immaturity; and poor problem-solving, coping or self-regulation skills(Carrigan, 281). Children that have high tolerance for deviance in general; rejection of the validity of the law in particular, applies rationalizations for law violations to a wide range of stimuli as reasons for anger, tend to become a lot more rebellious when they grow older(Carrigan, 280). Even the most sensitive among them [the gang members] often have committed terrible violence(Castro). However, those who are insensible to pain are often one of the most violent members in the gangs. One gang member tried to steal a car from this guy, and when the guy resisted, he knocked him down and ran over him with the car. Then he backed up, ran over him again, then he drove around the block and came back and ran over him again. Then he put the car in reverse, and as he ran over the guy a fourth time, the police came along and saw it(Castro). According to a study, Boys who have a variant of the gene monoamine oxidase A(MAOA) otherwise known as the warrior gene are not only more likely to be in gangs than boys without the variant, but they tend to be among the most violent members(Boys May Feel a Genetic Pull Toward Gangs). It is not only the poverty-stricken environment or the broken homes that deprive individuals of a sense of belonging, desperate to join gangs. The study shows that joining gangs also has to do with the genetics of a person (Boys May Feel a Genetic Pull Toward Gangs). Previous research has linked low-activity MAOA variants to a wide range of antisocial, even violent, behavior, but our study confirms that these variants can predict gang membership, the studys lead author, Kevin M. Beaver, a biosocial criminologist at Florida State Universitys College of Criminology and Criminal Justice, said in a university news release. Moreover, we found that variants of this gene could distinguish gang members who we re markedly more likely to behave violently and use weapons from members who were less likely to do either(Boys May Feel a Genetic Pull Toward Gangs). The MAOA gene is believed to affect levels of neurotransmitters such as dopamine and serotonin that are related to mood and behavior, according to the study. Previous research found that the warrior gene is more prevalent in cultures that are typified by warfare and aggression. Strain Theory When someone is unable to gain wealth, power, status, or possessions by legitimate means(Carrigan, 276), due to the frustration felt at being blocked by the system, the individual violates the accepted code of conduct and to resort to illegitimate or illegal means(Carrigan, 277). Strain theory emphasizes the relationship in society between the goals that constitute status and the conventions or does of conduct that regulate the manner in which those aspirations may be pursued(Carrigan, 276). General Strain Theory identifies three major sources of strain: the failure to achieve positively valued goals, the loss of positively valued stimuli, and the presentation of negative stimuli. The first type of strain includes three subtypes: the failure to achieve aspirations or ideal goals, the failure to achieve expectations, and the failure to be treated in a just / fair manner(Broidy and Agnew). It also considers types of strain other than goal blockage, such as the loss of positive stimuli like friends and romantic partners, and the presentation of negative stimuli like excessive demands and verbal, sexual or physical abuse(Broidy and Agnew). The delinquent accepts societys norms that place an importance on the ownership of certain things, but social inequalities, such as poverty, prevent their attainment, therefore turning to crime(Carrigan, 277). Sampson and Wilson (1995) proposed an integrated social disorganization-strain theory in which strain factors are viewed as causing the deterioration of social controls, which are hypothesized to have the more direct effect on crime(DeFronzo). They argue that the forms of social disorganization that promote crime most likely include disrupted, dysfunctional, and/or structurally impaired households; ethnic, racial, and class discrimination and hostility; and the development of deviant subcultures, although they specified that such subcultures are not entirely distinct from the conventional-dominant culture but rather deviant in the sense of fostering at least the tolerance of certain nonconformist behaviors(DeFronzo). Sampson and Wilson concluded that strain factors such as economically generated frustrations or the lack of access to legitimate opportunities tend to create forms of social disorganization. For example, limited economic resources might be expected to result in stresswhi ch, in turn, increases the likelihood of excessive use of alcohol or other drugsand unprotected sexual intercourse outside of marriage often resulting in children being raised in one-parent households(DeFronzo). The Hippie Movement could be one of the examples of gang-like rebellion against mainstream society, although it influenced the culture later on(Carrigan, 300). The revolt of the 1960s was led, disproportionately, by advantaged, well-educated young people who began the first phase of their protest in universitiesWhen faulty and administrations resisted their demands for change, they resorted to protest and sometimes violence to achieve their goals(Carrigan, 300). Clothing styles were changed as an increasing number of people defied convention by opting for casual dress on all occasions, including topless bathing suits; language took on a new coarseness, as four-letter words became the style and symbol of liberation; drug use reached epidemic proportion, as a way of defying legal restraints(Carrigan, 301). It is said that, The social structure itself is the source of the pressure that forces a person into nonconformist or criminal conduct(Carrigan, 276). In a similar way, different strains gang members experience push them into the situation where they would rather commit crimes together than facing their previous struggles(Hayden, 216-217). Conclusion: The formation of gangs hasnt intensified or surfaced until the past few decades(Hayden, 3). It has caused the death of innocent people, and ruined the future for several gang members that initially joined for the sense of belonging, outside of their dysfunctional families and failed relationships. Those who have been bold, allowed themselves to befriend the gang members and have learned more about them as people, have fortunately survived (Castro). They have also been able to turn some lives around, and help them realize gang violence is preventable (Hayden, Foreword). We must put effort into peacemaking, so that our country would become more civilized and be rid of unnecessary violence. Mike Davis from Planet of Slums emphasized that, What is clear is that the contemporary mega-slum poses unique problems of imperial order and social control that conventional geopolitics has barely begun to register. If the aim of the war on terrorism; is to pursue the erstwhile enemy into his sociol ogical and cultural labyrinth, then the poor peripheries of developing cities will be the permanent battlefields of the twenty-first century(Hayden, Preface).

Friday, October 25, 2019

American Health Care: Gore And Bradley One Problem Two Solutions :: essays research papers

The nation's economy has produced 9.5 million jobs in the last four years and raised wages for even the lowest-paid workers. As Americans buy more homes, cars and other consumer goods, the number buying health insurance has not budged. Now, the 44 million Americans without insurance are taking a prominent place in the national spotlight, thanks to the Democratic presidential primary. And in Vice President Al Gore and former senator Bill Bradley, the nation has a chance to sort out how far it is willing to go, if at all, toward promising health care for everyone. In proposals issued recently, both Democratic candidates have promised to cover all 11 million children who have no insurance, with taxpayers paying the entire cost for the poor. Gore and Bradley would also give substantial help to the parents of the nation's poorest children. But they split over one growing class of people: the millions of adults who are not quite poor, but who find insurance so expensive that they do not buy it.Almost 17 percent of full-time workers have no insurance, often because employers do not offer it or have shifted costs to employees. Many of the new jobs created in the current boom are at small businesses, which are less likely to offer coverage. Bradley has proposed an expansive plan that helps people further up the economic ladder and which carries an expansive price tag to match. Gore, by contrast, would spend money on the poorest and near-poor while offering only limited help to others.The question has barely been raised among the Republican presidential contenders. But it has sparked the sharpest debate yet in the Democratic campaign, and polls show that voters are likely to make it a general election issue. With surveys suggesting that no candidate can win the Democratic nomination without a strong health plan, Bradley boasts that he is proposing a big idea to attack a big problem. He has derided Gore's plan as ''definitely timid.'' The tactic has helped raise Bradley's profile among Democrats Gore, by contrast, talks freely of his plan's limitations, and his staff uses the word ''incremental'' to describe it. They say Bradley's plan is too expensive and would divert dollars from other purposes, such as shoring up Medicare.The true cost of the two plans is open to debate. Bradley says he would spend up to $650 billion over 10 years to insure as many as 39 million more people.

Thursday, October 24, 2019

Unusual Festivals

My lecture is about unusual festivals. Could you give me some examples for unusual festival? -Yes that’s true -Don’t you have any idea? I'm sure you have seen some unusual festivals on TV but now you might forgot them. Forexample you imagin a lot of people gathering in a city throwing tomatos at each other just for fun. Have you ever participated in an unusual festival? -Yes: great this is such an interesting experience I'm sure you never fogot that day. -No: no problem I will give you a lot of information about it. I think you might be in charshanbesori.It is held In the last Wednesday of the year. Just as the rest of the world moves forward into the online digital world, there are still various classical traditions from past centuries that retains their popularity with the new younger generation of people. Even as some of these traditions are strange and unusual, they have been held until now. Another example is Halloween. On October 31, in many countries children and adults dress up in unusual costumes. Some become witches or ghosts; others dress up as trees, goats, and in other very unusual costumes.This festival started in Europe and has spread to all parts of the world. However, not all celebrations spread around the world. Every country has its own singular festivals. The first example that I prepared is Festival of Snakes Many people are afraid of snake.. In some parts of the world, snakes are regarded as evil or, at least, dangerous. But, there is one small village in Italy where the people seem to worship snakes. They show their respect and love for snakes with a festival. This festival is held each year in the tiny village of Cocullo, which is surrounded by some of Italy's wildest forests.There is a legend in Cocullo that the surrounding mountains and forests were once full of poisonous snakes. Many of the people from Cocullo who went into these areas died after being bitten by the poisonous snakes. In 700 B. C. , the villagers prayed t o Apollo, a Greek god, for help. Apollo told them to capture the snakes, put them around his statue in the village, and then put them back in the mountains and forests. This seemed to work, and the ritual has been repeated ever since. Over the years, the villagers have made some changes to this tradition.Now a statue of a Christian saint, Domenica, has replaced the statue of the Greek god Apollo. In addition, the villagers have added fireworks to the festival. Celebrations begin on Saint Joseph's Day, March 19, when the first snakes of the season are captured and put in cages. Two months later, on the first Thursday in May, villagers set off fireworks and then go to church. After church, the statue of Saint Domenica is carried through the streets, and villagers put the captured snakes around his statue. Then, more fireworks are set off.At the edge of the village, the snakes are set free in the forest, and the villagers believe that they are immune from snakebites for another year. L a Tomatina The festival of La Tomatina in Bufiol, Spain, is very simple. It is a food fight festival. Everyone throws tomatoes at each other on the last Wednesday of August. The town's streets turn bright red as over 20,000 people hit each other with large, red, soft tomatoes. There are many ideas on how the festival started. The most likely explanation is that it started as a fight between poor and rich teenagers.No one knows who threw the first tomato, but somehow they began throwing tomatoes at each other. Over the years, this local event has become a national event. It is no longer a war between poor and rich and is now an exciting time for young people to have a good time throwing tomatoes at everyone. The standard uniform is an old T-shirt, old shorts, and safety glasses. Farmers bring thousands of tomatoes from around the countryside, and the festival begins with the firing of a rocket. An hour later, the end of the festival is announced with the firing of another rocket, and everyone begins to clean up the town.Zombie Walk A zombie walk is an organized public gathering of people who dress up in zombie costumes. Usually taking place in an urban center, the participants make their way around the city streets or through shopping malls or a local cemetery or other public spaces. Holi- The Festival of Colors This popular Hindu spring festival, observed in India, Nepal, Bangladesh and other Hindu countries, is also known as The Festival of Color. Holi is celebrated at the end of the winter season on the last full moon day of the lunar month, usually in the later part of February or March.It is Originally a festival to celebrate good harvests and fertility of the land. Crying Baby Festival overweight men in this shape can be a very scary sight for many of us. So, you can imagine how babies will react when they are held by one of these men. In Konaki Sumo, a Japanese festival, pairs of babies are held by men like this facing each other. The winner is the baby who cries first. The festival is based on the Japanese proverb â€Å"crying babies grow fast†. Fish-Swallowing Festival the festival involves eating fish but the difference is that they are still alive! t is happend in The last Sunday of every February in Geraardsbergen in Belgium. The ceremony draws protests from animal rights activists who want to substitute live fish with fish-shaped marzipan. Monkey Buffet Festival There really is a festival just for monkeys every year in Thailand. On the last Sunday in November at the Pra Prang Sam Yot temple in Lopburi province, north of Bagkok,thousands of pounds of fruit is gathered for a huge buffet just for monkeys. The festival over the years has become more lavish and has put this small province on the world tourism map. Wife Carrying World ChampionshipsEach summer, this weird event in Sonkajarvi, Finland, becomes more and more popular. The wife-carrying contest has been at a world championship level for over 13 years now. Wife ca rrying is a sport in which male competitors race while each carrying a female teammate. The objective is for the male to carry the female through a special obstacle track in the fastest time. Now my lecture is finished. I want to know your opinion. -Do you think it is a good idea to hold these festivals? For example in tomatina thousands tones of tomato are wasted. While it is possible to cook them and to use them instead of throwing them at each ther. However I have to admit tomatina bring happiness to many of people. But some of them like Crying Baby Festival, Fish-Swallowing Festival, Monkey Buffet Festival and Baby-Jumping Festival are really ridiculous and some of them are really dangerous. -What's your opinion about charsaabesori in Iran? -Do you agree with it or not? Yes I agree with you. Nowadays it become like a urban war. it is such an dangerous night. As all of us know unfortunately many people die and injure seriously. – Do you have any question? Thanks a lot for your consideration.

Tuesday, October 22, 2019

Java Based Search Engine

ACKNOWLEDGMENT I express thanks and gratitude to Mr. †¦Ã¢â‚¬ ¦Ã¢â‚¬ ¦Ã¢â‚¬ ¦Ã¢â‚¬ ¦Ã¢â‚¬ ¦Ã¢â‚¬ ¦Ã¢â‚¬ ¦Ã¢â‚¬ ¦Ã¢â‚¬ ¦Ã¢â‚¬ ¦Ã¢â‚¬ ¦Ã¢â‚¬ ¦Ã¢â‚¬ ¦Ã¢â‚¬ ¦Ã¢â‚¬ ¦H. O. D computer science department, †¦Ã¢â‚¬ ¦Ã¢â‚¬ ¦Ã¢â‚¬ ¦Ã¢â‚¬ ¦Ã¢â‚¬ ¦Ã¢â‚¬ ¦Ã¢â‚¬ ¦Ã¢â‚¬ ¦Ã¢â‚¬ ¦Ã¢â‚¬ ¦Ã¢â‚¬ ¦Ã¢â‚¬ ¦Ã¢â‚¬ ¦Ã¢â‚¬ ¦Ã¢â‚¬ ¦Ã¢â‚¬ ¦Ã¢â‚¬ ¦Ã¢â‚¬ ¦Ã¢â‚¬ ¦College for his encouraging support and guidance in carrying out the project. I would like to express gratitude and indebtedness to Mr†¦Ã¢â‚¬ ¦Ã¢â‚¬ ¦Ã¢â‚¬ ¦Ã¢â‚¬ ¦Ã¢â‚¬ ¦Ã¢â‚¬ ¦Ã¢â‚¬ ¦Ã¢â‚¬ ¦Ã¢â‚¬ ¦Ã¢â‚¬ ¦Ã¢â‚¬ ¦Ã¢â‚¬ ¦Ã¢â‚¬ ¦, for his valuable advice and guidance without which this project would not have seen the light of the day. I thank Mr†¦Ã¢â‚¬ ¦Ã¢â‚¬ ¦Ã¢â‚¬ ¦Ã¢â‚¬ ¦Ã¢â‚¬ ¦Ã¢â‚¬ ¦Ã¢â‚¬ ¦Ã¢â‚¬ ¦Ã¢â‚¬ ¦Ã¢â‚¬ ¦Ã¢â‚¬ ¦Ã¢â‚¬ ¦ , project guide , GSS for his insistence on good programming technique which helped us to design and develop a successful model of an Chatting Tool. Name CONTENTS 1.STUDY & ANALYSIS PHASE 1. 1 INTRODUCTION 1. 1. 1 PURPOSE OF THE PROJECT 1. 1. 2 PROBLEM IN EXISTING SYSTEM 1. 1. 3 SOLUTION OF THESE PROBLEMS 1. 1. 4 SCOPE OF THE PROJECT 1. 1. 5 LIMITATIONS 1. 1. 6 HARDWARE & SOFTWARE SPECIFICATIONS 1. 1. 7 ORGANISATION PROFILE 2. PROJECT ANALYSIS 1. STUDY OF THE SYSTEM 2. INPUT & OUTPUT 3. PROCESS MODULES USED WITH JUSTIFICATION 3. DESIGN PHASE 1. DATAFLOW 2. UML DIAGRAMS 4. IMPLEMENTATION PHASE 5. TESTING 1. TYPES OF TESTING 1. COMPILING TEST 2. EXECUTION TEST 3. OUTPUT TEST 5. PROJECT CODING 6. OUTPUT SCREENS 7. CONCLUSION 8. BIBLOGRAPHYSTUDY PHASE INTRODUCTION: EXISTING SYSTEM With the advent of the Internet in the past decade, searching for information in various formats has been redefined by the internet search engines, most of them being based on information retrieval (IR) indexing techniques. IR-based searching, which usually allows formulation of queries with multiple words PROPOSED SYSTEM This Java application is basically a recursive file finder. You can search for files based on their filename, their contents, or both in selected directory and as well as sub directories of the specified directory.Engine is a graphical version of the well-known GREP utility, with an additional feature of traversing subdirectories. You can specify which directory to start looking in, which files to search through, and what pattern to look for in the files. The various fields expect regular expressions, like Global Regular Expression, ‘Engine’ has not only the graphical interface, but also a command-line interface. This is useful for quick searches through, say, a development tree. Engine requires the Java 2 Platform, Standard Edition version 1. 4 or higher. SOLUTION OF THESE PROBLEMSRegular expressions figure into all kinds of text-manipulation tasks. Searching and search-and-replace are among the more common uses, but regular expressions can also be used to test for certain conditions in a text file or data stream. You might use regular expressions, for example, as t he basis for a short program that separates incoming mail from incoming spam. In this case, the program might use a regular expression to determine whether the name of a known spammer appeared in the â€Å"From:† line of the email. Email filtering programs, in fact, very often use regular expressions for exactly this type of operation. SCOPE OF THE PROJECTEngine is a graphical version of the well-known GREP utility, with an additional feature of traversing subdirectories. The main aim of this project is to develop a java based recursive file finder. Engine is a graphical version of the well-known GREP utility, with an additional feature of traversing subdirectories LIMITATIONS Regular expressions tend to be easier to write than they are to read. This is less of a problem if you are the only one who ever needs to maintain the program (or sed routine, or shell script, or what have you), but if several people need to watch over it, the syntax can turn into more of a hindrance th an an aid.Ordinary macros (in particular, editable macros such as those generated by the major word processors and editors) tend not to be as fast, as flexible, as portable, as concise, or as fault-tolerant as regular expressions, but they have the advantage of being much more readable; even people with no programming background whatsoever can usually make enough sense of a macro script to change it if the need arises. For some jobs, such readability will outweigh all other concerns.As with all things in computing, it's largely a question of fitting the tool to the job. HARDWARE & SOFTWARE SPECIFICATIONS Environment: Java Runtime Environment version 1. 4 or better installed. Operating System: Any O. S. compatable with JVM Hard disk:10 GB Processor:PIII or higher ORGANIZATION PROFILE EMINENT SOFTWARE SOLUTIONS EMINENT TECHNOLOGIES (ET) is an IT Solution Provider for a dynamic environment where business and technology strategies converge.Our approach focuses on new ways of business co mbining IT innovation and adoption while also leveraging an organization's current IT assets. We work with large global corporations and new generation technology companies – to build new products or services and to implement prudent business and technology strategies in today's environment. EMINENT's range of expertise includes: Software Development Services Engineering Services Systems Integration Customer Relationship Management Supply Chain Management Product Development Electronic CommerceConsulting IT Outsourcing We apply technology with innovation and responsibility to achieve two broad objectives: Effectively address the business issues our customers face today Generate new opportunities that will help them stay ahead in the future This approach rests on: A strategy where we Architect, Integrate and Manage technology services and solutions — we call it AIM for success. A robust offshore development methodology and reduced demand on customer resources A focus on the use of reusable frameworks to provide cost and time benefitsWe combine the best people, processes and technology to achieve excellent results consistently. We offer customers the advantages of: Speed: We understand the importance of timing, of getting there before the competition. A rich portfolio of reusable, modular frameworks helps jump start projects. Tried and tested methodology ensures that we follow a predictable, low-risk path to achieve results. Our track record is testimony to complex projects delivered within and even before schedule. Expertise: Our teams combine cutting edge technology skills with rich domain expertise.What's equally important — we share a strong customer orientation that means we actually start by listening to the customer. We're focused on coming up with solutions that serve customer requirements today and anticipate future needs. A Full Service Portfolio: We offer customers the advantage of being able to Architect, Integrate and Manage tec hnology services. This means that they can rely on one, fully accountable source instead of trying to integrate disparate multi-vendor solutions. Services: GSS is providing its services to Sain medicaments Pvt.Ltd, Grace drugs and pharmaceuticals Private Limited Alka Drugs and Pharmaceuticals Pvt Ltd to name just a few with out rich experience and expertise in Information Technology we are in the best position to provide software solutions to distinct business requirements. PROJECT ANALYSIS STUDY OF THE SYSTEM This application can be mainly divided into two modules:- †¢ User Interface †¢ File Manipulation and filtering INPUT AND OUTPUT: User has to input the File Name or File Contents and he has to select the Drive or Directory in which searching has to be done.Application will search for the files matching with given criteria and shows the output in the text area of the application. PROCESS MODEL USED WITH JUSTIFICTION The model used here is a SPIRAL MODEL. This Model dem ands a direct consideration of technical risk at all stages of the project and if properly applied it reduces risk before they become problematic, hence it becomes easier to handle a project when using this kind of model where in the end user can evaluate the program at the end of each stage and suggest modification if required.PROJECT DESIGN DATA FLOW DIAGRAM 0th Level 1st Level 2nd Level 2nd Level 3rd Level UML DIAGRAMS USE CASE DIAGRAM [pic] CLASS DIAGRAM [pic] ACTIVITY DIAGRAM [pic] SEQUENCE DIAGRAM [pic] IMPLEMENTATION PHASE MODULES: 1. COMPONENT THIS IS THE FRONT END CONSOLE OF THE USER TO INTERACT WITH SEARCH ANALYZER. 2. TOOLBAR COORDINATIOR THIS MODULE HAS THE EMBEDED TOOLS WHICH ARE TO IMPLEMENT SEARCH. 3. MAP FINDER THIS MODULE IS MAPS THE SEARCH CORRESPONDING TO THE USERS QUERY. 4. DYNAMIC STATUS FINDERTHIS IS THE DYNAMIC MODULE WHICH GIVES THE STATUS OF THE SEARCH . 5. GREP GENERATOR GREP GENERATOR IS THE MAJOR MODULE ON WHICH THE SEARCH IS DONE BASED ON REGULAR EXPRESS IONS . OUTPUT SCREENS Engine view [pic] Browse [pic] Search [pic] Help [pic] Error [pic] PROJECT CODING CODE EXPLANATION Regular expressions simplify pattern-matching code Discover the elegance of regular expressions in text-processing scenarios that involve pattern matching Text processing often involves matching text against a pattern.Although Java's character and assorted string classes offer low-level pattern-matching support, that support commonly leads to complex code. To help you write simpler pattern-matching code, Java provides regular expressions with java. util. regex package. Text processing frequently requires code to match text against patterns. That capability makes possible text searches, email header validation, custom text creation from generic text (e. g. , â€Å"Dear Mr. Chakradhar† instead of â€Å"Dear Customer†), and so on. Java supports pattern matching via its character and assorted string classes.Because that low-level support commonly leads t o complex pattern-matching code, Java also offers regular expressions to help you write simpler code. After introducing regular expression terminology, the java. util. regex package's classes, and a program that demonstrates regular expression constructs, I explore many of the regular expression constructs that the Pattern class supports. I also examine the methods comprising Pattern and other java. util. regex classes. A practical application of regular expressions concludes my discussion.Regular expressions' long history begins in the theoretical computer science fields of automata theory and formal language theory. That history continues to Unix and other operating systems, where regular expressions are often used in Unix and Unix-like utilities: examples include awk (a programming language that enables sophisticated text analysis and manipulation-named after its creators, Aho, Weinberger, and Kernighan), emacs (a developer's editor), and grep (a program that matches regular expr essions in one or more text files and stands for global regular expression print).Regular expressions trace back to the work of an American mathematician by the name of Stephen Kleene (one of the most influential figures in the development of theoretical computer science) who developed regular expressions as a notation for describing what he called â€Å"the algebra of regular sets. † His work eventually found its way into some early efforts with computational search algorithms, and from there to some of the earliest text-manipulation tools on the Unix platform (including ed and grep). In the context of computer searches, the â€Å"*† is formally known as a â€Å"Kleene star. â€Å"A regular expression, also known as a regex or regexp, is a string whose pattern (template) describes a set of strings. The pattern determines what strings belong to the set, and consists of literal characters and meta characters, characters that have special meaning instead of a literal m eaning. The process of searching text to identify matches—strings that match a regex's pattern—is pattern matching. Java's java. util. regex package supports pattern matching via its Pattern, Matcher, and PatternSyntaxException classes: 1. Pattern objects, also known as patterns, are compiled regexes 2.Matcher objects, or matchers, are engines that interpret patterns to locate matches in character sequences, objects whose classes implement the java. lang. CharSequence interface and serve as text sources 3. PatternSyntaxException objects describe illegal regex patterns Code for mainwindow package jog. engine; import java. awt. *; import java. awt. event. *; import java. io. *; import java. net. URL; import java. util. prefs. *; import java. util. regex. *; import javax. swing. *; import javax. swing. filechooser. FileFilter; import jog. engine. *; public class MainWindow extends JFrame implements ActionListener, FileSearchListener { rotected Preferences preferences; pro tected JTextField lookInField; protected JTextField filePatternField; protected JTextField searchForField; protected JTextField excludeField; protected JCheckBox includeSubCheckBox; protected JList resultList; protected RunSearch runner; protected JButton browseButton; protected JButton helpButton; protected JButton startButton; protected JButton stopButton; protected JButton closeButton; protected JLabel status; protected JPanel cardPanel; protected CardLayout cardLayout; private boolean stopFlag; public MainWindow() { super(Bundle. getString(â€Å"AppTitle†)); addWindowListener(new WindowAdapter() public void windowClosing(WindowEvent event) { handleClose(); } }); preferences = Preferences. userRoot(). node(â€Å"com/bluemarsh/jrgrep†); Container pane = getContentPane(); GridBagLayout gb = new GridBagLayout(); pane. setLayout(gb); GridBagConstraints gc = new GridBagConstraints(); gc. insets = new Insets(3, 3, 3, 3); JLabel label = new JLabel(Bundle. getString(â€Å" lookInLabel†)); gc. anchor = GridBagConstraints. EAST; gb. setConstraints(label, gc); pane. add(label); String s = preferences. get(â€Å"lookIn†, â€Å"†); lookInField = new JTextField(s, 20); gc. anchor = GridBagConstraints. WEST; gc. fill = GridBagConstraints.HORIZONTAL; gc. weightx = 1. 0; gb. setConstraints(lookInField, gc); pane. add(lookInField); browseButton = new JButton(Bundle. getString(â€Å"browseLabel†)); browseButton. addActionListener(this); gc. anchor = GridBagConstraints. CENTER; gc. gridwidth = GridBagConstraints. REMAINDER; gc. fill = GridBagConstraints. NONE; gc. weightx = 0. 0; gb. setConstraints(browseButton, gc); pane. add(browseButton); label = new JLabel(Bundle. getString(â€Å"filePatternLabel†)); gc. anchor = GridBagConstraints. EAST; gc. gridwidth = 1; gb. setConstraints(label, gc); pane. add(label); s = preferences. get(â€Å"filter†, â€Å"†); ilePatternField = new JTextField(s, 20); gc. anchor = GridBagC onstraints. WEST; gc. fill = GridBagConstraints. HORIZONTAL; gc. gridwidth = GridBagConstraints. RELATIVE; gc. weightx = 1. 0; gb. setConstraints(filePatternField, gc); pane. add(filePatternField); Component glue = Box. createGlue(); gc. anchor = GridBagConstraints. CENTER; gc. fill = GridBagConstraints. NONE; gc. gridwidth = GridBagConstraints. REMAINDER; gc. weightx = 0. 0; gb. setConstraints(glue, gc); pane. add(glue); label = new JLabel(Bundle. getString(â€Å"searchForLabel†)); gc. anchor = GridBagConstraints. EAST; gc. fill = GridBagConstraints.NONE; gc. gridwidth = 1; gb. setConstraints(label, gc); pane. add(label); s = preferences. get(â€Å"searchFor†, â€Å"†); searchForField = new JTextField(s, 20); gc. anchor = GridBagConstraints. WEST; gc. fill = GridBagConstraints. HORIZONTAL; gc. gridwidth = GridBagConstraints. RELATIVE; gc. weightx = 1. 0; gb. setConstraints(searchForField, gc); pane. add(searchForField); helpButton = new JButton(Bundle. getStrin g(â€Å"helpLabel†)); helpButton. addActionListener(this); gc. anchor = GridBagConstraints. CENTER; gc. fill = GridBagConstraints. NONE; gc. gridwidth = GridBagConstraints. REMAINDER; gc. weightx = 0. 0; gb. etConstraints(helpButton, gc); pane. add(helpButton); label = new JLabel(Bundle. getString(â€Å"excludeLabel†)); gc. anchor = GridBagConstraints. EAST; gc. gridwidth = 1; gb. setConstraints(label, gc); pane. add(label); s = preferences. get(â€Å"exclude†, â€Å"†); excludeField = new JTextField(s, 20); gc. anchor = GridBagConstraints. WEST; gc. fill = GridBagConstraints. HORIZONTAL; gc. gridwidth = GridBagConstraints. RELATIVE; gc. weightx = 1. 0; gb. setConstraints(excludeField, gc); pane. add(excludeField); glue = Box. createGlue(); gc. anchor = GridBagConstraints. CENTER; gc. fill = GridBagConstraints. NONE; gc. ridwidth = GridBagConstraints. REMAINDER; gc. weightx = 0. 0; gb. setConstraints(glue, gc); pane. add(glue); includeSubCheckBox = new JC heckBox( Bundle. getString(â€Å"includeSubDirLabel†), true); includeSubCheckBox. setSelected(preferences. getBoolean( â€Å"recurse†, true)); gc. anchor = GridBagConstraints. WEST; gb. setConstraints(includeSubCheckBox, gc); pane. add(includeSubCheckBox); startButton = new JButton( Bundle. getString(â€Å"startSearchLabel†)); startButton. addActionListener(this); gc. gridwidth = 1; gb. setConstraints(startButton, gc); pane. add(startButton); status=new JLabel(â€Å"†); Color c=new Color(240,100,100); tatus. setForeground(c); gc. gridwidth = 1; gb. setConstraints(status, gc); pane. add(status); stopButton = new JButton(Bundle. getString(â€Å"stopLabel†)); stopButton. setEnabled(false); stopButton. addActionListener(this); gc. anchor = GridBagConstraints. CENTER; gc. gridwidth = GridBagConstraints. RELATIVE; gb. setConstraints(stopButton, gc); pane. add(stopButton); closeButton = new JButton(Bundle. getString(â€Å"closeLabel†)); closeButton . addActionListener(this); gc. gridwidth = GridBagConstraints. REMAINDER; gb. setConstraints(closeButton, gc); pane. add(closeButton); resultList = new JList(new ResultsListModel());JScrollPane scroller = new JScrollPane(resultList); cardPanel = new JPanel(new CardLayout()); cardLayout = (CardLayout) cardPanel. getLayout(); cardPanel. add(scroller, â€Å"list†); gc. gridwidth = GridBagConstraints. REMAINDER; gc. gridheight = GridBagConstraints. REMAINDER; gc. fill = GridBagConstraints. BOTH; gc. weightx = 1. 0; gc. weighty = 1. 0; gb. setConstraints(cardPanel, gc); pane. add(cardPanel); int width = preferences. getInt(â€Å"windowWidth†, 0); int height = preferences. getInt(â€Å"windowHeight†, 0); if (width == 0 && height == 0) { pack(); } else { setSize(width, height); } int top = preferences. getInt(â€Å"windowTop†, 100); nt left = preferences. getInt(â€Å"windowLeft†, 100); setLocation(left, top); stopFlag=false; } public void actionPerformed (ActionEvent event) { JButton button = (JButton) event. getSource(); //System. out. println(â€Å"action â€Å"+button); if (button == closeButton) { handleClose(); } else if (button == browseButton) { handleBrowse(); } else if (button == startButton) { status. setText(â€Å"Search Started†); //System. out. println(â€Å"Search started†); startSearch(); } else if (button == helpButton) { displayHelp(); } else if (button == stopButton) { //System. out. println(â€Å"Search stopped†); stopButton. setEnabled(false); runner. stop(); stopFlag=true; /int count=((ListModel)resultList. getModel()). getSize(); //status. setText(â€Å"Search Stopped â€Å"+count+† Files Found†); } } protected void displayHelp() { if (cardPanel. getComponentCount() < 2) { URL helpUrl = Bundle. getResource(â€Å"helpFile†); try { JEditorPane editor = new JEditorPane(helpUrl); editor. setEditable(false); JScrollPane scroller = new JScrollPane(editor); cardPanel. add(sc roller, â€Å"help†); } catch (IOException ioe) { searchFailed(ioe); return; } } cardLayout. show(cardPanel, â€Å"help†); } public void fileFound(FileFoundEvent event) { ResultsListModel model = (ResultsListModel) resultList. etModel(); model. addElement(event. getFile()); } protected void handleBrowse() { String dirStr = lookInField. getText(); JFileChooser fc; if (dirStr. equals(â€Å"†)) { String lastdir = preferences. get(â€Å"lastdir†, null); if (lastdir == null || lastdir. length() == 0) { lastdir = System. getProperty(â€Å"user. dir†); } fc = new JFileChooser(lastdir); } else { fc = new JFileChooser(dirStr); } fc. setFileSelectionMode(JFileChooser. DIRECTORIES_ONLY); if (fc. showOpenDialog(this) ! = JFileChooser. CANCEL_OPTION) { File dir = fc. getSelectedFile(); String path = dir. getPath(); lookInField. setText(path); references. put(â€Å"lastdir†, path); } } protected void handleClose() { preferences. putInt(â€Å"windowTopâ⠂¬ , getY()); preferences. putInt(â€Å"windowLeft†, getX()); preferences. putInt(â€Å"windowWidth†, getWidth()); preferences. putInt(â€Å"windowHeight†, getHeight()); preferences. put(â€Å"lookIn†, lookInField. getText()); preferences. put(â€Å"filter†, filePatternField. getText()); preferences. put(â€Å"searchFor†, searchForField. getText()); preferences. put(â€Å"exclude†, excludeField. getText()); preferences. putBoolean(â€Å"recurse†, includeSubCheckBox. isSelected()); System. exit(0); } public void searchComplete() { stopButton. etEnabled(false); //status. setText(â€Å"Search completed†); int count=((ListModel)resultList. getModel()). getSize(); if(count==0){ status. setText(â€Å"Search Completed No Files Found†); } if(stopFlag){ status. setText(â€Å"Search Stopped â€Å"+count +† Files Found†); stopFlag=false; }else{ status. setText(â€Å"Search Completed â€Å"+count +† Fil es Found†); } } public void searchFailed(Throwable t) { Object[] messages = {Bundle. getString(â€Å"exceptionOccurred†),t. getMessage()}; JOptionPane. showMessageDialog(this, messages, Bundle. getString(â€Å"errorTitle†), JOptionPane. ERROR_MESSAGE); } protected void startSearch() { cardLayout. how(cardPanel, â€Å"list†); ResultsListModel model = (ResultsListModel) resultList. getModel(); model. clear(); String dirStr = lookInField. getText(); if (dirStr == null || dirStr. length() == 0) { dirStr = â€Å". â€Å"; } File dir = new File(dirStr); if (! dir. exists()) { JOptionPane. showMessageDialog(this, Bundle. getString(â€Å"pathDoesNotExist†), Bundle. getString(â€Å"errorTitle†), JOptionPane. ERROR_MESSAGE); return; } String target = searchForField. getText(); String filter = filePatternField. getText(); String exclude = excludeField. getText(); try { Pattern. compile(target); Pattern. compile(filter); Pattern. ompile(exclude); } cat ch (PatternSyntaxException pse) { Object[] messages = {Bundle. getString(â€Å"invalidRegexPattern†), pse. getMessage()}; JOptionPane. showMessageDialog(this, messages, Bundle. getString(â€Å"errorTitle†),JOptionPane. ERROR_MESSAGE); return; } if (runner == null) { runner = new RunSearch(this); } runner. search(dir, target, filter, includeSubCheckBox. isSelected(), exclude); Thread th = new Thread(runner); th. start(); stopButton. setEnabled(true); } } Code for bundle package jog. engine; import java. net. URL; import java. util. MissingResourceException; import java. til. ResourceBundle; public class Bundle { private static ResourceBundle resourceBundle; static { resourceBundle = ResourceBundle. getBundle(Bundle. class. getName()); } public static ResourceBundle getBundle() { return resourceBundle; } public static URL getResource(String key) { String name = getString(key); return name == null ? null : Bundle. class. getResource(name); } public static String getString (String key) { try { return resourceBundle. getString(key); } catch (MissingResourceException mre) { return null; } } } Code for runsearch package jog. engine; import java. io. File; import jog. engine. *; mport java. lang. *; class RunSearch implements Runnable { protected File dir; protected String lookFor; protected String filter; protected boolean subDirs; protected String exclude; protected FileSearchListener listener; protected Searcher searcher; public RunSearch(FileSearchListener listener) { this. listener = listener; } public void run() { if (searcher == null) { searcher = new Searcher(); if (listener ! = null) { searcher. addSearchListener(listener); } } searcher. search(dir, lookFor, filter, subDirs, exclude); } public void search(File dir, String lookFor, String filter, boolean subDirs, String exclude) this. dir = dir; this. lookFor = lookFor; this. filter = filter; this. subDirs = subDirs; this. exclude = exclude; } public void stop() { //System. out. println(â€Å"Sea rcher is one:†+ isAlive()); System. out. println(â€Å"Searcher†); if (searcher ! = null) { searcher. stopSearching(); searcher=null; System. out. println(â€Å"Searcher one†); } //System. out. println(â€Å"Searcher is :†+ isAlive()); //System. out. println(â€Å"Searcher one†); } } Code for searcher package jog. engine; import java. io. *; import java. nio. *; import java. nio. channels. *; import java. nio. charset. *; import java. util. *; import java. til. regex. *; import javax. swing. event. EventListenerList; import jog. engine. *; class Searcher { protected static Pattern linePattern; protected static Charset charset; protected static CharsetDecoder decoder; protected EventListenerList searchListeners; protected volatile boolean stopSearch; protected Pattern targetPattern; protected Matcher targetMatcher; protected Pattern filterPattern; protected Matcher filterMatcher; protected Pattern excludePattern; protected Matcher excludeMatcher; sta tic { try { linePattern = Pattern. compile(â€Å". * ? â€Å"); } catch (PatternSyntaxException pse) { System. out. rintln(â€Å"Ye flipping gods! â€Å"); } charset = Charset. forName(â€Å"ISO-8859-1†); decoder = charset. newDecoder(); } public Searcher() { searchListeners = new EventListenerList(); } public void addSearchListener(FileSearchListener listener) { searchListeners. add(FileSearchListener. class, listener); } protected void fireDone() { if (searchListeners == null) { return; } Object[] listeners = searchListeners. getListenerList(); for (int i = listeners. length – 2; i >= 0; i -= 2) { if (listeners[i] == FileSearchListener. class) { FileSearchListener fsl = (FileSearchListener) listeners[i + 1]; fsl. earchComplete(); } } } protected void fireError(Throwable t) { if (searchListeners == null) { return; } Object[] listeners = searchListeners. getListenerList(); for (int i = listeners. length – 2; i >= 0; i -= 2) { if (listeners[i] == FileSearchLi stener. class) { FileSearchListener fsl = (FileSearchListener) listeners[i + 1]; fsl. searchFailed(t); } } } protected void fireFound(String match) { if (searchListeners == null) { return; } FileFoundEvent event = new FileFoundEvent(this, match); Object[] listeners = searchListeners. getListenerList(); for (int i = listeners. ength – 2; i >= 0; i -= 2) { if (listeners[i] == FileSearchListener. class) { FileSearchListener fsl = (FileSearchListener) listeners[i + 1]; fsl. fileFound(event); } } event = null; } public void removeSearchListener(FileSearchListener listener) { searchListeners. remove(FileSearchListener. class, listener); } public void search(File startIn, String target, String filter, boolean recurse, String exclude) { stopSearch = false; try { targetPattern = Pattern. compile(target); filterPattern = Pattern. compile(filter); if (exclude ! = null && exclude. length() > 0) { excludePattern = Pattern. ompile(exclude); } searchLow(startIn, recurse); } catch (IOExcepti on ioe) { fireError(ioe); } catch (PatternSyntaxException pse) { fireError(pse); } targetPattern = null; targetMatcher = null; filterPattern = null; filterMatcher = null; excludePattern = null; excludeMatcher = null; fireDone(); } protected void searchLow(File startIn, boolean recurse) throws IOException { String[] files = startIn. list(); if (files == null) { return; } for (int ii = 0; ii < files. length; ii++) { if (stopSearch) { break; } File file = new File(startIn, files[ii]); if (file. isFile() && file. canRead()) { String filename = file. etCanonicalPath(); if (filterMatcher == null) { filterMatcher = filterPattern. matcher(filename); } else { filterMatcher. reset(filename); } if (! filterMatcher. find()) { continue; } FileInputStream fis = new FileInputStream(file); FileChannel fc = fis. getChannel(); MappedByteBuffer bb = fc. map(FileChannel. MapMode. READ_ONLY, 0, fc. size()); CharBuffer cb = decoder. decode(bb); boolean matchFound = false; if ((targetPattern. flags() & Pa ttern. DOTALL) ! = 0) { if (targetMatcher == null) { targetMatcher = targetPattern. matcher(cb); } else { argetMatcher. reset(cb); } if (targetMatcher. find()) { matchFound = true; } } else { Matcher lm = linePattern. matcher(cb); while (lm. find()) { CharSequence cs = lm. group(); if (targetMatcher == null) { targetMatcher = targetPattern. matcher(cs); } else { targetMatcher. reset(cs); } if (targetMatcher. find()) { matchFound = true; } if (lm. end() == cb. limit()) { break; } } } if (matchFound) { fireFound(filename); } } else if (recurse && file. isDirectory()) { String dirname = file. getName(); if (excludePattern ! = null) { if (excludeMatcher == null) { excludeMatcher = excludePattern. atcher(dirname); } else { excludeMatcher. reset(dirname); } if (! excludeMatcher. find()) { searchLow(file, recurse); } } else { searchLow(file, recurse); } } } } public void stopSearching() { stopSearch = true; } } Code for filesearch listener package jog. engine; import java. util. EventListe ner; import jog. engine. FileFoundEvent; interface FileSearchListener extends EventListener { public void fileFound(FileFoundEvent event); public void searchComplete(); public void searchFailed(Throwable t); } Code for tty package jog. engine; import java. io. *; import java. util. regex. *; mport jog. engine. *; public class tty implements FileSearchListener { protected static int argIndex; protected static String excludeStr = â€Å"†; protected static String nameStr = â€Å"†; protected static void displayHelp() { String str = Bundle. getString(â€Å"ttyHelp1†); int i = 1; while (str ! = null) { System. out. println(str); i++; str = Bundle. getString(â€Å"ttyHelp† + i); } } public void fileFound(FileFoundEvent event) { System. out. println(event. getFile()); } protected static boolean processArgs(String[] args) { while (argIndex < args. length) { String arg = args[argIndex]; if (arg. equals(â€Å"-exclude†)) { rgIndex++; excludeStr = args[argInd ex]; } else if (arg. equals(â€Å"-h†) || arg. equals(â€Å"-help†) || arg. equals(â€Å"–help†)) { displayHelp(); return false; } else if (arg. equals(â€Å"-name†)) { argIndex++; nameStr = args[argIndex]; } else { break; } argIndex++; } return true; } public void searchComplete() {} public void searchFailed(Throwable t) { System. err. println(Bundle. getString(â€Å"exceptionOccurred†)); System. err. println(t. getMessage()); } public static void main(String[] args) { try { if (! processArgs(args)) { return; } } catch (ArrayIndexOutOfBoundsException aioobe) { System. err. println(Bundle. etString(â€Å"ttyMissingArguments†)); return; } if (argIndex == args. length) { System. err. println(Bundle. getString(â€Å"ttyMissingRequired†)); return; } String target = args[argIndex]; argIndex++; String dirStr = null; if (argIndex == args. length) { dirStr = â€Å". â€Å"; } else { dirStr = args[argIndex]; } File dir = new File(dirS tr); if (! dir. exists()) { System. err. println(Bundle. getString(â€Å"pathDoesNotExist†)); return; } try { Pattern. compile(target); Pattern. compile(nameStr); } catch (PatternSyntaxException pse) { System. err. println(Bundle. getString(â€Å"invalidRegexPattern†)); System. rr. println(pse. getMessage()); return; } Searcher searcher = new Searcher(); tty instance = new tty(); searcher. addSearchListener(instance); searcher. search(dir, target, nameStr, true, excludeStr); searcher. removeSearchListener(instance); } } Code for filefoundevent package jog. engine; import java. util. EventObject; class FileFoundEvent extends EventObject { protected String file; public FileFoundEvent(Object source, String file) { super(source); this. file = file; } public String getFile() { return file; } } Code for result list model package jog. engine; import java. util. Vector; import javax. wing. AbstractListModel; import jog. engine. *; class ResultsListModel extends AbstractListMod el { protected Vector listData; public ResultsListModel() { listData = new Vector(); } public void addElement(Object o) { listData. add(o); fireIntervalAdded(this, listData. size(), listData. size()); } public void clear() { int size = listData. size(); listData. clear(); fireIntervalRemoved(this, 0, size); } public Object getElementAt(int i) { try { return listData. elementAt(i); } catch (ArrayIndexOutOfBoundsException e) { return null; } } public int getSize() { return listData. size(); } } Code for main package jog. ngine; import jog. engine. *; public class Main { public static void main(String[] args) { new MainWindow(). show(); // new jog. searchdesk. MainWindow. show(); } } For a tool with full regex support, metacharacters like â€Å"*† and â€Å"? † (or â€Å"wildcard operators,† as they are sometimes called) are only the tip of the iceberg. Using a good regex engine and a well-crafted regular expression, one can easily search through a text file (or a hundred text files) searching for words that have the suffix â€Å". html† (but only if the word begins with a capital letter and occurs at the beginning of the line), replace the . tml suffix with a . sgml suffix, and then change all the lower case characters to upper case. With the right tools, this series of regular expressions would do just that: s/(^[A_Z]{1})([a-z]+). sgml/12. html/g tr/a-z/A-Z/ As you might guess from this example, concision is everything when it comes to crafting regular expressions, and while this syntax won't win any beauty prizes, it follows a logical and fairly standardized format which you can learn to rea+*d and write easily with just a little bit of practice. In a regular expression, everything is a generalized pattern.If I type the word â€Å"serendipitous† into my editor, I've created one instance of the word â€Å"serendipitous. † If, however, I indicate to my tool (or compiler, or editor, or what have you) that I'm now typing a regular expression, I am in effect creating a template that matches all instances of the characters â€Å"s,† â€Å"e,† â€Å"r,† â€Å"e,† â€Å"n,† â€Å"d,† â€Å"i,† â€Å"p,† â€Å"i,† â€Å"t,† â€Å"o,† â€Å"u,† and â€Å"s† all in a row. The standard way to find â€Å"serendipitous† (the word) in a file is to use â€Å"serendipitous† (the regular expression) with a tool like egrep (or extended grep): $ egrep â€Å"serendipitous† foobar ;hitsThis line, as you might guess, asks egrep to find instances of the pattern â€Å"serendipitous† in the file â€Å"foobar† and write the results to a file called â€Å"hits†. In the preceding examples, we have been using regular expressions that adhere to the first rule of regular expressions: namely, that all alphanumeric characters match themselves. There are other characters, however, that match in a mor e generalized fashion. These are usually referred to as the meta characters. Some meta characters match single characters. This includes the following symbols: . Matches any one character †¦]Matches any character listed between the brackets [^†¦]Matches any character except those listed between the brackets Suppose we have a number of filenames listed out in a file called â€Å"Important. files. † We want to â€Å"grep out† those filenames which follow the pattern â€Å"blurfle1†, â€Å"blurfle2†, â€Å"blurfle3,† and so on, but exclude files of the form â€Å"1blurfle†, â€Å"2blurfle†, â€Å"3blurfle† The following regex would do the trick: $ egrep â€Å"blurfle. † Important. files ;blurfles The important thing to realize here is that this line will not match merely the string â€Å"blurfle. (that is, â€Å"blurfle† followed by a period). In a regular expression, the dot is a reserved symbol (we'll ge t to matching periods a little further on). This is fine if we aren't particular about the character we match (whether it's a â€Å"1,† a â€Å"2,† or even a letter, a space, or an underscore). Narrowing the field of choices for a single character match, however, requires that we use a character class. Character classes match any character listed within that class and are separated off using square brackets.So, for example, if we wanted to match on â€Å"blurfle† but only when it is followed immediately by a number (including â€Å"blurfle1† but not â€Å"blurflez†) we would use something like this: $ egrep â€Å"blurfle[0123456789]† Important. files >blurfles The syntax here is exactly as it seems: â€Å"Find ‘blurfle' followed by a zero, a one, a two, a three, a four, a five, a six, a seven, an eight, or a nine. † Such classes are usually abbreviated using the range operator (â€Å"-â€Å"): $ egrep â€Å"blurfle[0-9]† Important. files >blurfles The following regex would find â€Å"blurfle† followed by any alphanumeric character (upper or lower case). egrep â€Å"blurfle[0-9A-Za-z]† Important. files >blurfles (Notice that we didn't write blurfle[0-9 A-Z a-z] for that last one. The spaces might make it easier to read, but we'd be matching on anything between zero and nine, anything between a and z, anything between A and Z, or a space. ) A carat at the beginning of the character class negates that class. In other words, if you wanted to find all instances of blurfle except those which end in a number, you'd use the following: $ egrep â€Å"blurfle[^0-9]† Important. files >blurfles Many regex implementations have â€Å"macros† for various character classes.In Perl, for example, d matches any digit ([0-9]) and w matches any â€Å"word character† ([a-zA-Z0-9_]). Grep uses a slightly different notation for the same thing: [:digit:] for digits and [:alnum:] for alpha numeric characters. The man page (or other documentation) for the particular tool should list all the regex macros available for that tool. Quantifiers The regular expression syntax also provides metacharacters which specify the number of times a particular character should match. ?Matches any character zero or one times *Matches the preceding element zero or more times +Matches the preceding element one or more times num}Matches the preceding element num times {min, max}Matches the preceding element at least min times, but not more than max times These metacharacters allow you to match on a single-character pattern, but then continue to match on it until the pattern changes. In the last example, we were trying to search for patterns that contain â€Å"blurfle† followed by a number between zero and nine. The regex we came up with would match on blurfle1, blurfle2, blurfle3, etc. If, however, you had a programmer who mistakenly thought that â€Å"blurfle† was supposed t o be spelled â€Å"blurffle,† our regex wouldn't be able to catch it.We could fix it, though, with a quantifier. $ egrep â€Å"blur[f]+le[0-9]† Important. files >blurfles Here we have â€Å"Find ‘b', ‘l', ‘u,' ‘r' (in a row) followed by one or more instances of an ‘f' followed by ‘l' and ‘e' and then any single digit character between zero and nine. † There's always more than one way to do it with regular expressions, and in fact, if we use single-character metacharacters and quantifiers in conjunction with one another, we can search for almost all the variant spellings of â€Å"blurfle† (â€Å"bllurfle,† â€Å"bllurrfle†, bbluuuuurrrfffllle†, and so on).One way, for example, might employ the ubiquitous (and exceedingly powerful) . * combination: $ egrep â€Å"b. *e† Important. files ;blurfles If we work this out, we come out with something like: â€Å"find a ‘b' followed by any c haracter any number of times (including zero times) followed by an ‘e'. † It's tempting to use â€Å". *† with abandon. However, bear in mind that the preceding example would match on words like â€Å"blue† and â€Å"baritone† as well as â€Å"blurfle. † Suppose the filenames in blurfle are numbered up to 12324, but we only care about the first 999: $ egrep â€Å"blurfle[0-9]{3}† Important. files >bluflesThis regex tells egrep to match any number between zero and nine exactly three times in a row. Similarly, â€Å"blurfle[0-9]{3,5}† matches any number between zero and nine at lest three times but not more than five times in a row. Anchors Often, you need to specify the position at which a particular pattern occurs. This is often referred to as â€Å"anchoring† the pattern: ^Matches at the start of the line $Matches at the end of the line Matches at the end of a word Matches at the beginning or the end of a word BMatches a ny charater not at the beginning or end of a word ^† and â€Å"$† are some of the most useful metacharacters in the regex arsenal–particularly when you need to run a search-and-replace on a list of strings. Suppose, for example, that we want to take the â€Å"blurfle† files listed in Important. files, list them out separately, run a program called â€Å"fragellate† on each one, and then append each successive output to a file called â€Å"fraggled_files. † We could write a full-blown shell script (or Perl script) that would do this, but often, the job is faster and easier if we build a very simple shell script with a series of regular expressions.We'd begin by greping the files we want to operate on and writing the output to a file. $ egrep â€Å"blurfle[0-9]† Important. file ;script. sh This would give us a list of files in script. sh that looked something like this: blurfle1 blurfle2 blurfle3 blurfle4 . . . Now we use sed (or the â⠂¬Å"/%s† operator in vi, or the â€Å"query-replace-regexp† command in emacs) to put â€Å"fragellate† in front of each filename and â€Å">>fraggled_files† after each filename. This requires two separate search-and-replace operations (though not necessarily, as I'll explain when we get to backreferences).With sed, you have the ability to put both substitution lines into a file, and then use that file to iterate through another making each substitution in turn. In other words, we create a file called â€Å"fraggle. sed† which contains the following lines: s/^/fraggelate / s/$/ >>fraggled_files/ Then run the following â€Å"sed routine† on script. sh like so: $ sed -f fraggle. sed script. sh >script2. sh Our script would then look like this: fraggelate blurfle1 >>fraggled_files fraggelate blurfle2 >>fraggled_files fraggelate blurfle3 >>fraggled_files raggelate blurfle4 >>fraggled_files . . Chmod it, run it, and you're done. Of course, this is a somewhat trivial example (â€Å"Why wouldn't you just run â€Å"fragglate blurfle* ;;fraggled_files† from the command line? â€Å"). Still, one can easily imagine instances where the criteria for the file name list is too complicated to express using [filename]* on the command line. In fact, you can probably see from this sed-routine example that we have the makings of an automatic shell-script generator or file filter. You may also have noticed something odd about that caret in our sed routine.Why doesn't it mean â€Å"except† as in our previous example? The answer has to do with the sometimes radical difference between what an operator means inside the range operator and what it means outside it. The rules change from tool to tool, but generally speaking, you should use metacharacters inside range operators with caution. Some tools don't allow them at all, and others change the meaning. To pick but one example, most tools would interpret [A-Za-z. ] as â€Å"Any character between A and Z, a and z or a period. † Most tools provide some way to anchor a match on a word boundary.In some versions of grep, for example, you are allowed to write: $ grep â€Å"fle>† Important. files ;blurfles This says: â€Å"Find the characters â€Å"f†, â€Å"l†, â€Å"e†, but only when they come at the end of a word. †  tells the regex engine to match any word boundary (whether it's at the beginning or the end) and B tells it to match any position that isn't a word boundary. This again can vary considerably from tool to tool. Some tools don't support word boundaries at all, and others support them using a slightly different syntax.The tools that do support word boundaries generally consider words to be bounded by spaces or punctuation, and consider numerals to be legitimate parts of words, but there are some variations on these rules that can effect the accuracy of your matches. The man page or other documentation should resolve the matter. Escape Characters By now, you're probably wondering how you go about searching for one of the special characters (asterisks, periods, slashes, and so on). The answer lies in the use of the escape character–for most tools, the backslash (â€Å"†).To reverse the meaning of a special character (in other words, to treat it as a normal character instead of as a metacharacter), we simply put a backslash before that character. So, we know that a regex like â€Å". *† finds any character any number of times. But suppose we're searching for ellipses of various lengths and we just want to find periods any number of times. Because the period is normally a special character, we'd need to escape it with a backslash: $ grep â€Å". *† Important. Files ;ellipses. files Unfortunately, this contribute to the legendary ugliness of regular expressions more than any other element of the syntax.Add a few escape characters, and a simple sed routine designed to replace a couple of URL's quickly degenerates into confusion: sed ‘s/http://etext. lib. virginia. edu//http://www. etext. virginia. edu/g To make matters worse, the list of what needs to be escaped differs from tool to tool. Some tools, for example, consider the â€Å"+† quantifier to have its normal meaning (as a ordinary plus sign) until it is escaped. If you're having trouble with a regex (a sed routine that won't parse or a grep pattern that won't match even though you're certain the pattern exists), try playing around with the escapes.Or better yet, read the man page. Alternation Alternation refers to the use of the â€Å"|† symbol to indicate logical OR. In a previous example, we used â€Å"blur[f]+le† to catch those instances of â€Å"blurfle† that were misspelled with two â€Å"f's†. Using alternation, we could have written: $ egrep â€Å"blurfle|blurffle† Important. files ;blurfles This means simply â€Å"Find either blur fle OR blurffle. † The power of this becomes more evident when we use parentheses to limit the scope of the alternative matches.Consider the following regex, which accounts for both the American and British spellings of the word â€Å"gray†: $ egrep â€Å"gr(a|e)y† Important. files ;hazy. shades Or perhaps a mail-filtering program that uses the following regex to single out past correspondence between you and the boss: /(^To:|^From:) (Seaman|Ramsay)/ This says, â€Å"Find a ‘To:' or a ‘From:' line followed by a space and then either the word ‘Seaman' or the word ‘Ramsay' This can make your regex's extremely flexible, but be careful! Parentheses are also meta characters which figure prominently in the use of . . . Back referencesPerhaps the most powerful element of the regular expression syntax, back references allows you to load the results of a matched pattern into a buffer and then reuse it later in the expression. In a previous example , we used two separate regular expressions to put something before and after a filename in a list of files. I mentioned at that point that it wasn't entirely necessary that we use two lines. This is because back references allow us to get it down to one line. Here's how: s/(blurfle[0-9]+)/fraggelate 1 >>fraggled_files/ The key elements in this example are the parentheses and the â€Å"1†.Earlier we noted that parentheses can be used to limit the scope of a match. They can also be used to save a particular pattern into a temporary buffer. In this example, everything in the â€Å"search† half of the sed routine (the â€Å"blurfle† part) is saved into a buffer. In the â€Å"replace† half we recall the contents of that buffer back into the string by referring to its buffer number. In this case, buffer â€Å"1†. So, this sed routine will do precisely what the earlier one did: find all the instances of blurfle followed by a number between zero and nine a nd replace it with â€Å"fragellate blurfle[some number] ;;fraggled files†.Backreferences allow for something that very few ordinary search engines can manage; namely, strings of data that change slightly from instance to instance. Page numbering schemes provide a perfect example of this. Suppose we had a document that numbered each page with the notation . The number and the chapter name change from page to page, but the rest of the string stays the same. We can easily write a regular expression that matches on this string, but what if we wanted to match on it and then replace everything but the number and the chapter name? //Page 1, Chapter 2/ Buffer number one (â€Å"1†) holds the first matched sequence, ([0-9]+); buffer number two (â€Å"2†) holds the second, ([A-Za-z]+). Tools vary in the number of backreference they can hold. The more common tools (like sed and grep) hold nine, but Python can hold up to ninety-nine. Perl is limited only by the amount of ph ysical memory (which, for all practical purposes, means you can have as many as you want). Perl also lets you assign the buffer number to an ordinary scalar variable ($1, $2, etc. ) so you can use it later on in the code block. a.OBJECT ORIENTED PROGRAMMING AND JAVA Object-oriented Programming was developed because of limitations found in earlier approaches of programming. To appreciate what OOP does, we need to understand what these limitations are and how they arose from traditional programming. PROCEDURAL LANGUAGES Pascal, C, Basic, FORTRAN, and similar languages are procedural languages. That is, each statement in the language tells the computer to do something: Get some input, add these numbers, divide by 6, display the output. A program in a procedural language is a list of instructions.For very small programs no other organizing principle (often called a paradigm) is needed. The programmer creates the list of instructions, and the computer carries them out. Division into Func tions When programs become larger, a single list of instructions becomes unwieldy. Few programmers can comprehend a program of more than a few hundred statements unless it is broken down into smaller units. For this reason the function was adopted as a way to make programs more comprehensible to their human creators. (The term functions is used in C++ and C.In other languages the same concept may be referred to as a subroutine, a subprogram, or a procedure. ) A program is divided into functions, and (ideally, at least) each function has a clearly defined purpose and a clearly defined interface to the other functions in the program. The idea of breaking a program into functions can be further extended by grouping a number of functions together into a larger entity called a module, but the principle is similar: grouping a number of components that carry out specific tasks.Dividing a program into functions and modules is one of the cornerstones of structured programming, the somewhat l oosely defined discipline that has influenced programming organization for more than a decade. Problems with Structured Programming As programs grow ever larger and more complex, even the structured programming approach begins to show signs of strain. You may have heard about, or been involved in, horror stories of program development. The project is too complex, the schedule slips, more programmers are added, complexity increases, costs skyrocket, the schedule slips further, and disaster ensues.Analyzing the reasons for these failures reveals that there are weaknesses in the procedural paradigm itself. No matter how well the structured programming approach is implemented, large programs become excessively complex. What are the reasons for this failure of procedural languages? One of the most crucial is the role played by data. Data Undervalued In a procedural language, the emphasis is on doing things–read the keyboard, invert the vector, check for errors, and so on. The subd ivision of a program into functions continues this emphasis. Functions do things just as single program statements do.What they do may be more complex or abstract, but the emphasis is still on the action. What happens to the data in this paradigm? Data is, after all, the reason for a program's existence. The important part of an inventory program isn't a function that displays the data, or a function that checks for correct input; it's the inventory data itself. Yet data is given second-class status in the organization of procedural languages. For example, in an inventory program, the data that makes up the inventory is probably read from a disk file into memory, where it is treated as a global variable.By global we mean that the variables that constitute the data are declared outside of any function, so they are accessible to all functions. These functions perform various operations on the data. They read it, analyze it, update it, rearrange it, display it, write it back to the dis k, and so on. We should note that most languages, such as Pascal and C, also support local variables, which are hidden within a single function. But local variables are not useful for important data that must be accessed by many different functions. Now suppose a new programmer is hired to write a function to analyze this nventory data in a certain way. Unfamiliar with the subtleties of the program, the programmer creates a function that accidentally corrupts the. This is easy to do, because every function has complete access to the data. It's like leaving your personal papers in the lobby of your apartment building: Anyone can change or destroy them. In the same way, global data can be corrupted by functions that have no business changing it. Another problem is that, since many functions access the same data, the way the data is stored becomes critical.The arrangement of the data can't be changed without modifying all the functions that access it. If you add new data items, for exa mple, you'll need to modify all the functions that access the data so that they can also access these new items. It will be hard to find all such functions, and even harder to modify all of them correctly. It's similar to what happens when your local supermarket moves the bread from aisle 4 to aisle 12. Everyone who patronizes the supermarket must figure out where the bread has gone, and adjust their shopping habits accordingly.What is needed is a way to restrict access to the data, to hide it from all but a few critical functions. This will protect the data, simplify maintenance, and offer other benefits as well. Relationship to the Real World Procedural programs are often difficult to design. The problem is that their chief components–functions and data structures–don't model the real world very well. For example, suppose you are writing a program to create the elements of a graphics user interface: menus, windows, and so on. Quick now, what functions will you need? What data structures?The answers are not obvious, to say the least. It would be better if windows and menus corresponded more closely to actual program elements. New Data Types There are other problems with traditional languages. One is the difficulty of creating new data types. Computer languages typically have several built-in data types: integers, floating-point numbers, characters, and so on. What if you want to invent your own data type? Perhaps you want to work with complex numbers, or two dimensional coordinates, or dates—quantities the built-in data types don’t handle easily.Being able to create your own types is called extensibility; you can extend the capabilities of the language. Traditional languages are not usually extensible. Without unnatural convolutions, you can’t bundle together both X and Y coordinates into a single variable called Point, and then add and subtract values of this type. The result is that traditional programs are more complex to write and maintain. The object oriented approach The fundamental idea behind object-oriented languages is to combine into a single unit both data and the functions that operate on that data.Such a unit is called an object. An object’s functions, called member methods in Java, typically provide the only way to access its data. If you want to read the item and return the value to you, you call a member function in the object. It will read the item and return the value to you. You can’t access the data directly. The data is hidden, so it is safe from accidental modification. Data and its functions are said to be encapsulated into a single entity. Data encapsulation and data hiding are key terms in the description of object oriented languages.If you want to modify the data in an object, you know exactly what functions interact with it: the member functions in the object. No other functions can access the data. This simplifies writing, debugging, and maintaining the progra m. A Java program typically consists of a number of objects, which communicate with each other by calling one another’s members functions. We should mention that what are called member functions in C++ are called methods in Java. Also, data items are referred to as instance variables. Calling an object’s member function is referred to as sending a message to the object.