Monday, September 30, 2019
Plato/Socrates & St. Augustine Essay
The realm of the reasoning man, according to Plato in his work Phaedo, is extrapolated by Socrates, that is, a man who is within reason also must admit to the fundamental truths regarding life after death (the viewpoint of Plato in this paper will be seen through Socrates as Phaedo was written to express Platoââ¬â¢s viewpoint through Socrates, so, henceforth, whenever Socrates is mentioned it is Platoââ¬â¢s perspective). That is to say, in Socrates explanation of immortality, there remains the outlook that the body and the soul are not eternally combined; but the soul is grounded in the body through emotions, and feral states of humanity.à When the soul is released from such torpor, it then reclines back into its previous non-corporeal state to either rest, or to transform and reinvent itself in the world.à The soul, according to Socrates, is that which is in us that commands and it is the body that serves.à The following paper will explore the nature of good and evil as it is expressed through Plato/Socrates and Augustine.à There will be comparing and contrasting points on this issue. Augustine believes in the essential goodness of humanity; thus, with the incorporation of the soul as mentioned in Platoââ¬â¢s writing, it seems that both philosophers are in agreement thus far about the nature of humanity.à There are however varying degrees of good and evil.à In either philosopher it is not merely a question of good and evil but of reason in a man.à It is reasong that leads to the choice of good or evil.à Augustine believes for a reasonable person, the pursuit of power would be a safe action. However, one who served their own passions would be apt to sin. By maintaining, Augustine suggests, a well managed ideology and conception of moral value, the pursuit of power would be just as viable an option as piety. à à à à à à à à à à à Augustine intended to explain the principle source of sin was, in fact, intention. Through his interpretation of the fall of man, Augustine rationalized that the acts committed by Adam and Eve, the eating of the apple, were not the actual sins ââ¬â but instead, the decision to eat the apple, and the commitment to the act was the point at which the sin occurred. However, with Platoââ¬â¢s writing, there is redemption for humanity.à With the idea of redemption being in need, both philosophers are admitting the proneness that humanity has for evil.à Plato suggests that the human soul is created out of divine will, and that anything created out of divinity is good. Thus, while St. Augustineââ¬â¢s intention marks humanity as evil, Platoââ¬â¢s soul marks them as capable of being good.à Plato believes that the soul is the image of divinity; in the soul there is found an unceasing existence of transformation.à The reasonable man must then accept the dichotomy of the body and soul, as well as accept their harmony he must distance the idea that the body and the soul are one.à The body is mortal, and can succumb to dissolution, but according to Plato, the soul is indissoluble.à Thus, according to Plato the human body is evil while the soul is good making a dichotomy of good and evil and the capacity for each in each human. The body commands emotions, and its fate lies within those external circumstances, that is nature, but the soul, in Socratesââ¬â¢ view is above nature.à The soul is a higher self.à As the introduction to Phaedo states, ââ¬Å"The human being alone has the consciousness of truth and justice and love, which is the consciousness of God.à And the soul becoming more conscious of these, becomes more conscious of her own immortalityâ⬠(23).à The soul hinges upon the realization that she is immortal.à In that consciousness, and in that state of being, there exists God, and all that is immortal and the goodness of humanity. à à à à à à à à à à à Therefore, Socrates is trying to define the perimeters of immortality, and the fact that a reasonable man cannot indubitably believe that the body and the soul will perish, but must in fact take credence to the soul existing at a higher level of existence, that is, at the level with God.à Socrates is placing a belief system in his dialectic, and in so doing he goes into analyzing the existence of God, or the intangible being that is the divine.à In Phaedo Socrates circulates his ideas around the immortality of the soul and the acceptance of this by the reasoning man on the basis of the dimension that God portrays. By dimension, suffice it to say that God, in divine right, is perfect.à It is in that perfection that man may find allusions to his reasoning, and by so doing, reason that since the soul is of God, then man himself is immortal, as Plato wrights, ââ¬Å"An evil God, or an indifferent God might have had the power but not the will, to preserve usâ⬠¦But is he is perfect, he must will that all rational beings should partake of that perfection which he himself isâ⬠(23).à Life after death then is a certainty on a celestial level. à On this argument in Phaedo, Cebes states, ââ¬Å"â⬠¦knowledge is simply recollection, if true also necessarily implies a previous time in which we have learned now what we recollect.à But this would be impossible unless our soul had been in some place before existing in the form of man; here then is another proof of the soulââ¬â¢s immortalityâ⬠(Plato 60).à Knowledge is something that is acquired through a previous experience.à A reasoning man can deduce that because he is of a reasonable mind he gained knowledge through previous experience.à The idea of mutating and changing, and being in a semi-transcendental state while in oneââ¬â¢s body is something that is prevalent in Socratesââ¬â¢ philosophy. Augustine created this same room for a shift in the combining good and evil of the human body and the divine soul. By suggesting that intent was the source of sin, rather than actions themselves, one would be able to absolve himself of sin by believing that he was following a righteous path.à Thus Augustineââ¬â¢s philosophy suggests, as Plato suggests that there is redemption for humanity.à Both philosophers then meet an agreement point by expressing the truth of the evil nature of humanity.à Both philosophers agree that human nature is evil and it is only the soul which is found to be pure and by following that pure pathway of the soul/God, the evil nature, the body or intent, can be expiated. à à à à à à à à à à à However, while Augustine admitted to redemption for humanity through following the soul he also stated that, ââ¬Å"apparently virtuous acts, like prayer, sacrifice, or the risk of oneââ¬â¢s life could in fact stem from vicious, self-regarding motivesâ⬠(Augustine).[1] This understanding called into question the root motivations of all people. However, looking at the actions of another, one could not see these motivations, and therefore, could not place judgment on their righteousness or validity.à It seems that as Augustine progressed in his philosophy he became more ambiguous as to whether or not humanity could be saved from their own evil intent because of their incapability of selflessness. à à à à à à à à à à à Augustine spoke on this as well. There was no rational process by which one could judge the actions of another ââ¬â other than oneââ¬â¢s personal reason. Reason, therefore would become the most important of the human virtues. Augustine felt that reason, in the mind of any man, could not be corrupted by the passions of evil or by the sinful motivations of others. à à à à à à à à à à à Thus, the division point for each philosopher became whether or not humanity wanted to be good, as it were.à Plato states that the soul is good and that every person has a soul and thus a pathway to goodness and God, while Augustine also admitted to their being a soul he suggests that the human race was too selfish to follow that pathway because their evil intentions overruled their desire to be good. WORKS CITED Augustine.à ââ¬Å"Confessionsâ⬠.à R.S. Pine-Coffin.à Longman.à New Impression Edition.à 2005. Hundert, E.J. ââ¬Å"Augustine and the Sources of the Divided Selfâ⬠. Political Theory. 20 No. 1à à à à à à à à à (1992): 86-123 Plato.à Phaedo.à à Ã
Sunday, September 29, 2019
How to handle stress Essay
Manage stress at university Stress occurs in human life is frequency because there are many challenge people need to face in daily. Also it is a part of studentââ¬â¢s life, when the student study at university, they may face more difficult problem such as more expectation from their parents, financial problems, exam or assignmen Premium962 Words4 Pages How ot manage stress How to manage stress When it comes to how to manage stress, there are loads of methods to deal with this problem. Today, with the increasing number of people getting overwhelmed pressure on their study or job, more and more people are paying their attention to how to solve stress problem more effec Premium568 Words3 Pages Stress essay Stress is something everyone experiences sometime throughout their life; it is essential. This essay will first define stress and comment on both good and bad stress. Secondly, it will give examples of physical, emotional and behavioural symptoms of stress. Thirdly, it will discuss common causes ofThe best way to help student to deal with stress The best way to help student to deal with stressâ⬠¦Ã¢â¬ ¦Ã¢â¬ ¦.. -Attending stress management course Stress is an integral part of life, especially for a student. In fact, not all stress is bad. When you recognize that the stress is detrimental to your life, you need to take action. Attending stress ma Premium309 Words2 Pages How to deal with stress as a college student M. Rowe Professor Bowl CMAT-61 December 6, 2011 How to Deal With Stress as a College Student How does stress affect you? We have all felt this feeling before. Your stomach is twisted, your muscles are tightened, you feel down and out, unhappy and, you cannot think straight. According t Premium814 Words4 Pages How to deal with stress HOW TO DEAL WITH STRESS? Stress is the natural strain which we feel when we have to cope with difficult, unpleasant or dangerous situations. We canââ¬â¢t completely remove it from our lives but we can learn how to deal with it. There is a lot of techniques to cope with stress starting with relaxing Premium322 Words2 Pages Students deal with stress Students Deal With Stress ââ¬Å"Hey, Iââ¬â¢m stressed of homework and studying, letââ¬â¢s have a drinkâ⬠, said by the majority of freshmen students. Alcohol is the easiest coping mechanism to students because we are exposed to alcohol more than anything else. Throughout high school, most students are sh Premium690 Words3 Pages Coping: how to deal with stress Coping: How People Deal with Stress? Whether caused by schoolwork, traffic, or the job, stress is an inevitable phenomenon that is seen daily in the human life. Stress is not always bad. In small doses, stress is a good thing. It can energize and motivate a person to deal with challenges. But prolo Premium702 Words3 Pages How to deal with stress SECTION A 1.1 Scenario 1: Crisis incident (traffic) Lack of time management Scenario 2: Job content and demands Job insecurity Scenario 3: Harassment from her boss Economic/work stress 1.2 PHYSICAL EMOTIONAL SOCIAL ENVIRONMENTAL Crisis incident Harassment from her bossâ⬠¦ Premium887 Words4 Pages Stress Stress CHAPTER I INTRODUCTION Statement of the Research Problem How do you cope with stress in the workplace to achieve a more balanced lifestyle? Stress is a part of everybodyââ¬â¢s life. Depending on the level of stress, it can control our lives, especially in the workplace. We begin to spend Premium1722 Words7 Pages Coping with stress in an organization Coping With Stress In An Organization 26 November 1994 Table of Contents I. Introduction II. Defining Stress III. Types of Stress IV. How to Handle Stress V. Recognizing Stress VI. The Military and Stress VII. Summary I. INTRODUCTION Since t Premium2248 Words9 Pages Psychological stress Psychological stress Psychological stress is a result of many factors and should be dealt with very carefully. Stress can be defined as a set of interactions between the person and the environment that result in an unpleasant emotional state, such as anxiety, tension, guilt, or shame (swi Premium1835 Words8 Pages Stress This report is on stress, what causes it, how and why, and how it can be cured. It will tell you all about stress, why itââ¬â¢s important for people to understand, and what it can do to you and other people. Stress affects everyone and everything, thatââ¬â¢s why itââ¬â¢s important that we all be properly ed Premium1327 Words6 Pages Stress Stress is the combination of psychological, physiological, and behavioral reactions that people have in response to events that threaten or challenge them. Stress can be good or bad depending on the situation which someone is facing. Sometimes, stress can be helpful, providing people with the extra Premium848 Words4 Pages Families and stress ââ¬â coping skills for living with stress and anxiety Families and Stress ââ¬â coping skills for living with stress and anxiety Is stress always bad? No! In fact, a little bit of stress is good. Most of us couldnââ¬â¢t push ourselves to do well at things ââ¬â sports, music, dance, work, and school ââ¬â without feeling the pressure of competition. Without th Premium1872 Words8 Pages Stress and alzhiemers Stress and Alzheimerââ¬â¢s Disease Dr. Dharma Singh Khalsa M.D. is the president of the Alzheimerââ¬â¢s Prevention Foundation, which is a non-profit organization studying the integrated medical approach to the prevention and reversal of memory loss. He has a very different approach to the treatment and pr Premium595 Words3 Pages Stress term paper The Effects of Stress Stress is an ongoing dilemma which occurs in everyoneââ¬â¢s life. It is a factor that is without a question apart of daily living. Due to the minor problems that occur in peopleââ¬â¢s daily lives, massive amounts of stress can arise. Stress means different things to people and effec Premium2630 Words11 Pages Stress and its connection to the mind, the potential health impacts on the body, and its relationship with relationships ââ¬Å"Stress and its Connection to the Mind, the Potential Health Impacts on the Body, and its Relationship with Relationshipsâ⬠Stress is the basic human response to changes that occur as a part of everyday life. Some of the changes that take place are smaller and not as important, but all changes cr
Saturday, September 28, 2019
Attractiveness Of The Hotel In The Industry Tourism Essay
Attractiveness Of The Hotel In The Industry Tourism Essay The process of conducting research on the business environment within which the organization operates and on the organization itself, in order to formulate and implementation of strategy for future business operations can be mentioned as Strategic analysis of hospitality organization. To do the assessment can use number of tools to process of strategic analysis, including PEST (sometimes PESTLE) for analyze external environment and, SWOT analysis use for the internal environmental scanning, and Michael Porterââ¬â¢s five forces model use to assists to understand the competitive forces, the attractiveness and current position in the industry. An effective way to know the past, present and future potentials regarding the industry development is analyzing the industry background as the part of strategic analysis. The External analysis can assess the factors affecting the industry to be existed including political, economical, social, technological, legal and environmental which have great impacts to run the business and use PESTLE analysis. In any industry which it is domestic or international, whether relating to products or services, the rules of competition are personified in five competitive forces of entry of new competitors, threat of substitutes, bargaining power of buyers, bargaining power of suppliers, and rivalry among the existing competitors. According to Porter, one of the crucial determinants of firm profitability is industrial attractiveness. In this assignment, a strategic analysis of the Galadhari hotel which is in hospitality industry has been done through the combination of both theoretical and practical facts regarding this property including organizational background and industry background of this hospitality sector in Sri Lanka, an assessment of the forces affecting the external environment (the use of PESTLE analysis) and an assessment of the attractiveness of this industry (the use of Porterââ¬â¢s 5 forces) regarding the future strat egic action to grab more hospitality market share. Background of the industry and about Organization By concerning about the Sri Lankan market of tourism there can be seen growth in the tourist market. All this euphoria gives rise to the doubt about whether Sri Lanka Tourism is well on the way to recovery and growth or not. For the last seven months that ended July this year (2010), arrivals are up almost 50% year-on-year (YOY) (341,991), with income also keeping pace at 69% growth (Quarter 2; US$ 244.5 million). The hotel and travel Colombo Stock Exchange (CSE) index has been increased by almost 200% for 2009. Today tourism is running on everyoneââ¬â¢s minds, and it is difficult to open a local newspaper without seeing at least one written article on tourism. The reason for the dramatic improvement in Sri Lankaââ¬â¢s tourism data is the victory of war in May 2009. This would be a remarkable result when compared with other regional tourism destinations. Another reason for this improvement was the leader of the terrorist has killed and there is reason for cautious optimism that the social situation in Sri Lanka can improve rapidly. We can hope the company can take advantage of the ââ¬Ëpeace dividendââ¬â¢ by increasing the number of destinations the airline serves. Hotel Galadhari is one of the leading five star luxury hotels in the Sri Lanka. The story of the Galadari Hotel, Colombo which opened its doors in 1984, is a splendid tale of continual improvement of product and highest standard of quality in hospitality over the past 25 years.
Friday, September 27, 2019
Control Structures in programming Essay Example | Topics and Well Written Essays - 1000 words
Control Structures in programming - Essay Example s control structures for the statements have been held up for the reason that the primeval control structures of a digital computer that has a sequential uni-processor that is adequate to replicate some other control structure. The compensate of extraordinary as well as meticulous control structures are for the most part in simplicity plus briefness of appearance and in programming effortlessness, events which are tough to determine and normally in unpredictability by competence of accomplishment proceedings. It is accessed that "language programmers should by no means be pleased by languages that give permission to them to program the whole thing, on the other hand to computer program not anything excluding attention simply"(Fisher, 1990). The control arrangements of programming have not reserved rate by the augment (Fisher, 1990). The next important control structure is the selection that permits the selection in the middle of diverse ways. For instance the C++ offers dissimilar ranks of assortment: we have the one-way choice by means of an ââ¬Å"if structureâ⬠then we have the 2-way choice by means of an ââ¬Å"if-else structureâ⬠. The last selection can be used for the multiple choices by means of a ââ¬Å"switch statementâ⬠. The last type of the control structure is the iteration control structure that guides to the looping of the programming statements. In the C++ we have 3 types of the iteration control structure lopping structures:2 This type of the control structure permits single set of programming language statements to be performed if an outcome is correct plus one more group of proceedings to be performed if a statement is false.à A selection structure is as well acknowledged as an "If-Then-Else" arrangement, its pictorial representation is given below in picture # 1. Here in the selection control structure the state in the ââ¬Å"if statementâ⬠is the expression that is calculated for the decision of the ââ¬Å"if statementâ⬠. If this statement is correct,
Thursday, September 26, 2019
HR. managment assignment Example | Topics and Well Written Essays - 250 words
HR. managment - Assignment Example It was a positive experience and I liked the way they work. The responsibility of HR management must be given to the line managers as they are aware of the condition at grass root levels. They are also responsible for executing the main objectives of an organization. I elected this course as I have always been interested in human behavior. Meeting new people and trying to understand them has always excited me. Now I am keener to make it my profession and I want to formally study and understand human resource management. I expect to learn from this course, how the human resource of an organization can be managed effectively to gain a competitive edge. Also, I would want to learn how to interact with the employees in an organization and more importantly how to motivate them to work at their full potential. The most important thing that I have learnt about human resource management in the past is that, it is not just important to recognize and reward good work (bad work) but also it is equally important to communicate why it is good (or
Why do elderly people prescribed with assistive daily living devices Essay
Why do elderly people prescribed with assistive daily living devices abandon them - Essay Example As well, this study shall extend current limited knowledge of the processes for gaining informed consent of the elderly. Elderly participant recruitment shall take place within the city of [.] in the UK. Adult nursing home services shall provide elderly clients and their families with a brochure to let them know about the study, and there will also be a posting in the local newspaper for two weeks. Elderly clients who are eligible for this study will be outpatients who have been prescribed an AD within the last two years. A non-probability sampling recruitment was chosen because of the specific characteristics of the target population (i.e., elderly, living at home, have been prescribed an AD, and receive visits from an adult nursing service), and so a random sample would not be feasible (Shank, 2002). Purposive sampling is a non-probabilistic sampling technique that has the will advantage this study because the sample size does not have to be determined before the research, and this study's sample will be constrained by time and available resources (Shank, 2002). Purposive sampling allows selection c riteria to be used to determine eligibility of the participant (Shank, 2002). The selection criteria will be that the participant: be over the age of 60 years; be receiving adult nursing home care; have been prescribed at least one AD within the last two years; not be using a hearing aid; be cognitively aware in order to provide informed consent and to take part in an interview. Informed consent is a critical ethical consideration for any research study (Penslar, 1995). Informed consent allows participants to make a reasonable choice to participate in the research, and so it is implied that the goals of the research align with the aspirations of the participant (Penslar, 1995). Literature advising on how best to gain informed consent from the elderly is limited, and to date there are is no standard procedure for ascertaining the competency of an elderly person who agrees to take part in research (Stanley, Guido, Stanley & Shortell, 1984). The elderly are more likely to be experiencing impaired cognition, vision, hearing or speech, so for this study each potential participant shall be asked to discuss their understanding of the research process with the investigator before they sign the informed consent form (Stanley et al., 1984). Persons who demonstrate a lack of understanding, or confusion about what is expected of them during the research shall be thanked and excused from the study. It is anticipated that the present study will contribute to current discourse within the medical community of gaining informed consent from the elderly. As well, thorough recording of procedures for gaining their consent are hoped to encourage other researchers to consider their responsibility and the power relationship with elderly participants in terms of participant well-being, as well as the legalities, ethics, and public accountability involved (Stanley et al., 1984). Informed consent will ensure respect for the dignity of the elderly (Penslar, 1995; Shank, 2002). And coercion of participants will be avoided at all costs (Penslar, 1995). The consent form will be read
Wednesday, September 25, 2019
Write a letter advocating for ARNPs in Florida to have or not to have Essay
Write a letter advocating for ARNPs in Florida to have or not to have the right to prescribe controlled substances - Essay Example To clarify further the website of Florida Board of Nursing clearly mentions under section FAQ that a nurse practitioner cannot prescribe controlled substance. The ARNPââ¬â¢s here illegally prescribing controlled substance by forgery of signature of physicians and by using their DEA number. This kind of irresponsible behaviour of issuing controlled substance even to the teenagers in our locality by few ARNPââ¬â¢s can lead to irreparable loss to society by affecting the health of its members. Excess and uncontrolled dosage of substance abuse negatively impacts physical and psychological health of an individual and even result to death. This kind of substance abuse has its impact on society also as the individual under substance use often encourage others to take up the same. I will appreciate if you consider the issue reported in the letter. I would like to be sent information on the investigation done if it does not violate any rules or regulation. For any further information please contact me on (111) 111-1111 or
Tuesday, September 24, 2019
Surgical Sites Infection Research Paper Example | Topics and Well Written Essays - 1000 words
Surgical Sites Infection - Research Paper Example Surgical infections were a very common eventuality from the early 19th Century. Evidently, the sheer magnitude of the risk imposed by SSIs to both the medical practitioners and, in particular, patients cannot be overlooked. Its impact on the healthcare system is truly innate-costs, mortality, and morbidity. In the year 1992, the Center for Disease Control (CDC) renamed all infections related to operation procedures from surgical wound infections to surgical site infections for a wider coverage and more accurate representation of related infections. The close relationship between healthcare practice, mortality, morbidity, and the cost element associated with the aforementioned shall constitute the crux of the case for greater innovation for effective SSIs management. It is possible that majority of SSIs are preventable. To this end several bodies are tasked with the responsibilities of policy formulation (guidelines and recommendations) that are aimed towards largely preventing and co ntrolling surgical site infections by all healthcare professionals. Although there has been much improvements in surgical site infections prevention, hospital acquired infections continue to increase globally (Alvarado, 2000). Most contamination by SSIs occurs through contamination of the incision by microorganisms from the body of the patient during surgery. Consequently it is prudent that in light of this mechanism of infection that substantial reduction of SSI infections can be undertaken in essentially one of three stages: Pre-operation phase, intra-operation phase, and post-operation phase. In the pre-operation phase, I observe how surgical practices influence patient-infection right before undergoing the surgical procedure itself. The larger working area in surgical operations is the skin. Various types of bacteria inhabit the skin with up to 50% being staphylococcus. The primary source of wound infection during surgical operation has been found to be the skin. Evidence from a research done on the effects of body disinfection on intra-operation wound infection shows that by washing the skin where the incision is to be made with a pre-operation wash having chlorhexidine reduces the bacteria add up on the skin by eighty to ninety percent, and as such a reduction in the wound infection (Bryne, Cuschieri, Napier, & Phillips, 2003). A ten year research on 62,939 wounds determine whether or not the removal of hair from the skin to be operated on (shaving) and its timing could be contributive to surgical site infections. It was established that infection risk amplifies with the increase in duration of the time spent between shaving and conduction of the actual operation. Surgical sites that were shaved two hours before surgery were found to have a clean wound infection rate of 2.3% (Cruse & Foord, 2000).Where the body hair was clipped instead of being shaven recorded a clean wound infection rate of 1.7%. Where the body hair was neither shaved nor clipped, the w ound infection rate was seen to drop to a mere 0.9%.The study concluded that where shaving is essential before surgery, then it should be done as closest to the commencement of the surgery as possible. Perhaps the most successful method of combating surgical site infections was seen through the pioneering use of antiseptic surgery by Ignaz
Monday, September 23, 2019
An oil dependent economy Research Paper Example | Topics and Well Written Essays - 1250 words - 1
An oil dependent economy - Research Paper Example Brown points out many aspects in his article to support the fact that the rising cost of fossil energy is driving the American economy back into its local communities. Every product produced that ends up in the hands of the consumer is directly effected by the use of fossil fuels. Past decades of inexpensive oil has created this dependency which in turn has given rise to the way our society lives. There is virtually no limit to the distance that food can travel to the consumer. Many of the products that we consume daily travel from China, an emerging country, also, have seen a growing dependency on fossil fuels. In their effort to become more capitalistic, backward agricultural methods have been replaced with modern machinery dependent on oil. Dependency on oil not only creates higher cost in food; it also creates a constant flow of filthy air back into the environment. Therefore, with these notable factors, should the government make policies that drive the consumer back toward the local economy? Itââ¬â¢s a question of individual initiative in most instances, but most of us look to the government for guidance just as a child looks to its parents. Should the government be involved at all in the daily lives of the consumer? Policy is not treated in the same fashion, as are laws. Policies put forth to a society as a whole give suggestions and positive influences that are more readily accepted by the majority. A policy is a more tactful way of achieving an end result without the rigors of law. Consider our food safety! Where do our foods originate? What are the safety factors involved in transporting foods from such long distances? What are the positive factors of focusing more on local grown foods? The Food and Water Watch states, ââ¬Å"Our current food system is broken, and it didnââ¬â¢t happen by accident.ââ¬
Sunday, September 22, 2019
Corruption in Sudan Essay Example for Free
Corruption in Sudan Essay Other cities like Omdurman have 2. 1 million, Port Sudan have a total population of 450,000. Kassala, Kosti, Juba are the capital of southern region. People from the country are called Sudanese and 2009 in July Population was 41,087,825: 2. 143%. There are two ethnic groups namely : Arab/Muslim, theses group of people live on the northern part of the country and black African or Christian on south. There are also two types of religion, Islam (official), indigenous beliefs (southern Sudan), Christianity. There are also many languages like Arabic which is official, English also official, tribal languages. Education in Sudan is compulsory for some years,8 Attendance(35%-40%). Literacy level is 61. 1. This countryââ¬â¢s main natural resources include reserves of oil, gold, natural gas copper, iron ore and other industrial metals. Sudan got its independence on January 1, 1956 and the type of government they operate is the provisional government which was established by the comprehensive peace Agreement (CPA) and signed in January 2005. This offers power sharing as far as the national elections takes place. The national election took place starting from April, November 2010. Sudan became the largest debtor to the World Bank and IMF by 1993 this resulted to the suspension of their voting rights by IMF and withdrawals under operative and fully expended loans and credit by the World Bank. It was also said that ââ¬Å"extensive petroleum exploration began in mid1970ââ¬â¢s and might cover all of Sudanââ¬â¢s economic and energy needsâ⬠. This year according to martin â⬠Sudan may need as much as $1. 5billion of foreign aid a year and plans 2 slash government spending by a quarter as it faces budget difficulties due to its recent split into two countries, its finance minister saidâ⬠and according to the finance ministerâ⬠weââ¬â¢re expecting 6 percent (economic growth) or a little more for 2012â⬠There have been conflicts with the northern and southern part of Sudan that have killed 1. 5 million people and also driving many ethnic groups and people from their homes. Sudan had had several episodes of civil welfare since its independence, broke association and now rule with Egypt (this actually did not benefit them anything but further trouble). All regions of Sudan face problems, both the south and the north and corruption can be counted as one of them. The southern part of Sudan has separated as an autonomous region in July 2011 even though it is a different state but it is still a very poor nation with a very low human development. Media on the southern part of Sudan is very poor, undeveloped and not well equipped. A journalist(s) does not have the right to broadcast, report or give any news, information to Darfur (other part of Sudan) and if any journalist(s) violates that law, he/she/they would be severely punished and even be jailed. Today, many journalists are still in prison and only God knows when they might be freed and which will be out. For example, in October 2010, a radio station ââ¬â¢Dabangaââ¬â¢ in Khartoum after a movement of arrests was shut down by the government and seven of its employees have been alleged of exposing state secretes, breaking the constitutional system, the punishment foe this crime is a death penalty. The civil war of 1991 in southern Sudan destroyed almost all southern medical facilities except those that had been rebuilt to treat their people who have been wounded in Juba, Malakal and Waw, these three hospitals are controlled by the government. The facilities were impracticable to use because of the scarcity of the most basic medical materials and a similar problem is faced in the northern Sudan, health care facilities had been considered helpless by the economic situation. Sudan does not have the hard currency to buy basic drugs, such as antibiotics and anti-malarial drugs, and the most important equipment, such as syringes. Private medical care in towns still functions but was also hindered by the scarcity of pharmaceuticals. In conclusion, I think after analyzing these situations in the area of banking, finance, media and medicine, the conflicts and political instability and so one, those should or are the main reason why Sudan is rated as one of the most corrupt countries in the world.
Friday, September 20, 2019
Child labour: Is it a Necessary Evil?
Child labour: Is it a Necessary Evil? Now days, the complex and universal problem of child labor have become a harsh reality attracting worldwide attention. The prevalence of child labour is economically unsound, psychologically disastrous and physically as well as morally dangerous. No doubt, labour is worship but child labour in dangerous and a blot on the conscience of society. It is a sad affair that child labour is deprived of his youthful life, education and thus prospects of higher level of living. Child labour perpetuates poverty, it does not reduce it as it condemns one generation after another to its vicious circle. Child labour harms the progress and prosperity of a nation. Throwing light on this fact, John has rightly said, Starve a child of food, of affection, of freedom, of education and you produce an adult who is stunted as an individual and holds back progress and development rather than accelerate it. Our country is also facing this critical problem of child labor. A wide variation is seen in the estimation of child labor in country. According to 1971, 1981 and 1991 census of India, the number of working children accounted for 10.74 million, 13.60 million and 11.28 million respectively. The ORG has estimated that the number of child labor is closer to 44 million. According to U.N., 55% of the work force in India is made up of child labor. It is normally seen that employers do not always provide accurate data on child labor in order to safeguard themselves from legal hassles. It was pointed out in the World Conference on Children that the number of child labor in the world is about 25 crore, out of which the maximum number about 10 crore is found in India alone. It is estimated that about 7.5 crore are engaged in rural areas while remaining 2.5 crore are employed in urban areas. Alarmed at this critical problem, ILO has also estimated that India alone accounts for one fourth of tot al child labor of the world. Childlabor is rampant across the country. Children can be seen working in agricultural fields, carpet and durri industries, biri, handicraft, match box, glass and bangle industries, in restaurants and as domestic servants. It is estimated that 30 per cent of child labor is engaged in agriculture and allied activities, 30 to 35 percent in industries and remaining are engaged in mining, tea gardens and hotels etc. These occupations are hazardous, causing severe physical damage to them and thus inhibiting their mental, moral and social development. These child laborers become prey to many fatal diseases, like T.B., Cancer, Asthma, lungs and skin related diseases. The sad plight of child labor is depicted by Sudha and Tiwari in these words,It is really sad to note that children in most of the developing countries are living miserable, cheerless lives, toiling unendlessly to ward off starvation, totally deprived of all comforts and opportunities for self growth and development. Poverty, unemployment, traditional attitude, marginalization of farms, urbanization, lack of schools, reluctance of parents to send their children to schools are the factors responsible for the problem of child labour. In fact, poverty is seen as the major factor responsible for this problem. Poor parents hardly have time for their children because they are all the time struggling for bread and butter. They are not in a position to fulfill their responsibilities towards children. In reality, the children are supposed to be the extra earning hands, rather than extra mouths to feed. Children are made to work at a very young age. Emphasizing this factor, the report of the Committee on Child Labor commented, Stronger than tradition is the factor of chronic poverty responsible for the prevalence and perpetuation of child labor. In poor families, the child, since his very appearance in this world, is endowed with an economic mission.The child is compelled to shed sweat of brow to keep the wolf away from the door. Large sized families are also held responsible for this problem. Again, most of the workers are engaged in non organized sector. The inadequacy of wages in this sector compels these workers to send their children on work to supplement their income. Availability of child labor at lower wages also motivates the employers to employ them. The employment of the child labor not only reduces the cost of production but also provides access to that labor which is unresisting and unorganized. As a result of this trend, the wages of other adult workers decline, adult unemployment increases and that paves way for the poverty. Nurses vicious circle of poverty explains the phenomenon of child labor clearly. Thus, child labor is an exploitation of child by the vested interests. On the one side, there is compulsion of poor parents and on the other side; the unresponsive attitude of specific industries is also responsible for this problem. The situation of child laborers in India is desperate. Children work for eight hours at a stretch with only a small break for meals. The meals are also frugal and the children are ill nourished. Most of the migrant children, who cannot go home, sleep at their work place, which is very bad for their health and development. Seventy five percent of Indian population still resides in rural areas and are very poor. Children in rural families who are ailing with poverty perceive their children as an income generating resource to supplement the family income. Parents sacrifice their childrens education to fulfill the basic needs of their younger siblings and view them as wage earners for the entire family. Irrelevance of education in practical life is also considered an important factor for this problem. It is rightly pointed out, A secondary reason for child labor is that many children choose to work because neither they nor their poverty stricken families see the point of acquiring an education which has little relevance to their lives and which moreover does not guarantee them a job. They prepare to undergo some kind of apprenticeship so that they can learn a skill and earn money at the same time. These children are deprived of their childhood. The prospects of getting good education and good jobs become a distant dream for them. Thus, the parents, society and the state are responsible for thi s criminal injustice with the future citizens. Children are flowers of our national garden they should be nurtured with love and affection so that; they grow into responsible and responsive citizens. Child labour has important demographic and social-economic implications for developing countries like India. Many provisions have been made in the constitution of the country to promote the welfare and development of children. Under Article 29 of the constitution, no child below the age of 14 can be deployed in any hazardous work. Article 23 prohibits forced labour. The chapter IV of theIndian constitution mentions specific directions related to the welfare of children. In Article 39, it is made obligatory for the states to formulate polices in such a way so that the healthy development of children can be ensured. To safeguard the interests of these deprived children, various laws have been enacted in the country. Many legislations have been passed to prevent the employment of children in hazardous occupations and to improve their working conditions. Many policies have also been formulated for the healthy and balanced development of children. In the same way, there are important legislations which provide legal protection to child labour in India. Some of them are following: 1. Child (Pledging of labour). Act (Government of India, 1933) 2. The Employment of Children Act (Government of India, 1938) 3. The Minimum wages Act, 1948 4. The factories Act, 1948 5. The Plantation Labour Act, 1951 6. The Mines Act, 1952 7. The Merchant Shipping Act, 1958 8. The Motor Transport Workers Act, 1961 9. The Apprentices Act, 1961 10. The Bedi and Cigar Workers Act, 1966 11. State Shops and Establishment Acts, 12. According to the National Policy for children, 1974, no child under 14 years can be engaged in any hazardous occupation. It is also laid down in the policy that children should be protected against neglect, cruelty and exploitation. Again, the Child Labour (Prohibition and Regulation) Act was initialed in 1986 to ban childrens employment in 70 hazardous occupations. National Child Labour Project (NCLP) was also launched by Labour Ministry in 1988 to rehabilitate working children. In Oct, 2006, the Government has passed legislation to ban the employment of children below 14 years in restaurants, hotels, tea-stalls, eateries and as domestic laborers. India has also become a signatory to various international declarations and agreements to regulate the menace of child labour. So, it has become obligatory for the country to undertake the measures to eliminate the scourge of child labour which has assumed serious proportions in recent years. Many policies have been formulated for the healthy and balanced development of children. The Government has launched Sarva Shiksha Abhiyan, Mid Day Meal Scheme, Education Guarantee programme etc to bring the child labour under the umbrella of education. Non Governmental Organizations were also permitted to open residential schools for these children to bring them back to the mainstream of the society. Residential and special schools have also been setup for the education of child labor. In 2006 the Government has introduced Integrated Child Development services aimed at providing a package of services consisting of supplementary nutrition, immunization, health check up and education and non-form al education. In spite of adoption and implementation of various policies, laws and programmes by the government directly or indirectly, the problem of child labor is still staring at us. Due to ignorance, illiteracy and economic compulsions of the poor families, these laws are evaded at different places at different points of time. Weak enforcement machinery, little information related to child labor laws and peculiar socio-economic conditions are also the factors responsible for the avoidance of laws related to children. To check the problem of child labour, it is essential to eradicate the menace of poverty by improving agriculture sector, providing employment to unemployed hands at minimum wages, establishing agro-processing units in rural areas. Stringent measures should also be taken to make employment generation and poverty eradication plans effective and successful and corruption free. In the same way, population control measures and other medical facilities must be provided to the poor section of the country. Adequate school facilities, provision of night schools, improvement in school environment and curricula of education can also contribute a lot in solving this critical problem. National Commission for Protection of Child Rights (NCPCR) should also ensure that rescued child labourers do not return to work. So every effort must be made for the repatriation of rescued child labourers to their native places. Poverty, unemployment and illiteracy are the prime reasons responsible for this problem. So efforts must be made to eradicate these causes. Monetary incentives and income generating assets must be provided to poor families so that they are not compelled to send their children to work. It is essential to compensate the families of those children who are being withdrawn from work force. A strong socio-political environment must be achieved with the active cooperation of people, society, and non government organization. NGOs must motivate the parents to provide education, health care and skill development facilities to their children. Special schools may be set up for the child labor so they can acquire minimum qualifications. In the same way, specific strategies must be evolved keeping in mind the nature of work in which the child is currently engaged. Thus, a joint effort of government, NGOs and society is required to solve this critical problem. We should try to strike at the root ca use of this critical problem. Efforts should be made to change the attitude and mindset of the people towards their children. We should never forget that todays children are tomorrows citizen. If this critical problem is not tackled urgently, we can well imagine the future of our country in the days to come. 1
How to Play Hockey Essay -- essays papers
How to Play Hockey Ice Hockey is believed to have begun during the Middle Ages, when northern Europeans played games on makeshift ice skates. The French explorers who watched the Indians, who would also play this stick and ball game, called it "hoquet". Before beginning to play hockey you must know the rules of the game. A hockey team consists of a goal tender, two defenders, and three forwards ( a center and two wings ). Hockey is played in three twenty-minute periods. The team that hits the most pucks into the opponent's goal wins. The game is played in an ice-covered rink shaped like a rectangle. Wooden walls about three or four feet high surround the rink. At each end is a cage, or goal which the players try to hit the puck into. They hit the pucks with wooden or graphite sticks with curved ends. The puck is a disc-like object made of black rubber. In order to begin the game each player must be appropriately dressed. A hockey uniform consists of a series of pads and a helmet to protect you from the lighting fast pucks, the rock hard ice floor and of Course the aggressive players. The helmet is the most important thing to wear. It protects your head in case of a direct impact like airbags protect your head from hitting the dash in a car. There are many brands and sizes to choose from. The most reliable and well known is a company called "Bauer." The size usually depends on the shape and measurements of your head. The next impo...
Thursday, September 19, 2019
Essay on All Quiet on the Western Front -- All Quiet on the Western Fr
All Quiet on the Western Frontà à à Erich Maria Remarqueââ¬â¢s literary breakthrough, All Quiet on the Western Front, describes two stories. It meticulously chronicles the thoughts of a soldier in World War I while simultaneously detailing the horrors of all wars; each tale is not only a separate experience for the soldier, but is also a new representation of the fighting. The war is seen through the eyes of Paul Baumer whose mindset is far better developed in comparison to his comradesââ¬â¢. His true purpose in the novel is not to serve as a representation of the common soldier, but to take on a godly and omniscient role so that he may serve as the connection between WWI and all past and future melees of the kind. Baumer becomes the representation of all men, and, through him, the reader comes to see the true essence of such a human struggle. Though the novel introduces the reader to a seasoned soldier in the German army, its tale of war begins even before enlistment. The soldierââ¬â¢s ââ¬Å"bellies are full with beef and haricot beans;â⬠their hearts are full of happiness. ââ¬Å"The cook,â⬠or oneââ¬â¢s parents, ââ¬Å"spoonsâ⬠¦out a great dollop,â⬠or provides for their needs (1). Before enlistment, the menââ¬â¢s futures were good and certain; ââ¬Å"each man had a mess tin full for the eveningâ⬠(1). Though sheltered, the men were ââ¬Å"satisfied and at peaceâ⬠(1). Shortly after these introductory passages, Baumer expresses his disdain for this prior life, suggesting that the soldiersââ¬â¢ present paradigms are the only views that are reliable; ââ¬Å"our generation is more to be trusted than [the older generation]â⬠(12). However, though these men have been alerted to the ways of the world, these revelations visibly corrupt them for within their soul (ââ¬Å"under their nailsâ⬠) lies the... ...ar-mongering patriots, it sympathizes with mankind. The tale never deviates from this antiwar thesis, ingeniously allowing the everyday person to comprehend the stupidity of the bloodshed pervading world history. There is no real group designated as an enemy since the true culprit of wartime horror is war itself. Though this pacifist statement is made quite epigrammatically, it takes the reader until the end of the novel to understand the true power of such an idea. In the last few lines, the inner battle one fights in a war is linked to the inner battle we fight with life itself. No matter how hard we try, ââ¬Å"so long as it is there, [life] will seek its own way out, heedless of the will that is withinâ⬠(295). It is the human plight to unconsciously fight for survival. All Quiet on the Western Front suggests that there are cases where surviving is another form of death.
Wednesday, September 18, 2019
Joseph Stalin: Did his Rule Benefit Russian Society and the Russian People? :: Joseph Stalin Essays
Joseph Stalin: Did his Rule Benefit Russian Society and the Russian People? Ã Ã Ã Ã Ã In this paper I plan to prove that even though Stalin made improvements in the Russian industrial system, his rule did not benefit Russian society and the Russian people. In order to accomplish this, several questions must be asked. How did Stalin affect Russia's industrial power? How did Stalin try to change Russia's agricultural system? What changes did Stalin make in society? What were Stalin's purges, and who did they effect? Ã Ã Ã Ã Ã Joseph Vissarionovich Djugashvili was born on December 21, 1879, on the southern slopes of the Caucasus mountains, in the town of Gori. His mother, Ekaterina was the daughter of a peasant who married at fifteen and who lost her first three children at birth. Vissarion, his father, was a self-employed shoemaker who had a violent temper (Marrin 6-7). Ã Ã Ã Ã Ã Young Djugashvili was small and wiry and had a deeply pitted face from a small pox attack that nearly killed him. He also had blood poisoning in his left arm that was probably caused by Vissarion's beating fists. The arm would stiffen at the elbow joint and wither, making it lame and useless for the rest of his life (Lewis 8; Marrin 8). Ã Ã Ã Ã Ã He was dedicated to only one person, his mother, and her only ambition was for her son to become a priest and to bless her with his own hands. But, this dream was crushed when Joseph was expelled from Tiflis Theological Seminary for reading "forbidden books" such as Marx and Lenin (Lewis 8; Marrin 20). Ã Ã Ã Ã Ã After his expulsion from Tiflis school, Joseph became a revolutionary. He organized strikes and demonstrations at factories and also found ways to gather money for Lenin and the Bolshevik party. He was banished to Siberia six times between the years 1903 and 1917. Each time, he escaped easily, except the last, when he was released because of the February revolution (Lewis 19; Marrin 24). After the death of his first wife, Ekaterina Svanidze, Joseph became more cold and tough. He gave the child that his wife bore him to her parents and even chose a new name for himself, Stalin, the Man of Steel (Marrin 26). Ã Ã Ã Ã Ã Then came the October Revolution and the rise of Lenin and the Bolsheviks. Stalin became general secretary of the Bolshevik party's Central Committee. He was also the commissar of the Workers' and Peasants' Inspectorate and the commissar of nationalities (McKay 927; Treadgold 205). After Lenin's, death Stalin gained power by allying himself with the moderates to fight off his rival, Leon Trotsky, who was a radical and another member of the Central
Tuesday, September 17, 2019
Object Oriented Programming in Different Languages
OOP with Microsoft Visual Basic . NET and Microsoft Visual C# Step by Step by Robin A. Reynolds-Haertle Microsoft Press à © 2002 (393 pages) ISBN: 0735615683 This intuitive, self-paced learning title is designed to help you master the basics of object-oriented programming with Visual Basic. NET or Visual C#. Table of Contents OOP with Microsoft Visual Basic . NET and Microsoft Visual C# . NET Step by Step Introduction Chapter 1 ââ¬â Writing Your First Object-Oriented Program Chapter 2 ââ¬â Creating Class Instances with Constructors Chapter 3 ââ¬â Creating Fields and PropertiesChapter 4 ââ¬â Working with Methods Chapter 5 ââ¬â Using Inheritance to Create Specialized Classes Chapter 6 ââ¬â Designing Base Classes as Abstract Classes Chapter 7 ââ¬â Responding to Changes with Events and Exceptions Chapter 8 ââ¬â Putting It All Together with Components Chapter 9 ââ¬â Providing Services Using Interfaces Chapter 10 ââ¬â Using Classes Interchangeably T hrough Polymorphism Chapter 11 ââ¬â Using Shared and Static Members Chapter 12 ââ¬â Overloading Operators with Visual C# Chapter 13 ââ¬â Saving Instance Data Chapter 14 ââ¬â Reducing Complexity by DesignAppendix ââ¬â Additional Resources Index Height Gage List of Sidebars OOP with Microsoft Visual Basic . NET and Microsoft Visual C# . NET Step by Step PUBLISHED BY Microsoft Press A Division of Microsoft Corporation One Microsoft Way Redmond, Washington 98052-6399 Copyright à © 2002 by Robin A. Reynolds-Haertle All rights reserved. No part of the contents of this book may be reproduced or transmitted in any form or by any means without the written permission of the publisher. Library of Congress Cataloging-in-Publication Data Reynolds-Haertle, Robin A. , 1959-OOP with Microsoft Visual Basic . NET and Microsoft Visual C# Step by Step / Robin A. Reynolds-Haertle. p. cm. Includes bibliographical references and index. ISBN 0-7356-1568-3 1. Object-oriented programming (Computer science). 2. Microsoft Visual BASIC. 3. C# (Computer program language) I. Title. QA76. 64 . R495 2001 005. 2ââ¬â¢768ââ¬âdc21 2001052122 Printed and bound in the United States of America. 1 2 3 4 5 6 7 8 9 QWT 7 6 5 4 3 2 Distributed in Canada by Penguin Books Canada Limited. A CIP catalogue record for this book is available from the British Library.Microsoft Press books are available through booksellers and distributors worldwide. For further information about international editions, contact your local Microsoft Corporation office or contact Microsoft Press International directly at fax (425) 936-7329. Visit our Web site at www. microsoft. com/mspress. Send comments to: [emailà protected] com. IntelliSense, Microsoft, Microsoft Press, Visual Basic, Visual C#, Visual Studio, and Windows are either registered trademarks or trademarks of Microsoft Corporation in the United States and/or other countries.Other product and company names mentioned herein may be the trad emarks of their respective owners. The example companies, organizations, products, domain names, e-mail addresses, logos, people, places, and events depicted herein are fictitious. No association with any real company, organization, product, domain name, e-mail address, logo, person, place, or event is intended or should be inferred. Acquisitions Editor: Danielle Bird Project Editor: Kathleen AtkinsTechnical Editor: Jack Beaudry Body Part No. X08-42192 MICROSOFT LICENSE AGREEMENT Book Companion CD IMPORTANTââ¬âREAD CAREFULLY:This Microsoft End-User License Agreement (ââ¬Å"EULAâ⬠) is a legal agreement between you (either an individual or an entity) and Microsoft Corporation for the Microsoft product identified above, which includes computer software and may include associated media, printed materials, and ââ¬Å"onlineâ⬠or electronic documentation (ââ¬Å"SOFTWARE PRODUCTâ⬠).Any component included within the SOFTWARE PRODUCT that is accompanied by a separate End -User License Agreement shall be governed by such agreement and not the terms set forth below. By installing, copying, or otherwise using the SOFTWARE PRODUCT, you agree to be bound by the terms of this EULA. If you do not agree to the terms of this EULA, you are not authorized to install, copy, or otherwise use the SOFTWARE PRODUCT; you may, however, return the SOFTWARE PRODUCT, along with all printed materials and other items that orm a part of the Microsoft product that includes the SOFTWARE PRODUCT, to the place you obtained them for a full refund. Software PRODUCT LICENSE The SOFTWARE PRODUCT is protected by United States copyright laws and international copyright treaties, as well as other intellectual property laws and treaties. The SOFTWARE PRODUCT is licensed, not sold. 1. GRANT OF LICENSE. This EULA grants you the following rights: a. Software Product. You may install and use one copy of the SOFTWARE PRODUCT on a single computer.The primary user of the computer on which th e SOFTWARE PRODUCT is installed may make a second copy for his or her exclusive use on a portable computer. b. Storage/Network Use. You may also store or install a copy of the SOFTWARE PRODUCT on a storage device, such as a network server, used only to install or run the SOFTWARE PRODUCT on your other computers over an internal network; however, you must acquire and dedicate a license for each separate computer on which the SOFTWARE PRODUCT is installed or run from the storage device.A license for the SOFTWARE PRODUCT may not be shared or used concurrently on different computers. c. License Pak. If you have acquired this EULA in a Microsoft License Pak, you may make the number of additional copies of the computer software portion of the SOFTWARE PRODUCT authorized on the printed copy of this EULA, and you may use each copy in the manner specified above. You are also entitled to make a corresponding number of secondary copies for portable computer use as specified above. . Sample Cod e. Solely with respect to portions, if any, of the SOFTWARE PRODUCT that are identified within the SOFTWARE PRODUCT as sample code (the ââ¬Å"SAMPLE CODEâ⬠): i. Use and Modification. Microsoft grants you the right to use and modify the source code version of the SAMPLE CODE, provided you comply with subsection (d)(iii) below. You may not distribute the SAMPLE CODE, or any modified version of the SAMPLE CODE, in source code form. ii. Redistributable Files.Provided you comply with subsection (d)(iii) below, Microsoft grants you a nonexclusive, royalty-free right to reproduce and distribute the object code version of the SAMPLE CODE and of any modified SAMPLE CODE, other than SAMPLE CODE, or any modified version thereof, designated as not redistributable in the Readme file that forms a part of the SOFTWARE PRODUCT (the ââ¬Å"Non-Redistributable Sample Codeâ⬠). All SAMPLE CODE other than the Non-Redistributable Sample Code is collectively referred to as the ââ¬Å"REDISTRIBU TABLES. â⬠iii. Redistribution Requirements.If you redistribute the REDISTRIBUTABLES, you agree to: (i) distribute the REDISTRIBUTABLES in object code form only in conjunction with and as a part of your software application product; (ii) not use Microsoftââ¬â¢s name, logo, or trademarks to market your software application product; (iii) include a valid copyright notice on your software application product; (iv) indemnify, hold harmless, and defend Microsoft from and against any claims or lawsuits, including attorneyââ¬â¢s fees, that arise or result from the use or distribution of your software application product; and (v) not permit further distribution of the REDISTR IBUTABLES by your end user. Contact Microsoft for the applicable royalties due and other licensing terms for all other uses and/or distribution of the REDISTRIBUTABLES. 2. DESCRIPTION OF OTHER RIGHTS AND LIMITATIONS. â⬠¢ Limitations on Reverse Engineering, Decompilation, and Disassembly. You may not reve rse engineer, decompile, or disassemble the SOFTWARE PRODUCT, except and only to the extent that such activity is expressly permitted by applicable law notwithstanding this limitation. â⬠¢ Separation of Components. The SOFTWARE PRODUCT is licensed as a single product.Its component parts may not be separated for use on more than one computer. â⬠¢ Rental. You may not rent, lease, or lend the SOFTWARE PRODUCT. â⬠¢ Support Services. Microsoft may, but is not obligated to, provide you with support services related to the SOFTWARE PRODUCT (ââ¬Å"Support Servicesâ⬠). Use of Support Services is governed by the Microsoft policies and programs described in the user manual, in ââ¬Å"onlineâ⬠documentation, and/or in other Microsoft-provided materials. Any supplemental software code provided to you as part of the Support Services shall be considered part of the SOFTWARE PRODUCT and subject to the terms and conditions of this EULA.With respect to technical information you provide to Microsoft as part of the Support Services, Microsoft may use such information for its business purposes, including for product support and development. Microsoft will not utilize such technical information in a form that personally identifies you. â⬠¢ Software Transfer. You may permanently transfer all of your rights under this EULA, provided you retain no copies, you transfer all of the SOFTWARE PRODUCT (including all component parts, the media and printed materials, any upgrades, this EULA, and, if applicable, the Certificate of Authenticity), and the recipient agrees to the terms of this EULA. â⬠¢ Termination.Without prejudice to any other rights, Microsoft may terminate this EULA if you fail to comply with the terms and conditions of this EULA. In such event, you must destroy all copies of the SOFTWARE PRODUCT and all of its component parts. 3. COPYRIGHT. All title and copyrights in and to the SOFTWARE PRODUCT (including but not limited to any images, photogr aphs, animations, video, audio, music, text, SAMPLE CODE, REDISTRIBUTABLES, and ââ¬Å"appletsâ⬠incorporated into the SOFTWARE PRODUCT) and any copies of the SOFTWARE PRODUCT are owned by Microsoft or its suppliers. The SOFTWARE PRODUCT is protected by copyright laws and international treaty provisions. Therefore, ou must treat the SOFTWARE PRODUCT like any other copyrighted material except that you may install the SOFTWARE PRODUCT on a single computer provided you keep the original solely for backup or archival purposes. You may not copy the printed materials accompanying the SOFTWARE PRODUCT. 4. U. S. GOVERNMENT RESTRICTED RIGHTS. The SOFTWARE PRODUCT and documentation are provided with RESTRICTED RIGHTS. Use, duplication, or disclosure by the Government is subject to restrictions as set forth in subparagraph (c)(1)(ii) of the Rights in Technical Data and Computer Software clause at DFARS 252. 27-7013 or subparagraphs (c)(1) and (2) of the Commercial Computer Softwareââ¬â Restricted Rights at 48 CFR 52. 227-19, as applicable. Manufacturer is Microsoft Corporation/One Microsoft Way/Redmond, WA 98052-6399. 5. EXPORT RESTRICTIONS. You agree that you will not export or re-export the SOFTWARE PRODUCT, any part thereof, or any process or service that is the direct product of the SOFTWARE PRODUCT (the foregoing collectively referred to as the ââ¬Å"Restricted Componentsâ⬠), to any country, person, entity, or end user subject to U. S. export restrictions. You specifically agree not to export or re-export any of the Restricted Components (i) to any country to which the U. S. as embargoed or restricted the export of goods or services, which currently include, but are not necessarily limited to, Cuba, Iran, Iraq, Libya, North Korea, Sudan, and Syria, or to any national of any such country, wherever located, who intends to transmit or transport the Restricted Components back to such country; (ii) to any end user who you know or have reason to know will ut ilize the Restricted Components in the design, development, or production of nuclear, chemical, or biological weapons; or (iii) to any end user who has been prohibited from participating in U. S. export transactions by any federal agency of the U. S. government. You warrant and represent that neither the BXA nor any other U. S. ederal agency has suspended, revoked, or denied your export privileges. DISCLAIMER OF WARRANTY NO WARRANTIES OR CONDITIONS. MICROSOFT EXPRESSLY DISCLAIMS ANY WARRANTY OR CONDITION FOR THE SOFTWARE PRODUCT. THE SOFTWARE PRODUCT AND ANY RELATED DOCUMENTATION are PROVIDED ââ¬Å"AS ISâ⬠WITHOUT WARRANTY OR CONDITION OF ANY KIND, EITHE R EXPRESS OR IMPLIED, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, OR NONINFRINGEMENT. THE ENTIRE RISK ARISING OUT OF USE OR PERFORMANCE OF THE SOFTWARE PRODUCT REMAINS WITH YOU. LIMITATION OF LIABILITY.TO THE MAXIMUM EXTENT PERMITTED BY APPLICABLE LAW, IN NO EVENT SHALL MICROSOFT OR ITS SUPPLIERS BE LIABLE FOR ANY SPECIAL, INCIDENTAL, INDIRECT, OR CONSEQUENTIAL DAMAGES WHATSOEVER (INCLUDING, WITHOUT LIMITATION, DAMAGES FOR LOSS OF BUSINESS PROFITS, BUSINESS INTERRUPTION, LOSS OF BUSINESS INFORMATION, OR ANY OTHER PECUNIARY LOSS) ARISING OUT OF THE USE OF OR INABILITY TO USE THE SOFTWARE PRODUCT OR THE PROVISION OF OR FAILURE TO PROVIDE SUPPORT SERVICES, EVEN IF MICROSOFT HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. IN ANY CASE, MICROSOFTââ¬â¢S ENTIRE LIABILITY UNDER ANY PROVISION OF THIS EULA SHALL BE LIMITED TO THE GREATER OF THE AMOUNT ACTUALLY PAID BY YOU FOR THE SOFTWARE PRODUCT OR US$5. 00; PROVIDED, HOWEVER, IF YOU HAVE ENTERED INTO A MICROSOFT SUPPORT SERVICES AGREEMENT, MICROSOFTââ¬â¢S ENTIRE LIABILITY REGARDING SUPPORT SERVICES SHALL BE GOVERNED BY THE TERMS OF THAT AGREEMENT.BECAUSE SOME STATES AND JURISDICTIONS DO NOT ALLOW THE EXCLUSION OR LIMITATION OF LIABILITY, THE ABOVE LIMITATION MAY NOT APPLY TO YOU. MISCELLAN EOUS This EULA is governed by the laws of the State of Washington USA, except and only to the extent that applicable law mandates governing law of a different jurisdiction. Should you have any questions concerning this EULA, or if you desire to contact Microsoft for any reason, please contact the Microsoft subsidiary serving your country, or write: Microsoft Sales Information Center/One Microsoft Way/Redmond, WA 98052- 6399. PN 097-0002296 For Bruce Youââ¬â¢re still the one.About the Author Robin A. Reynolds-Haertle Robinââ¬â¢s interest in computing began when she taught herself to program in C to fulfill a programming language requirement for her masterââ¬â¢s degree in biomathematics at the University of Washington. Fascinated by the subject, Robin attended as many computer science classes as her schedule would permit, and took a position as a programmer with the University of Washington after graduation. Robin spent several years in the biotechnology industry, writing dat a applications in various database management systems, C, and Microsoft Visual Basic.Not content to just read computer science and software engineering books, she then pursued and completed a masterââ¬â¢s degree in software engineering at Seattle University. During these years, Robin presented training sessions on software engineering topics to her peers. After so many years in the classroom, Robin wanted to try teaching, and jumped at the opportunity to teach object- oriented programming with Visual Basic for the University of Washington Outreach program. Here she discovered she loved writing instructional materials and sample projects for her students. This led Robin to her current position as a programmer/writer at Microsoft, writing conceptual documentation for Visual Basic and Microsoft Visual C#.When not at the computer, Robin is trying to make peace with her abandoned husband and sons. After she completes this book, they look forward to Momââ¬â¢s attention to Cub Scouts , Boy Scouts, hiking, and watching BattleBots. After catching up with the family, Robin hopes to sew a few quilts. Acknowledgments First Iââ¬â¢d like to thank the team at Microsoft Press that turned my writing into a book. Without Jack Beaudry, the technical editor, I never would have gotten any sleep. His meticulous reviews saved me time and saved readers from much frustration. Kathleen Atkins, the project editor, kept everything running smoothly and improved my text considerably.Credit is also due to Danielle Bird, acquisitons editor; Rebecca McKay (Becka), manuscript editor; Cheryl Penner and Rebecca Wendling (Becky), copy editors; Gina Cassill, compositor; and Michael Kloepfer, electronic artist. I also want to thank my colleagues at Microsoft who listened sympathetically to my complaints about deadlines and beta software. Editors Roger Haight and Meredith Waring made me a better writer. Mike Pope reminded me to put the reader ahead of being clever. Megan Shult and Ann Morris , my managers, were supportive even when writing consumed all my after-hours energy. Much of what I learned about . NET came from the material written by my team members Jina Chan, Seth Grossman, Steve Hoag, Steve Stein, and Matt Stoecker. And thank you to Diana Rain, my office mate.Iââ¬â¢d also like to thank Ruth McBride, my longtime manager, and my instructors at Seattle University. I appreciate their patience with my often experimental approaches to their assignments over the years. I also have to mention the friends that still call to check on me, even though I havenââ¬â¢t called them in months. Jennifer Wirt, Lisa Wiken, Molly Potteiger, and Julie Brinkley have been true friends. This book would never have been written without the support of my husband, Bruce. He completely ran my life for the seven months I was writing this book. I worked and wrote; he did everything else. My friends are still laughing about how he RSVPs for me.Lastly, I thank my sons for just being ther e and for being proud of me. Introduction Microsoft Visual Basic developers have long clamored for complete objectoriented language support. Microsoft Visual Basic . NET supports all the features of an object- oriented language. In addition, the entire Microsoft . NET Framework, which includes the development support for Microsoft Windows applications, Web applications, Web services, graphics, and data access, is designed according to object-oriented principles. Developers who have a firm grasp of object-oriented principles will be the strongest . NET developers.Also new to developers is C#, a C-based language that gives developers a language choice for developing with the . NET Framework. Some C, Java, and C++ development will move to C# to take advantage of . NETââ¬â¢s features. Visual Basic programmers looking to learn a C language might also move to C#. Visual Basic . NET and C# both support object-oriented development with the . NET Framework. No matter what language you cho ose for development, being able to read code in either language will double your access to Microsoft Visual Studio documentation, . NET books, magazine articles, and other developer resources. System RequirementsYouââ¬â¢ll need the following hardware and software to complete the exercises in this book: à ¦ à ¦ Microsoft Visual Studio . NET Professional edition. The Visual Studio . NET software isnââ¬â¢t included with this book. You must purchase it separately and install it before you can complete the exercises in this book. A computer capable of running Microsoft Visual Studio . NET. The following hardware configuration is recommended by the Microsoft Visual Studio . NET Web site, at http://msdn. microsoft. com/vstudio/nextgen/ Computer/Processor PC with a Pentium IIââ¬âclass processor, 450 megahertz (MHz); Pentium IIIââ¬âclass processor, 600 MHz recommendedOperating System Microsoft Windows 2000, Server or Professional Microsoft Windows XP Home or Professional Micr osoft Windows NT 4. 0 Server Memory Windows 2000 Professional, 96 megabytes (MB) of RAM; 128 MB recommended Windows 2000 Server, 192 MB of RAM; 256 MB recommended Windows XP Professional, 128 MB of RAM; 160 Recommended Hard Disk 500 MB on System Drive and 3. 0 gigabyte (GB) on installation drive Drive CD-ROM drive Display VGA or higherââ¬âresolution monitor Computer/Processor Input Device Microsoft Mouse or compatible pointing device Finding Your Best Starting Point This book is designed to teach you the fundamentals of object-oriented programming.You can use this book if you have a basic knowledge of Visual Basic 6, Visual Basic . NET, Visual C#, or another Windows programming language. The exercises in this book assume you can already perform the following tasks: à ¦ Create a new Windows Application project, build it, and run it. à ¦ Add Windows Forms controls to a Windows Form. à ¦ Create a method to respond to the Click event of a Button control. à ¦ Create a simple meth od (called a Sub or Function in Visual Basic . NET). à ¦ Declare and use variables. For an introduction to Visual Basic . NET, read Microsoft Visual Basic . NET Step by Step by Michael Halvorson (Microsoft Press, 2002).For an introduction to Visual C# , read Microsoft Visual C# . NET Step by Step by John Sharp and Jon Jagger (Microsoft Press, 2002). Use the following table to find your best starting point in this book. If you are New To object- oriented programming Migrating From Visual Basic 6 Switching From another object- oriented programming Follow these steps Install the practice files as described in the following section, ââ¬Å"Installing and Using the Practice Filesâ⬠Work through the chapters sequentially for a complete introduction to object-oriented programming. Chapters 1 through 7, 9, and 11 concentrate on the mechanics of object- riented programming, while the other chapters cover the concepts in more depth. Install the practice files as described in ââ¬Å"Inst alling and Using the Practice Filesâ⬠on the next page. Work through the chapters sequentially for a complete introduction to object- oriented programming with Visual Basic .NET. Chapters 1 through 7, 9, and 11 concentrate on the mechanics of object- oriented programming, while the other chapters cover the concepts in more depth. Install the practice files as described in ââ¬Å"Installingand Using the Practice Files. â⬠If you are New language. Referencing The book after working through the exercises Follow these steps Complete Chapter 1 to learn the basic yntax of properties and methods. Read the Quick Reference sections at the end of the chapters for information about specific class constructs. Use the index or the Table of Contents to find information about particular subjects. Read the Quick Reference at the end of each chapter to find a brief review of the syntax and techniques presented in the chapter. Installing and Using the Practice Files The companion CD inside the back cover of this book contains the practice files that youââ¬â¢ll use as you perform the exercises in the book. For example, when youââ¬â¢re learning to create class events, youââ¬â¢ll use a bitmap file named Train. bmp.By using the practice files, you wonââ¬â¢t waste time creating objects that arenââ¬â¢t relevant to the exercise. Instead, you can concentrate on learning object-oriented programming with Visual Basic . NET and Visual C# . NET. The files and the step-by-step instructions in the lessons also let you learn by doing, which is an easy and effective way to acquire and remember new skills. Important Install the practice files Before you break the seal on the OOP with Microsoft Visual Basic . NET and Microsoft Visual C# Step by Step companion CD package, be sure that this book matches your version of the software.This book is designed for use with Microsoft Visual Studio . NET Professional Edition for the Windows operating systems. To find out what softw are youââ¬â¢re running, you can check the product package or you can start the software, and then click About Microsoft Development Environment in the Help menu at the top of the screen. Follow these steps to install the practice files on your computerââ¬â¢s hard disk so that you can use them with the exercises in this book. 1. Remove the companion CD from the package inside the back cover of this book and insert the CD in your CD-ROM drive. 2. Double-click the My Computer icon on the Desktop.Tip On some computers, the startup program might run automatically when you close the CD-ROM drive. In this case, skip steps 2 through 5 and follow the instructions on the screen. 3. Double-click the icon for your CD-ROM drive. 4. Double-click StartCD. exe 5. Click Install Sample Code. The setup program window appears with the recommended options preselected for you. For best results in using the practice files with this book, accept these preselected settings. 6. When the files have been installed, remove the CD from your CD- ROM drive and replace it in the package inside the back cover of the book.A folder called OOPVBCS has been created on your hard disk, and the practice files have been placed in that folder. Using the Practice Files Each lesson in this book explains when and how to use any practice files for that lesson. The practice files contain the complete source listings for all the applications created in this book, as well as any resources, such as bitmaps and databases, that youââ¬â¢ll need to complete the exercises. For those of you who like to know all the details, hereââ¬â¢s a list of the Visual Basic and Visual C# projects on the practice disk: Project Chapter 1 ReadBooks Chapter 2 ReadMoreBooks Chapter 3 CodeAnalysis CodeAnalysis2 Chapter 4DeckOfCards Chapter 5 TheBank ARoundButton Chapter 6 ABetterBank ABetterLibrary Variations Description This simple program demonstrates the basics of creating, instantiating, and using a class. This program expands on the ReadBooks program and adds constructors. These two applications demonstrate different approaches to using class properties, and the interaction of class properties and the DataGrid control. This application explores class methods by using dynamic creation of Windows Forms controls and drag-and-drop operations. This simple application demonstrates the basics of class inheritance. This small project shows how easy it is to derive rom a Windows Forms control and redefine its drawing. This adaptation of Chapter 5ââ¬â¢s TheBank application uses an abstract class as a base class. This improvement on Chapter 1ââ¬â¢s ReadBooks application uses a strongly typed collection. This application contains code snippets demonstrating variations on inheritance. Chapter 7 TrainGame ThrowSystemException PersonList Project Chapter 8 GamesLibrary Memory Chapter 9 MoveIt Points Chapter 10 PatternMaker Chapter 11 BetterCard SortablePoint Singleton Chapter 12 VectorAlgebra Chapter 13 S erialize DataSetExercise Chapter 14 This application introduces delegates, events, and user-drawn controls in the context of a simple game.This small program throws a system exception and recovers by using exception handling. This application creates and throws a custom application exception. Description The GamesLibrary project creates a component library containing objects used to develop the simple Memory card game This application covers the basics of creating and implementing an interface. The Points project contains objects that implement the IComparable, IFormattable, and IEnumerable interfaces. Moving beyond the basics of inheritance, the PatternMaker program makes extensive use of inheritance and polymorphism. This improvement on the Card class from Chapter 4 uses static methods to liminate the projectââ¬â¢s dependency on file locations. The SortablePoint application from Chapter 10 is made more flexible through static properties. Static fields are used to implement the Singleton design pattern. The mathematical concept of vectors is used to demonstrate the definition and use of operator overloading in Visual C#. The Serialize application demonstrates the use of binary and XML serialization of data. This very simple ADO. NET application reads data from an Access database. PatternMaker Uninstall the practice files This example uses the PatternMaker exercise from Chapter 10 to demonstrate the way to make design changes after the i nitial development of an application.If you are using the Windows XP Professional operating system, follow these steps to remove the practice files from your computer. If you are using a different version of Windows, refer to your Windows Help documentation for removing programs. 1. Click Start, and then click Control Panel. 2. In Control Panel, click Add Or Remove Programs. 3. In the Add Or Remove Programs window, click OOP Visual Basic And C# . NET Code in the Currently Installed Programs list. 4. Click Change/Remove. The Confirm File Deletion dialog appears. 5. Click Yes to delete the practice files. 6. Click Close to close the Add Or Remove Programs window. 7. Close Control Panel.Conventions and Features in this Book This book uses conventions designed to make the information more readable and easier to follow. The book also includes features that contribute to a deeper understanding of the material. Conventions à ¦ Each exercise is a series of tasks. Each task is presented as a series of numbered steps. If a task has only one step, the step is indicated by a round bullet. à ¦ Notes labeled ââ¬Å"tipâ⬠provide more information for completing a step successfully. à ¦ Notes labeled ââ¬Å"importantâ⬠alert you to information you need to check before continuing. The book uses typographic styles to help organize the information presented. The following table describes the styles used. Style Code Italics Used for Code that you type in Method argument or parameter Event Procedure Field Ful ly Qualified Name Keyword Method Property value Example ââ¬Ë Visual Basic Public Class Book End Class // Visual C# public class Book { } aBook showPage_Click m_shelf SomeBook. Text Public, public, If, if GetPage listOfBooks Roman Other Features Boolean values Class name Control type Data type Event Form Namespace Parameter type Property True, true, False, false Book, Library, Train ListBox, TextBox String, string, Integer, int Click Form1 ReadBooks String, string, Integer, int NameShaded sidebars throughout the book provide more in-depth information about the exercise. The sidebars might contain debugging tips, design tips, or topics you might want to explore further. Each chapter ends with a Quick Reference section. The Quick Reference provides a brief review of the syntax and techniques presented in the chapter. Corrections, Comments, and Help Every effort has been made to ensure the accuracy of this book and the contents of the practice files on the companion CD. Microsoft Pre ss provides corrections and additional content for its books through the World Wide Web at http://www. microsoft. com/mspress/support/If you have problems, comments, or ideas regarding this book or the companion CD, please send them to Microsoft Press. Send e-mail to [emailà protected] com Or send postal mail to Microsoft Press Attn: Step by Step Series Editor One Microsoft Way Redmond, WA 98052-6399 Please note that support for the Visual Studio . NET software product itself is not offered through the preceding address. For help using Visual Studio . NET, visit http://support. microsoft. com. Visit the Microsoft Press World Wide Web Site You are also invited to visit the Microsoft Press World Wide Web site at http://www. microsoft. com/mspress/Youââ¬â¢ll find descriptions for the complete line of Microsoft Press books, information about ordering titles, notice of special features and events, additional content for Microsoft Press books, and much more. You can also find out the latest in Visual Studio . NET software developments and news from Microsoft Corporation at http://msdn. microsoft. com/vstudio/nextgen/ Check it out! Chapter 1: Writing Your First Object-Oriented Program Overview ESTIMATED TIME 2 hr. 30 min. In this chapter, youââ¬â¢ll learn how to à ¦ Decide which classes to implement in your program. à ¦ Create a class with fields, properties, and methods. Use a class in an application. à ¦ Use Microsoft Visual Studio . NET tools to create a class definition. Classes are the building blocks of object-oriented programs. Object-oriented program design is driven by the objects in the problem you need to solve. If your goal is to automate class registration, you might create classes for the instructor, student, and class schedule objects. Objects also have properties that describe them and their behavior. These are implemented as properties and methods of a class. Just as an instructor has a name, so does the Instructor class have a Name proper ty.To assign a student to a class, youââ¬â¢d need to find an open section in the schedule. So your ClassSchedule class might implement a FindOpenSection method. The method would likely check the variable, called a field, in the class in which youââ¬â¢ve stored information about sections. In this chapter, youââ¬â¢ll learn how to identify the objects in your problem domain and their properties and behaviors (methods). Using this analysis, youââ¬â¢ll design and implement the classes using property and method programming constructs. Youââ¬â¢ll then declare and initialize the variables of the classes youââ¬â¢ve coded.Finally, youââ¬â¢ll implement the solution to your problem by calling the properties and methods of the class variables. Reading Books: Your First Object-Oriented Program Your task in this chapter is to implement a program that displays large text files in page- size pieces. Typically, your task begins with a specification, perhaps complete, perhaps not. The specification for Chapter 1 follows: You have downloaded on your computer the text of several books. You want to be able to select a book and read one particular page at a time. You also want to be able to set the length of a page. Youââ¬â¢ve already decided which user interface you want to use; itââ¬â¢s shown here:As you look at the user interface, you can see that you need to add some controls to a Windows form: a ListBox, a RichTextBox, two NumericUpDown controls, and some labels. How will you store the texts of the books? How will you fill the list? How will you retrieve the correct page of the book that you want to read? You can use object-oriented programming to answer these questions. Designing the Classe s Before you can implement your classes, you must decide which classes you need. First you look for the objects in the problem. Having found the objects, you then look for properties, which are characteristics or qualities that belong to the object, and methods, w hich are behaviors of the object.You can choose from many ways to design the classes in an application. The approach presented here begins with a textual analysis of the problem. The nouns are selected as candidates for classes, while verbs become candidates for the methods. In the course of the analysis, youââ¬â¢ll eliminate many of the nouns as candidates, and you might discover classes that arenââ¬â¢t among the nouns in the specification. After you determine the objects, properties, and methods that belong to your classes, you can then write the class specification that youââ¬â¢ll use in the implementation. Find the classes . Read the problem statement, and find all the nouns. You have downloaded on your computer the text of several books. You want to be able to select a book and read one particular page at a time. You also want to be able to set the length of a page. 2. Eliminate candidates. Reasons to eliminate a candidate include à ¦ The class based on the noun would have only properties or only methods. à ¦ The class based on the noun wouldnââ¬â¢t be relevant to the problem. à ¦ The class based on the noun wouldnââ¬â¢t represent one object.You can eliminate the irrelevant candidates: computer and time. Length (of a page) is merely an integer value and wouldnââ¬â¢t generate enough behavior to qualify as a class. The same is true of text in this exampleââ¬âthe only thing to be done with it is to display a piece of it, a page. By the same reasoning, page is also not a class. That leaves book and books. Books is just the plural of book , so you are left only with book as a potential class. But you arenââ¬â¢t finished yet. 3. Search for missing candidates. Consider this specification, ââ¬Å"The dealer deals four cards to each player. Thereââ¬â¢s no mention of a deck of cards, although deck is a likely class in that problem. Remember eliminating books? Another class does, in fact, represent the properties and behavior of a grou p of books. You can call this class Library. The library concept is different from the book concept. A book has a title and text and can be read. A library contains many books, which can be checked out and returned. Left with the Book and Library classes, you can now search for properties and methods. Find the methods and properties 1. Read the problem statement, and find all the verbs. You can leave out the helping verbs, such as is, was, and have.As in the case of the nouns, textual analysis of verbs is just the starting point for finding the methods. You have downloaded on your computer the text of several books. You want to be able toselect a book and read one particular page at a time. You also want to be able to set the length of a page. 2. Consider each verb. Is it a method, or does it indicate a method? Is it relevant to the problem? Downloaded and want are clearly irrelevant to the problem. Select is an operation of the Library class. In a real library, this action would co rrespond to finding a book on the shelf and checking it out. So the Library has a CheckOut method.Thereââ¬â¢s also a hidden property here because a book needs a title. Read is an operation of the Book class. This method allows you to read one particular page, so it can be named GetPage. The verb set indicates that a property needs to be changed, and that property is the length of a page, PageLength. 3. The same nouns that you eliminated as classes might in fact be properties of those classes. Text, length (of a page), and page were eliminated as classes. A book does need text, so Text becomes a property of Book. You discovered that PageLength is a property in considering the verb set.Page represents one section of the text and represents the result of the GetPage operation, so it isnââ¬â¢t a property. 4. Look for missing properties and methods. If youââ¬â¢re going to check books out of the library, you need a way to add books to the library and return the checked-out books. A CheckIn method will handle this. Testing the Class Design Reread the problem, and determine whether your classes, with their properties and methods, provide the functionality necessary to solve the problem. You have downloaded on your computer the text of several books. Do you have a way of storing and organizing several books?Yes, you can create one Book for each book and one Library to store them all. You want to be able to select a book and read one particular page at a time. Can you select one book and read one page? Yes, books can be selected by their titles, and the GetPage method retrieves one page. You also want to be able to set the length of a page. Can you set the length of a page? Yes, the Book class has a PageLength property. The results are shown in the following table. The methods are shown as they might be declared in Visual Basic. Class Book Properties Integer PageLengt h Methods GetPage (pageNumber As Integer) As String Class Library Creating the Book Class Prop ertiesString Text String Title Methods CheckIn (aBook As Book) CheckOut(title As String) As Book The following exercise covers the basics of class implementation using the Book class as an example. To implement the Library class, youââ¬â¢ll use some of the development tools provided by the Microsoft Visual Studio . NET integrated development environment (IDE). Create the book class 1. In the IDE, click the File menu, point to New, and then click Project. The New Project dialog box opens. 2. Select Visual Basic Projects or Visual C# Projects in the Project Types tree, click Windows Application in the Templates list. 3.Enter ReadBooks in the Name box, and click OK. 4. Display the Solution Explorer by selecting Solution Explorer on the View menu. Click the ReadBooks project in the Solution Explorer. 12. On the Project menu, click Add Class. The Add New Item dialog box appears, as shown here: 13. Enter either Book. vb or Book. cs in the Name box, depending on the language you are usi ng. Note that the class name begins with a capital letter and is singular. 14. Click Open. The IDE adds a file to your project. The file includes the basic definition of a class, as shown in the following two screen shots.The Visual Basic class contains the minimum for a class declaration. Hereââ¬â¢s the syntax for declaring a class in Visual Basic: Class ClassName End Class In this case, the class is named Book. The IDE adds the Public modifier thatââ¬â¢s shown to indicate that the class can be used throughout the project. The Visual C# class contains the class declaration as well as a constructor. Hereââ¬â¢s the syntax for declaring a class in C#: class ClassName {} A constructor contains code to initialize the fields of a class and perform other class initialization funââ¬Ëctions. In C#, it has the same name as the class. A constructor isnââ¬â¢t required.Iââ¬â¢ll talk more about constructors in Chapter 2, ââ¬Å"Creating Class Instances with Constructors. â⬠Add the Text and PageLength fields A field is a variable declared in a class block. Fields can be any . NET data type, such as Integer or Boolean; . NET class, such as TextBox or ListBox; or any class that you have created. 1. Locate the beginning of the class definition. In Visual Basic, the class definition begins immediately after the line that shows the class name. In Visual C#, the class definition begins after the opening curly brace of the class. 2. Add the following code inside the class to create Text and PageLength fields. 3. ââ¬Ë Visual BasicPublic Text As String = ââ¬Å"â⬠Public PageLength As Integer = 10 // Visual C# public string Text = ââ¬Å"â⬠;p public int PageLength = 10; Tip By convention, the initial letters of names of public members (fields, properties, methods, and events) of a class are capitalized (Textfield) or are intercapitalized (PageLength field). According to the code, you have specified initial values for the fields: the empty string for Text and 10 for PageLength. A basic tenet of object-oriented programming is that an object should maintain a consistent state. That means that the state of the object (the values of its fields) should represent a usable state.If you didnââ¬â¢t initialize the fields, values would default to ââ¬Å"â⬠for the Text field and 0 for the PageLength field. If those were acceptable values for a book, you could leave them uninitialized. But because compilers and their default values change, you can prevent maintenance problems by initializing the fields. Your client code (the code that uses a Book object) is able to read and write to any field declared with the public keyword (Public in Visual Basic and public in Visual C#). Providing direct access to the class data is a violation of the object-oriented principle of information hiding, which stipulates that the client has no knowledge of the underlying data structure of an object.In the next section, youââ¬â¢ll learn how to al low the client code to get and set the Title of the Book without giving away details about the implementation. Add the Title property A property is a programming construct that allows your code to get and set a value. Typically, the code in the property constructor will get and set the value of a private field in the class. In client code, a public field and a property are used in the same wayââ¬âfor example, SomeBook. Text and SomeBook. Title. 1. Add the following code to the Book class after the Text and PageLength declarations. 2. Private m_title As String ââ¬Ë Visual Basic private string m_title; // Visual C#This code creates a private field in the Book class. Client code doesnââ¬â¢t have access to this property. Tip Private fields of a class are declared using the m_ prefix to identify them as member data. Private field names arenââ¬â¢t capitalized. 3. Add the following code to the Book class, after the m_title declaration. 4. ââ¬Ë Visual Basic 5. Public Propert y Title() As String 6. Get 7. Return m_title 8. End Get 9. Set(ByVal value As String) 10. m_title = value 11. End SetEnd Property 12. // Visual C# 13. public string Title { 14. get { 15. return m_title; 16. } 17. set { 18. m_title = value; 19. }} These syntax blocks define class properties.The Title property appears in the IntelliSense drop-down list just like any other property, such as the familiar TextBox. Text or Form. Backcolor. The property block allows you to control access to the property. You can add validation code to the Set block to ensure that only reasonable values are assigned to the underlying m_title field. Note Please notice an important difference between fields and properties. A place is reserved in memory for fields. They contain the actual data of the class. Properties provide access to the data but are not data themselves. In this book, I use the word set to mean changing a property. I use the word get to mean retrieving the value of a property.The Get and Set blocks of a property can be called getters and setters, or accessors . The property block is more flexible than youââ¬â¢ve seen here. Properties can be public or private, read/write, read-only, or write-only. In Visual Basic, the property statements can even take a parameter. By the way, I cover properties in detail inChapter 2, but I need to talk about them at least a little bit in this chapter. A Little Bit About Properties We can use the word properties, in a general object-oriented sense, to mean the descriptive information about an object. We can also use properties to mean the particular syntactic construct provided by Visual Basic and C#.The particular meaning of the word can be determined by context. Use properties to validate class data and hide class implementation. You have to make a strong case for using public fields in a class. The addition of a property to a class to control access to the underlying data requires minimal effort. The benefit of this practice is tha t you can easily add validation or change the implementation if you need to without affecting clients already using your objects. Add the GetPage method à ¦ Add the GetPage method to the class definition after the field declarations. ââ¬Ë Visual BasicPublic Function GetPage(ByVal pageNumber As Integer) As String Dim start As Integer = (pageNumber -1) * PageLength If (start < Text. Length) And (start >= 0) Then If (start + PageLength) < Text. Length Then Return Text. Substring(start, PageLength) Else Return Text. Substring(start, Text. Length ââ¬â start) End If Else Return ââ¬Å"â⬠End IfEnd Function // Visual C# public string GetPage(int pageNumber) { int start = (pageNumber ââ¬â 1) * PageLength; if ((start < Text. Length) && (start >= 0)) { if ((start + PageLength) < Text. Length) { return Text.Substring(start, PageLength); } else { return Text. Substring(start, Text. Length ââ¬â start); } } else { return ââ¬Å"â⬠; }} In Chapter 3, ââ¬Å"Fields and Prop erties,â⬠youââ¬â¢ll see how we can replace the GetPage method with a construct known as an indexer in Visual C# or with a default Item method in Visual Basic. The complete class definitions for our project are shown here: ââ¬Ë Visual Basic Public Class Book Public Text As String = ââ¬Å"â⬠Public PageLength As Integer = 10 Private m_title As String Public Property Title() As String Get Return m_title End Get Set(ByVal Value As String) m_title = Value End Set End PropertyPublic Function GetPage(ByVal pageNumber As Integer) As String Dim start As Integer = (pageNumber ââ¬â 1) * PageLength If (start < Text. Length) And (start >= 0) Then If (start + PageLength) < Text. Length Then Return Text. Substring(start, PageLength) Else Return Text. Substring(start, Text. Length ââ¬â start) End If Else Return ââ¬Å"â⬠End If End FunctionEnd Class // Visual C#using System;namespace ReadBooks{ /// /// Summary description for Book. /// public class Book { public strin g Text = ââ¬Å"â⬠; public int PageLength = 10; private string m_title; public Book() { // // TODO: Add constructor logic here // } public string Title { get { return m_title; } set { m_title = value; } } ublic string GetPage(int pageNumber) { int start = (pageNumber ââ¬â 1) * PageLength; if ((start < Text. Length) && (start >= 0)) { if ((start + PageLength) < Text. Length) { return Text. Substring(start, PageLength); } else { return Text. Substring(start, Text. Length ââ¬â start); } } else { return ââ¬Å"â⬠; } } }} Fields, properties, methods, and constructors can appear in any order in a class definition. Good organization benefits future readers of your code.Hereââ¬â¢s a common organization and, in fact, the one I used in this book: à ¦ Field declarations à ¦ Constructors à ¦ Properties à ¦ Methods Using the Book Class in an Application Youââ¬â¢ve just finished implementing the Book class. The class definition is just a template for an object. To put data in the fields and properties, you have to create an instance of the class in memory; this action is known as instantiation. When you create an instance, a section of memory is set aside to hold the fields of the object. If you create another instance of the class, another section of memory is set aside for its fields. You arenââ¬â¢t going to implement the full solution yet.First you need to write some code to test your class. Youââ¬â¢ll create two instances of the Book class in the ReadBooks project, and youââ¬â¢ll display the fourth page of each book. (These will be very short books. ) Youââ¬â¢ll create a cookbook and a book of fairy tales, so youââ¬â¢ll need to create two separate instances of the Book class. Instead of creating a fancy interface, youââ¬â¢ll write just enough code to see whether your class is working as you expected. Test Drivers A short program to test a class is called a driver. Itââ¬â¢s a good idea to exercise your class a bit with a driver before adding the class to a larger program.Use the driver to test your class without the interference of other code in the program. Create an instance of Book 1. In the Solution Explorer, double-click Form1 to open it in the Windows form designer. If Form1 is opened in the code editor, select View, Designer. 2. Drag a button from the Toolbox onto Form1. If the Toolbox isnââ¬â¢t visible, select View, Toolbox. 3. Right -click the button, and click Properties on the shortcut menu. In the Properties window, set the Name property of the button to showPage and set the Text property to Show Page. The button on the Windows form is created from the Button class.Name and Text are properties of the Button class. So we can talk about getting and setting these properties. Form1 is a class as well, and the button you just created is a field of the Form1 class. 4. Double-click the button to create the Click event method. 5. Add the following code in boldface to the Click event to create a book of fairy tales. 6. ââ¬Ë Visual Basic 7. Private Sub showPage_Click(ByVal sender As System. Object, _ 8. ByVal e As System. EventArgs) Handles showPage. Click 9. Dim fairyTales As Book 10. fairyTales = New Book() 11. End Sub 12. // Visual C# 13. rivate void showPage_Click(object sender, System. EventArgs e) { 14. Book fairyTales; 15. fairyTales = new Book(); } 16. Add the following code to set the Text, PageLength, and Title properties immediately after the code you entered in step 5: 17. ââ¬Ë Visual Basic 18. fairyTales. Text = ââ¬Å"Once upon a time there was a bear. â⬠19. fairyTales. PageLength = 8fairyTales. Title = ââ¬Å"Fairy Talesâ⬠20. // Visual C# 21. fairyTales. Text = ââ¬Å"Once upon a time there was a bear. ââ¬Å"; 22. fairyTales. PageLength = 8; fairyTales. Title = ââ¬Å"Fairy Talesâ⬠;When the instance of Book is created, its fields contain the values specified in the class definition. The Text field is an empty string, the page length is 10, and the title is blank. Notice that it makes no difference in the client code whether you use a field or a property. 23. Add the following code after the fairyTales code to create another instance of the Book class. (This instance will be a recipe book. ) 24. ââ¬Ë Visual Basic 25. Dim cookies As Book = New Book() 26. cookies. Text = ââ¬Å"Chocolate chip cookies are the most delicious co okies. â⬠27. ookies. PageLength = 8 28. cookies. Title = ââ¬Å"Cookie Recipesâ⬠29. // Visual C# 30. Book cookies = new Book(); 31. cookies. Text = ââ¬Å"Chocolate chip cookies are the most delicious co okies. ââ¬Å"; 32. cookies. PageLength = 8; cookies. Title = ââ¬Å"Cookie Recipesâ⬠; In this case, you used a different syntax for declaring and initializing a variable of the Book class. Visual Basic and Visual C# allow declaration and initialization in the same statement. Declaring and initializing in the same statement has the following advantages: à ¦ Programmers ar e less likely to forget to initialize the variable. When a class defines a constructor with parameters, the fields can be initialized at the same time. (Youââ¬â¢ll create constructors with parameters in Chapter 3. ) Use an instance of the Book class 1. Add the following code after the cookies code to display some of the text of the two books. In later chapters, youââ¬â¢ll learn other ways to return the text of a particular page in the book. 2. ââ¬Ë Visual Basic 3. Dim page As Integer = 3 4. Dim report As String 5. report = ââ¬Å"Page â⬠& page. ToString() & ControlChars. CrLf _ 6. & fairyTales. Title & ââ¬Å": â⬠& fairyTales. GetPage(page) _ 7. ControlChars. CrLf _ 8. & ââ¬Å"Cookies: â⬠& cookies. GetPage(page) 9. MessageBox. Show(report) 10. report = ââ¬Å"Titles: â⬠+ fairyTales. Title & â⬠and â⬠& cookies. Title 11. MessageBox. Show(report) 12. // Visual C# 13. int page = 3; 14. string report; 15. report = ââ¬Å"Page â⬠+ page. ToString() + â⬠â⬠16. + fairyTales. Title + ââ¬Å": â⬠+ fairyTales. GetPage(page) + â⬠â⬠17. + cookies. Title + ââ¬Å": â⬠+ cookies. GetPage(page); 18. MessageBox. Show(report); 19. report = ââ¬Å"Titles: â⬠+ fairyTales. Title + â⬠and â⬠+ cookies. Title; MessageBox. Show(report);This bit of code demonstrates that there are two separate instances of the Book class. We can refer to these instances using the variables fairyTales and cookies . The object-oriented concept that permits each instance to be referred to separately is known as identity. Youââ¬â¢ll see in later chapters that the identity principle doesnââ¬â¢t mean that you have to create a variable for each instance. Creating so many variables is unwieldy if you need hundreds of instances of a class. Identity does mean that you can refer to each instance separately when you need to.Notice that when you created an instance of Book, the fields of fairyTales were change d and the GetPage method was called. Later on we retrieved the value of the Title property. The value of Title was unchanged after the GetPage method was called. The fact that the value was unchanged demonstrates the concept of object state, the idea that the fields retain their values between method calls. Compare the way the GetPage method works with a method that has variable declarations. After the GetPage method ends, the variables go out of scope and their values are lost to the application. 20. Press F5 to run the code. Click the Show Page button.The results are shown here: Click OK, and the book titles are displayed in a message box as shown here: Click OK, and then close the application. Youââ¬â¢ve now created a class, Book, and two instances of it. Your code sent a message to the Book class through the GetPage method to ask for the third page of the text. In the next sections, youââ¬â¢ll implement another class, Library. This time, however, youââ¬â¢ll let some of the IDE tools do some of the syntactic work for you. Using the Class View The IDE provides a Class View that displays a tree view of the class structure of the project, namespaces, and classes.The Class View can share the same window as the Solution Explorer. On the View menu, click Class View to open the Class View. The expanded Class View is shown below for Visual Basic and Visual C#, respectively. The highest-level node represents the project, ReadBooks. The next level of nodes represents the namespaces in the project. A project can contain several namespaces; in this case, thereââ¬â¢s only one. The project namespace contains two classes: the class that we created, Book, and the class for the Windows form, Form1. The Book class contains two public fields, PageLength and Text, epresented by blue blocks, and one private field, m_ti
Subscribe to:
Posts (Atom)