Monday, December 30, 2019

What Is an Enum in Programming Languages

Short for enumeration, an enum variable type can be found in C (ANSI, not the original KR), C and C#. The idea is that instead of using an int to represent a set of values, a type with a restricted set of values is used instead. For example, if we use the colors of the rainbow, which are RedOrangeYellowGreenBlueIndigoViolet If enums didnt exist, you might use a #define (in C) or const in C/C# to specify these values. Eg Too Many Ints to Count! The problem with this is that there are many more ints than colors. If violet has the value 7, and the program assigns a value of 15 to a variable then it is clearly a bug but might not be detected as 15 is a valid value for an int. Enums to the Rescue An enum is a user-defined type consisting of a set of named constants called enumerators. The colors of the rainbow would be mapped like this.: Now internally, the compiler will use an int to hold these and if no values are supplied, red will be 0, orange is 1 etc. What Is the Benefit of an Enum? The point is that rainbowcolors is a type and only other variables of the same type can be assigned to this. C is easier going (ie less strictly typed), but C and C# wont allow assignment unless you force it by using a cast. You arent stuck with these compiler generated values, you can assign your own integer constant to them as shown here. Having blue and indigo with the same value isnt a mistake as enumerators might include synonyms such as scarlet and crimson. Language Differences In C, the variable declaration must be preceded by the word enum as in In C though, it is not needed as rainbowcolors is a distinct type that doesnt need the enum type prefix. In C# the values are accessed by the type name as in What Is the Point of Enums? Using enums increase the level of abstraction and lets the programmer think about what the values mean rather than worry about how they are stored and accessed. This reduces the occurrence of bugs. Here is an example. We have a set of traffic lights with three bulbs- red, yellow and green. In the UK, the sequence of traffic lights changes in these four phases. Red - Traffic Stopped.Both Red and Yellow - Traffic Still stopped, but lights about to change to green.Green - Traffic can move.Yellow - Warning of imminent change to red. Traffic Light Example The lights are controlled by writing to the bottom three bits of a control byte. These are laid out as a bit pattern below in binary where RYG represent the three bits. If R is 1, the red light is on etc. In this case, its easy to see that the four states above correspond to values 4 Red on, 6 Red Yellow both on, 1 Green on and 2 Yellow on. With this function Using a Class Instead of Enums In C and C# wed need to create a class and then overload the operator | to allow OR-ing of types trafficlights. By using enums we prevent problems with other bits being assigned to the bulb control byte. It might be that some of the other bits control self-testing or a Green Lane switch. In that case, a bug that allows these bits to be set in normal use could wreak havoc. To be sure, wed mask the bits in the SetTrafficlights() function so no matter what value is passed in, only the bottom three bits are changed. Conclusion Enums have these benefits: They restrict the values that the enum variable can take.They force you to think about all the possible values that the enum can take.They are a constant rather than a number, increasing readability of the source code

Sunday, December 22, 2019

The Cold War And Its Effects On The Soviet War - 1343 Words

Cold War Midterm Czechoslovakia 1968: Liberalization in the Eastern Bloc Michael Fritz Excelsior College September 17, 2014 The political landscape, economic climate change and religious beliefs all factored into the Cold War due the fact that it lasted nearly 5 decades. The Cold War changed histrionically from each administration change that every nation faced during these long time periods. In the Soviet Union political landscapes went from Stalin to Khruschev then Brezhnev, each impacting the Cold War with significant actions. In the film Czechoslovakia 1968: We Don t Want to Live on Our Knees explains after the suicide of Hitler the fascist regime merely changed from Hitler’s â€Å"Third Reich† to Stalin’s â€Å"Red Army† in 1944-45. The same could be seen in Khruschev who shifted from non-aggressive too aggressive in Hungary October 31st 1958 (Zubok, p.117). Next, Soviet leader Leonid Brezhnev invaded Prague, Czechoslovakia in the spring of 1968, which was dubbed the Brezhnev Doctrine, which states â€Å"Moscow has the right to intervene in any country where a communist g overnment had been threatened.† (History.state.gov, 2014). This oppression could be felt in economical, religious and cultural facets as well and all made subsequent Soviet/American relations increasingly difficult. First, through Stalin’s aggression over the Eastern bloc after the fall of Nazi Germany, Soviet communism was seen as the repressor. Then Khruschev sought to â€Å"de-Stalinize,† once coming toShow MoreRelatedCauses And Effects Of The Cold War1370 Words   |  6 Pagesand Effects of the Cold War Richard Nixon once said of the Cold War that â€Å"the Cold War isn t thawing; it is burning with a deadly heat. Communism isn t sleeping; it is, as always, plotting, scheming, working, fighting.†(www.brainyquote.com). An analysis of the Cold War between 1947-1991 reveals that the Cold War was caused by a difference in political ideals between the USA and the Soviet Union, the aftermath of WWII, and the â€Å"Iron Curtain† in Europe. Further analysis reveals the Cold War contributedRead MoreThe Beginning of the End for the Cold War1228 Words   |  5 PagesDeclining economy and diminishing legitimacy of the Soviet system at domestic level did play a crucial role, however, many realist believe that it was the US especially President Regan’s policies (Regan Doctrine) which concluded the Cold War contest with victory for the west. Kegley believes that by engaging Moscow in an arm race, the Soviet Union was dragged into a competition which exhausted their already fr agile economy leading them initially into retrenchment and ultimately out of the contestRead MoreThe Cold War and Its Effect on The History of America Essay1706 Words   |  7 Pages The Cold War was the ideological conflict between the two superpowers of the world, the democratic United States of America and the communist Soviet Union. For over fifty years the two superpowers fought each other indirectly for power and control of the world. The Cold War started after the end of the Second World War in 1945 when the eyes of both superpowers were no longer looking at Nazi Germany, but instead at each other and the fate of the rest of the world. The Cold War began after the SecondRead MoreGlobal Effects Of The Cold War1311 Words   |  6 PagesAmanda Fuchs The Global Effects of the Cold War and Decolonization The Cold War, also known as what could have been the third world war, conquered the second half of the 20th century. This international crisis, beginning at the end of World War II, is defined as the period of tension between the United States and the Soviet Union. There are numerous reasons as to why many believed the Cold War commenced, one being that the Soviet Union wanted to spread its belief of communism worldwide, which inRead MoreCurrent Events and US Diplomacy on Truman Doctrine957 Words   |  4 Pageswould use against Communism and the Soviet Union for nearly four decades. While President Truman assumed office while inexperienced in global affairs, the doctrine demonstrated his firm stewardship on foreign policy. The doctrine, which was eventually adopted as an international relations policy, was introduced in a speech regarding intentions of the country to help Turkey and Greece with military and economic support for them to avoid falling into the Soviet sphere. The main goal of the doctrineRead MoreTo What Extent Were the Moscow Olympic Games of 1980 Affected by Cold War Tensions?1624 Words   |  7 Pagesinvestigation The purpose of this study is to analyze extensively the role that Cold War tensions played in the 1980 Moscow Olympic Games. The analysis seeks to understand the effect that politics, have on the organization, implementation and eventually success of sporting events such as the Olympics. In order to do so, the analysis will address the events leading up to, during and after the Moscow Olympic Games of 1980. The Soviet invasion of Afghanistan in 1979 will be addressed to help place the gamesRead MoreBone, Ambria . English 11 B. April 17, 2017. The United1272 Words   |  6 PagesBone, Ambria English 11 B April 17, 2017 The United States and the Soviet Union were fighting against each other; the Cold War was separated into three groups (Jerylin Watson). The nation’s economy is a very difficult balancing act. Cold War confrontations nearly always conducted through surrogates or economic pressure (David Painter). This is what happened when the tensions of the Cold War affected the United States and the world (Robert H. Dugger). The United States became the global consumerRead MoreDefinition Of The Cold War1555 Words   |  7 PagesDefinition of Cold War In my opinion, the definition of the Cold War: was a series of conflicts concerning political, mili-tary, and economics activities between two major political philosophies, represented by the United States along with Western Europe (democracy led) and by the Union of Soviet Socialist Republic, along with Eastern Europe (communist led). Moreover, open hostilities between the US and the USSR never occurred except though each countries client states. Origins of the Cold War The coldRead MoreEffects Of The Cold War On The World1572 Words   |  7 PagesNguyen The Cold War was a time of conflict that occurred somewhere around 1945 and 1990 although some International scholars held the thought that the Cold War began in 1917 Russian disclosure in any case, it was between the USA and its allies mostly the Western nations and the Eastern coalition led by the USSR however, the two forces did not battle or utilized weapons against one another, it was battled through Nuclear Arms race, intermediary wars, ideological impact and propaganda war and in thisRead MoreRichard Byrd s The Cold War1340 Words   |  6 PagesThe Cold War, spanning almost half a century, was a conflict that accelerated the production of nuclear weapons and forced the United States and the other belligerent, the Soviet Union, to make scientific advances at a rate unseen in any other time in human history. The Cold War Comes to Main Street: America in 1950, written by Lisle A. Rose, thoroughly examines the year 1950 in the United States and the effect that the Cold War had on the American populous. Rose examines communism and the military

Friday, December 13, 2019

Title the Affects of Temperature on Enzymes Activity Free Essays

Title : the affects of temperature on enzymes activity 1. The Problem: measuring and recording the digestion of carbohydrates by enzyme amylase 2. Independent variable: water bath temperature 3. We will write a custom essay sample on Title : the Affects of Temperature on Enzymes Activity or any similar topic only for you Order Now Dependent variable: the time taken for the carbohydrates to get digested by amylases 4. Controls: the amounts of the carbohydrates and the enzymes in the reaction 5. Quantitative measurement: Time | Temperature | Enzymes concentration | Substrate concentration | Starches Indicators | Catalysts | In minutes | Cloven /Celeste | Per millimetre cube | Per millimetre cube | Per drop | No catalyst | 1. Materials: 6 water bathes. test tubes, test tube rack , amylase enzymes , carbohydrate form ( flower or ,potato), thermometers , indicator ,stop clock ,protection (lab coat, goggles ) 2. Procedure: * prepare 6 test tubes with 10 cm of carbohydrate milk and misuse 5 cm of amylase enzymes in a cringe and add to test tube also indicator should be add and there is no catalyst in this experiments * Place the test tubes on the water baths Water baths should be with fixed temperatures from 10 ,20,30,40,50,60,70 * Start the stop clock as soon as the test tube in the water bath * Keep an eye on the test tube till colour change is observed and the take the test tube out and tack time measurements * Also every temperature measurements should be done individually that the other tests to eliminate error (no one can be in 6 places at the same time ) * Make a table and record the time taken to the enzymes to work and digest the substrate at each temperature individually * Draw a graph Make your conclusion based on the results Hypothesis:. the affect of temperatures on rate of typical enzyme –controlled reaction up to about 40c the rate increases smoothly, also a 10 degree increase of the temperature accompanied by approximate doubling in of the rate of the reaction this is the normal temperature rule of chemical reactions in general, above this temperature the rate starts to fall off then decline rapidly . above 60 degree the rate ceases or stop completely. . Explanation: increase of reaction why? Increases in the temperature of a system results from increases in the kinetic energy of the system. This has several effects on the rates of reactions, 1-the increase in temperature will increase the activation energy of a molecules there for it has more potential to react and change status Also the temperature will make the molecules move faster and as a result more collision will be possible per/minute . Enzyme’s activity stops why? Altogeth er and that is because of the heat changes the shape of the enzyme molecules preventing them from working ,this is called (denaturation ) in fact enzymes will denature and any temperature that is why they cannot be used over and over again ,however the higher the temperature the less time it takes for the denaturation to occurs . 5. Risk assessment Hazard | Risk | How to avoid | What happens in case of accident | Risk probability to occurs | Heat from hot water bath| Burning | Handel with care | Seek medical help| Big risk| Enzymes | Biological hazards (irritant | Handel with correct equipment | Wash under water tape | Medium | Glass equipment | Injury or a glass cute| Try to handel with care | Seek medical help | Big | Thermometer | In case it breaks contain mercury | Handle with care Don’t move it from the water bath unless by the lab specialist | Seek eargent medical help in case of contact with mercury | Big | Electrical wire from water baths | Electrocuted or starting a fire | But it out of the way not in contact with water | Seek medical help | Small | Source | Reference | Was it useful | Used for | Advanced biology | Michael Kent, 2004. Advanced Biology. Edition. Oxford University Press| yes| Background information | Biology – Principles and Processes| M B V Roberts, 1993. Biology: Principles and Processes Pb. Edition. Thomas Nelson. | Yes | Methods | Web | Effect of temperature on enzyme activity. 2012. Effect of temperature on enzyme activity. [ONLINE] Available at: http://academic. brooklyn. cuny. edu/biology/bio4fv/page/enz_act. htm. [Accessed 13 November 2012]. | Yes | | | | | | How to cite Title : the Affects of Temperature on Enzymes Activity, Papers

Thursday, December 5, 2019

Legal Prostitution Vs. Illegal Prostitution Essay Example For Students

Legal Prostitution Vs. Illegal Prostitution Essay Johnny JohnsonLogicLegal Prostitution vs. Illegal ProstitutionJohnny JohnsonIt is rather odd to think of how the oldest profession is being found as somethingof a harmful nature, which must be illegal. But legal prostitution is seen by a rather largenumber of individuals to have a negative effect on todays society. These are the peoplewho are forcing women into illegal prostitution, which is far more destructive, due tomany factors. In the following paragraphs, I am going to compare and contrastlegal and illegal prostitution, in hope of sharing the possible benefits of legal prostitution. It is important I first discuss the negative effects of illegal prostitution to help the viewerhave a better perspective of how legal prostitution can actually have a positive impact onsociety. Illegal prostitution is a common occurrence in most big cities. The major problemwith non-legal prostitution is where it usually occurs. Prostitution is often found in theslums of big cities, where many of the young women feel forced into the professionbecause of hard economic conditions. A large percentage of the women are sadly hookedon drugs and end up trading sex to get high. If the poverty and the drug life are not badenough, the women also get to look forward to their pimp, who will abuse them if theydont return with a suffice amount of money. The knowledge of sexually transmitteddiseases is of extreme importance when it comes to such a topic. The sexual activitiestaking place in these areas are not regulated and although a good number of the womencarry condoms, they are by no means protected. Many of the ladies will except extramoney to allow the customers to have sex condom free. Rape is a harsh and brutal act,which is a common occurrence in street prostitution, where the wom en have no protectionfrom either the man or the diseases he might be carrying. The women are also a danger tothe men by carrying diseases they have possibly picked up from prior customers. It is important I first discuss the negative effects of illegal prostitution to help the viewer have a better perspective of how legal prostitution can actually have a positive impact on society. Illegal prostitution is a common occurrence in most big cities. The major problem with non-legal prostitution is where it usually occurs. Prostitution is often found in the slums of big cities, where many of the young women feel forced into the profession because of hard economic conditions. A large percentage of the women are sadly hooked on drugs and end up trading sex to get high. If the poverty and the drug life are not bad enough, the women also get to look forward to their pimp, who will abuse them if they dont return with a suffice amount of money. The knowledge of sexually transmitted diseases is of extreme importance when it comes to such a topic. The sexual activities taking place in these areas are not regulated and although a good number of the women carry condoms, they are by no means protected. Many of the ladies will except extra money to allow the customers to have sex condom free. Rape is a harsh and brutal act, which is a common occurrence in street prostitution, where the women have no protection from either the man or the diseases he might be carrying. The women are also a danger to the men by carrying diseases they have possibly picked up from prior customers. Prostitutes get arrested quite often, but are let out to be an illegal prostitute for another day. Illegal prostitution is a major problem needing some sort of remedy. It is time to discuss the reasoning behind why legal prostitution is the needed remedy to this particular problem. Legal prostitution is being practiced in many other countries as well as a small area of our own country. In Nevada there are places set up to provide legally solicited sex, which are known as brothels. Brothels are the major difference between illegal and legal prostitution. Brothels handle prostitution in a business-like manner. The women are the merchandise brothels have to offer. Like any other type of business the merchandise is protected. Bodyguards are hired to watch over the women and react if any problems take place. The women also have better protection through strict enforcement of condom use and the ladies are tested for venereal diseases as well. As far as drug problems go, brothels do not provide the same kind environment where sex can be traded for drugs. Not to say all the women in legal prostitution are drug free, but it is far less of a problem. The ladies happen to have better living conditions than a streetwalker does. They make actual lives aside from the profession they take part in. These women, for the most part, live in nice homes and lead healthy lives. They have been given a chance to make enough money to pull themselves out of their poverty stricken neighborhoods. It must be kept in mind, most of the women do not want to be prostitutes, but feel they are forced into it because of their poor economic conditions. It is important to touch on the whole idea of how this affects todays society. The Psycholdy Begind Clockwork Orange Essay Numerous amounts of people believe legal prostitution is wrong, but they might not understand how their belief is forcing women into illegal prostitution. In San Francisco, illegal prostitution is a major problem for the authorities. Many of the officers believe there should be a legal form of prostitution. Their reasoning behind this belief is that the women will be in a safer environment where there is far less drug problems and the police will not have the constant burden of arresting females who are going to continue to do what they are doing, regardless of police actions. Sexually transmitted diseases are a major concern for the women as well .