Monday, September 30, 2019
C# Step by Step Codes
SREEKANTH C# STEP BY STEP Microsoft Visual Studio C#. NET Step By Step 1 SREEKANTH C# STEP BY STEP Introduction Microsoft Visual C# is a powerful but simple language aimed primarily at developers creating applications by using the Microsoft . NET Framework. It inherits many of the best features of C++ and Microsoft Visual Basic, but few of the inconsistencies and anachronisms, resulting in a cleaner and more logical language. The advent of C# 2. 0 has seen several important new features added to the language, including Generics, Iterators, and anonymous methods.The development environment provided by Microsoft Visual Studio 2005 makes these powerful features easy to use, and the many new wizards and enhancements included in Visual Studio 2005 can greatly improve your productivity as a developer. The aim of this book is to teach you the fundamentals of programming with C# by using Visual Studio 2005 and the . NET Framework. You will learn the features of the C# language, and then use them to build applications running on the Microsoft Windows operating system.By the time you complete this book, you will have a thorough understanding of C# and will have used it to build Windows Forms applications, access Microsoft SQL Server databases, develop ASP. NET Web applications, and build and consume a Web service. Part I Introducing Microsoft Visual C# and Microsoft Visual Studio 2005 Chapter 1 Welcome to C# After completing this chapter, you will be able to: â⬠¢ â⬠¢ â⬠¢ â⬠¢ Use the Visual Studio 2005 programming environment. Create a C# console application. Use namespaces. Create a C# Windows Forms application. Microsoft Visual C# is Microsoft's powerful, component-oriented language.C# plays an important role in the architecture of the Microsoft . NET Framework, and some people have drawn comparisons to the role that C played in the development of UNIX. If you already know a language such as C, C++, or Java, you'll find the syntax of C# reassuringly fami liar because it uses the same curly brackets to delimit blocks of code. However, if you are used to programming in other languages, you should soon be able to pick up the syntax and feel of C#; you just need to learn to put the curly brackets and semi-colons in the right place. Hopefully this is just the book to help you!In Part I, you'll learn the fundamentals of C#. You'll discover how to declare variables and how to use operators such as plus (+) and minus (-) to create values. You'll see how to write methods and pass arguments to methods. You'll also learn how to use selection statements such as if and iteration statements such as while. Finally, you'll understand how C# uses exceptions to handle errors in a graceful, easy-to-use manner. These topics form the core of C#, and from this solid foundation, you'll progress to more advanced features in Part II through Part VI. 2 SREEKANTH C# STEP BY STEPBeginning Programming with the Visual Studio 2005 Environment Visual Studio 2005 i s a tool-rich programming environment containing all the functionality you'll need to create large or small C# projects. You can even create projects that seamlessly combine modules from different languages. In the first exercise, you'll start the Visual Studio 2005 programming environment and learn how to create a console application. Create a console application in Visual Studio 2005 1. In Microsoft Windows, click the Start button, point to All Programs, and then point to Microsoft Visual Studio 2005. 2.Click the Microsoft Visual Studio 2005 icon. Visual Studio 2005 starts. NOTE If this is the first time that you have run Visual Studio 2005, you might see a dialog box prompting you to choose your default development environment settings. Visual Studio 2005 can tailor itself according your preferred development language. The various dialog boxes and tools in the integrated development environment (IDE) will have their default selections set for the language you 3 SREEKANTH C# STEP BY STEP choose. Select Visual C# Development Settings from the list, and then click the Start Visual Studio button.After a short delay, the Visual Studio 2005 IDE appears. 3. On the File menu, point to New, and then click Project. The New Project dialog box opens. This dialog box allows you to create a new project using various templates, such as Windows Application, Class Library, and Console Application, that specify the type of application you want to create. NOTE The actual templates available depend on the version of Visual Studio 2005 you are using. It is also possible to define new project templates, but that is beyond the scope of this book. 4.In the Templates pane, click the Console Application icon. 5. In the Location field, type C:Documents and SettingsYourNameMy DocumentsMicrosoft PressVisual CSharp Step by StepChapter 1. Replace the text YourName in this path with your Windows user name. To save a bit of space throughout the rest of this book, we will simply refer to th e path ââ¬Å"C:Documents and SettingsYourNameMy Documentsâ⬠as your ââ¬Å"My Documentsâ⬠folder. 4 SREEKANTH C# STEP BY STEP NOTE If the folder you specify does not exist, Visual Studio 2005 creates it for you. 6. In the Name field, type TextHello. . Ensure that the Create Directory for Solution check box is checked and then click OK. The new project opens. The menu bar at the top of the screen provides access to the features you'll use in the programming environment. You can use the keyboard or the mouse to access the menus and commands exactly as you can in all Windows-based programs. The toolbar is located beneath the menu bar and provides button shortcuts to run the most frequently used commands. The Code and Text Editor window occupying the main part of the IDE displays the contents of source files.In a multi-file project, each source file has its own tab labeled with the name of the source file. You can click the tab once to bring the named source file to the foreg round in the Code and Text Editor window. The Solution Explorer displays the names of the files associated with the project, among other items. You can also double-click a file name in the Solution Explorer to bring that source file to the foreground in the Code and Text Editor window. 5 SREEKANTH C# STEP BY STEP Before writing the code, examine the files listed in the Solution Explorer, which Visual Studio 2005 has created as part of your project: Solution ââ¬ËTextHello' This is the top-level solution file, of which there is one per application. If you use Windows Explorer to look at your My DocumentsVisual CSharp Step by StepChapter 1TextHello folder, you'll see that the actual name of this file is TextHello. sln. Each solution file contains references to one or more project files. â⬠¢ TextHello This is the C# project file. Each project file references one or more files containing the source code and other items for the project. All the source code in a single project must be written in the same programming language.In Windows Explorer, this file is actually called TextHello. csproj, and it is stored in your My DocumentsVisual CSharp Step by StepChapter 1TextHelloTextHello folder. â⬠¢ Properties This is a folder in the TextHello project. If you expand it, you will see that it contains a file called AssemblyInfo. cs. AssemblyInfo. cs is a special file that you can use to add attributes to a program, such as the name of the author, the date the program was written, and so on. There are additional attributes that you can use to modify the way in which the program will run.These attributes are outside the scope of this book. â⬠¢ References This is a folder that contains references to compiled code that your application can use. When code is compiled, it is converted into an assembly and given a unique name. Developers use assemblies to package up useful bits of code that they have written for distribution to other developers that might want to use them in their applications. Many of the features that you will be using when writing applications using this book will make use of assemblies provided by Microsoft with Visual Studio 2005. â⬠¢ Program. csThis is a C# source file, and is the one displayed in the Code and Text Editor window when the project is first created. You will write your code in this file. It contains some code that Visual Studio 2005 provides automatically, which you will examine shortly. Writing Your First Program The Program. cs file defines a class called Program that contains a method called Main. All methods must be defined inside a class. The Main method is specialââ¬âit designates the program's entry point. It must be a static method. (Methods are discussed in 6 SREEKANTH C# STEP BY STEP Chapter 3, ââ¬Å"Writing Methods and Applying Scope. Static methods are discussed in Chapter 7, ââ¬Å"Creating and Managing Classes and Objects. â⬠The Main method is discussed in Chapter 11, ââ¬Å"Unde rstanding Parameter Arrays. â⬠) IMPORTANT C# is a case-sensitive language. You must spell Main with a capital M. In the following exercises, you'll write the code to display the message Hello World in the console; you'll build and run your Hello World console application; you'll learn how namespaces are used to partition code elements. Write the code using IntelliSense technology 1. In the Code and Text Editor window displaying the Program. s file, place the cursor in the Main method after the opening brace, and type Console. As you type the letter C at the start of the word Console an IntelliSense list appears. This list contains all of the valid C# keywords and data types that are valid in this context. You can either continue typing, or scroll through the list and double-click the Console item with the mouse. Alternatively, after you have typed Con, the Intellisense list will automatically home in on the Console item and you can press the Tab, Enter, or Spacebar key to selec t it. Main should look like this: static void Main(string[] args) Console } NOTE Console is a built-in class that contains the methods for displaying messages on the screen and getting input from the keyboard. 2. Type a period immediately after Console. Another Intellisense list appears displaying the methods, properties, and fields of the Console class. 3. Scroll down through the list until WriteLine is selected, and then press Enter. Alternatively, you can continue typing until WriteLine is selected and then press Enter. The IntelliSense list closes, and the WriteLine method is added to the source file. Main should now look like this: static void Main(string[] args) Console. WriteLine } 4. Type an open parenthesis. Another IntelliSense tip appears. This tip displays the parameters of the WriteLine method. In fact, WriteLine is an overloaded method, meaning that Console contains more than one method named Write Line. Each version of the WriteLine method can be used to output differ ent 7 SREEKANTH C# STEP BY STEP types of data. (Overloaded methods are discussed in Chapter 3. ) Main should now look like this: static void Main(string[] args) { Console. WriteLine( } You can click the tip's up and down arrows to scroll through the overloaded versions of WriteLine. . Type a close parenthesis, followed by a semicolon. Main should now look like this: static void Main(string[] args) { Console. WriteLine(); } 6. Type the string ââ¬Å"Hello Worldâ⬠between the left and right parentheses. Main should now look like this: static void Main(string[] args) { Console. WriteLine(ââ¬Å"Hello Worldâ⬠); } TIP Get into the habit of typing matched character pairs, such as ( and ) and { and }, before filling in their contents. It's easy to forget the closing character if you wait until after you've entered the contents. 8 SREEKANTH C# STEP BY STEP NOTEYou will frequently see lines of code containing two forward slashes followed by ordinary text. These are comments. They a re ignored by the compiler, but are very useful for developers because they help document what a program is actually doing. For example: Console. ReadLine(); // Wait for the user to press the Enter key All text from the two slashes to the end of the line will be skipped by the compiler. You can also add multi-line comments starting with /*. The compiler will skip everything until it finds a */ sequence, which could be many lines lower down.You are actively encouraged to document your code with as many comments as necessary. Build and run the console application 1. On the Build menu, click Build Solution. This action causes the C# code to be compiled, resulting in a program that you can run. The Output windows appears below the Code and Text Editor window. a. TIP If the Output window does not appear, click the View menu, and then click Output to display it. b. In the Output window, messages similar to the following show how the program is being compiled and display the details of any errors that have 9 SREEKANTH C# STEP BY STEP occurred.In this case there should be no errors or warnings, and the program should build successfully: c. ââ¬âââ¬â Build started: Project: TextHello, Configuration: Debug Any CPU ââ¬âd. Csc. exe /config /nowarn:â⬠1701;1702â⬠³ /errorreport: prompt /warn:4 â⬠¦ e. Compile complete ââ¬â- 0 errors, 0 warnings f. TextHello -> C:Documents and SettingsJohnMy DocumentsMicrosoft Pressâ⬠¦ g. ============ Build: 1 succeeded or up-to-date, 0 failed, 0 skipped ======== h. NOTE An asterisk after the file name in the tab above the Code and Text Editor window indicates that the file has been changed since it was last saved.There is no need to manually save the file before building because the Build Solution command automatically saves the file. 2. On the Debug menu, click Start Without Debugging. A Command window opens and the program runs. The message Hello World appears, and then the program waits for the user to press any key, as shown in the following graphic: 3. Ensure that the Command window displaying the program has the focus, and then press Enter. The Command window closes and you return to the Visual Studio 2005 programming environment. NOTE If you run the program using Start Debugging on the Debug menu, the pplication runs but the Command window closes immediately without waiting for you to press a key. 4. In the Solution Explorer, click the TextHello project (not the solution), and then click Show All Files button. Entries named bin and obj appear above the C# source filenames. These entries correspond directly to folders named bin and obj in the project folder (My DocumentsVisual CSharp Step by StepChapter 1TextHelloTextHello). These folders are created when you build your application, and they contain the executable version of the program and some other files. 10 SREEKANTHC# STEP BY STEP 5. 5. In the Solution Explorer, click the + to the left of the bin entry. Another folder named Deb ug appears. 6. 6. In the Solution Explorer, click the + to the left of the Debug entry. Three entries named TextHello. exe, TextHello. pdb, and TextHello. vshost. exe appear. The file TextHello. exe is the compiled program, and it is this file that runs when you click Start Without Debugging in the Debug menu. The other two files contain information that is used by Visual Studio 2005 if you run your program in Debug mode (when you click Start Debugging in the Debug menu).Command Line Compilation You can also compile your source files into an executable file manually by using the csc command-line C# compiler. You must first complete the following steps to set up your environment: 1. On the Windows Start menu, point to All Programs, point to Microsoft Visual Studio 2005, point to Visual Studio Tools, and click Visual Studio 2005 Command Prompt. A Command window opens, and the envionment variables PATH, LIB, and INCLUDE are configured to include the locations of the various . NET Frame work libraries and utilities. TIP You can also run the vcvarsall. at script, located in the C:Program FilesMicrosoft Visual Studio 8VC folder, if you want to configure the environment variables while running in an ordinary Command Prompt window. 2. In the Visual Studio 2005 Command Prompt window, type the following command to go to the My DocumentsMicrosoft PressVisual CSharp Step by StepChapter 1TextHelloTextHello project folder: 3. cd Documents and SettingsYourNameMy DocumentsMicrosoft PressVisual CSharp Step by StepChapter 1TextHelloTextHello 4. Type the following command: csc /out:TextHello. exe Program. cs 11 SREEKANTH C# STEP BY STEPThis command creates the executable file TextHello. exe from the C# source file. If you don't use the /out command-line option, the executable file takes its name from the source file and is called Program. exe. 5. Run the program by typing the following command: TextHello The program should run exactly as before, except that you will not see the à ¢â¬Å"Press any key to continueâ⬠prompt. Using Namespaces The example you have seen so far is a very small program. However, small programs can soon grow into bigger programs. As a program grows, it creates two problems. First, more code is harder to understand and maintain than less code.Second, more code usually means more names; more named data, more named methods, and more named classes. As the number of names increases so does the likelihood of the project build failing because two or more names clash (especially when the program uses third-party libraries). In the past, programmers tried to solve the name-clashing problem by prefixing names with some sort of qualifier (or set of qualifiers). This solution is not a good one because it's not scalable; names become longer and you spend less time writing software and more time typing (there is a difference) and reading and re-reading incomprehensibly long names.Namespaces help solve this problem by creating a named container for other identifiers, such as classes. Two classes with the same name will not be confused with each other if they live in different namespaces. You can create a class named Greeting inside the namespace named TextHello, like this: namespace TextHello { class Greeting { â⬠¦ } } You can then refer to the Greeting class as TextHello. Greeting in your own programs. If someone else also creates a Greeting class in a different namespace and installs it on your computer, your programs will still work as expected because they are using the TextHello.Greeting class. If you want to refer the new Greeting class, you must specify that you want the class from the new namespace. It is good practice to define all your classes in namespaces, and the Visual Studio 2005 environment follows this recommendation by using the name of your project as the toplevel namespace. The . NET Framework Software Developer Kit (SDK) also adheres to this recommendation; every class in the . NET Framework lives inside a namespace. For 12 SREEKANTH C# STEP BY STEP example, the Console class lives inside the System namespace. This means that its fully qualified name is actually System.Console. Of course, if you had to write the fully qualified name of a class every time, it would be no better that just naming the class SystemConsole. Fortunately, you can solve this problem with a using directive. If you return to the TextHello program in Visual Studio 2005 and look at the file Program. cs in the Code and Text Editor window, you will notice the following statements: using System; using System. Collections. Generic; using System. Text; The using statement brings a namespace into scope, and you no longer have to explictly qualify objects with the namespace they belong to in the code that follows.The three namespaces shown contain classes that are used so often that Visual Studio 2005 automatically adds these using statements every time you create a new project. You can add further using direct ives to the top of a source file. The following exercise demonstrates the concept of namespaces further. Try longhand names 1. In the Code And Text Editor window, comment out the using directive at the top of Program. cs: //using System; 2. On the Build menu, click Build Solution. The build fails, and the Output pane displays the following error message twice (once for each use of the Console class):The name ââ¬ËConsole' does not exist in the current context. 3. In the Output pane, double-click the error message. The identifier that caused the error is selected in the Program. cs source file. TIP The first error can affect the reliability of subsequent diagnostic messages. If your build has more than one diagnostic message, correct only the first one, ignore all the others, and then rebuild. This strategy works best if you keep your source files small and work iteratively, building frequently. 4. In the Code and Text Editor window, edit the Main method to use the fully qualified name System. Console.Main should look like this: static void Main(string[] args) { System. Console. WriteLine(ââ¬Å"Hello Worldâ⬠); 13 SREEKANTH C# STEP BY STEP } NOTE When you type System. , notice how the names of all the items in the System namespace are displayed by IntelliSense. 5. On the Build menu, click Build Solution. The build succeeds this time. If it doesn't, make sure Main is exactly as it appears in the preceding code, and then try building again. 6. Run the application to make sure it still works by clicking Start Without Debugging on the Debug menu. In the Solution Explorer, click the + to the left of the References entry.This displays the assemblies referenced by the Solution Explorer. An assembly is a library containing code written by other developers (such as the . NET Framework). In some cases, the classes in a namespace are stored in an assembly that has the same name (such as System), although this does not have to be the caseââ¬âsome assemblies hold more than one namespace. Whenever you use a namespace, you also need to make sure that you have referenced the assembly that contains the classes for that namespace; otherwise your program will not build (or run). Creating a Windows Forms ApplicationSo far you have used Visual Studio 2005 to create and run a basic Console application. The Visual Studio 2005 programming environment also contains everything you'll need to create graphical Windows applications. You can design the form-based user interface of a Windows application interactively by using the Visual Designer. Visual Studio 2005 then generates the program statements to implement the user interface you've designed. From this explanation, it follows that Visual Studio 2005 allows you to maintain two views of the application: the Design View and the Code View.The Code and Text Editor window (showing the program statements) doubles as the Design View window (allowing you to lay out your user interface), and you can switch bet ween the two views whenever you want. In the following set of exercises, you'll learn how to create a Windows program in Visual Studio 2005. This program will display a simple form containing a text box where you can enter your name and a button that, when clicked, displays a personalized greeting in a message box.You will use the Visual Designer to create your user interface by placing controls on a form; inspect the code generated by Visual Studio 2005; use the Visual Designer to change the control properties; use the Visual Designer to resize the form; write the code to respond to a button click; and run your first Windows program. Create a Windows project in Visual Studio 2005 1. On the File menu, point to New, and then click Project. The New Project dialog box opens. 2. In the Project Types pane, click Visual C#. 14 SREEKANTH C# STEP BY STEP 3. In the Templates pane, click the Windows Application icon. . Ensure that the Location field refers to your My DocumentsVisual CSharp St ep by StepChapter 1 folder. 5. In the Name field, type WinFormHello. 6. In the Solutions field, ensure that Create new Solution is selected. This action creates a new solution for holding the Windows application. The alternative, Add to Solution, will add the project to the TextHello solution. 7. Click OK. Visual Studio 2005 closes your current application (prompting you to save it first of necessary) and creates and displays an empty Windows form in the Design View window.In the following exercise, you'll use the Visual Designer to add three controls to the Windows form and examine some of the C# code automatically generated by Visual Studio 2005 to implement these controls. Create the user interface 1. Click the Toolbox tab that appears to the left of the form in the Design View. The Toolbox appears, partially obscuring the form and displaying the various components and controls that you can place on a Windows form. 2. In the Toolbox, click the + sign by Common Controls to display a list of controls that are used by most Windows Forms applications. 15 SREEKANTHC# STEP BY STEP 3. Click Label, and then click the visible part of the form. A Label control is added to the form, and the Toolbox disappears from view. TIP If you want the Toolbox to remain visible but not hide any part of the form, click the Auto Hide button to the right in Toolbox title bar (it looks like a pin). The Toolbox appears permanently on the left side of the Visual Studio 2005 window, and the Design View shrinks to accommodate it. (You might lose a lot of space if you have a low-resolution screen. ) Clicking the Auto Hide button once more causes the Toolbox to disappear again. 4.The Label control on the form is probably not exactly where you want it. You can click and drag the controls you have added to a form to reposition them. Using this technique, move the Label control so that it is positioned towards the upper-left corner of the form. (The exact placement is not critical for this app lication. ) 5. On the View menu, click Properties Window. The Properties window appears on the right side of the screen. The Properties window allows you to set the properties for items in a project. It is context sensitive, in that it displays the properties for the currently selected item.If you click anywhere on the form displayed in the Design View, you will see that the Properties windows displays the properties for the form itself. If you click the Label control, the window displays the properties for the label instead. 6. Click the Label control on the form. In the Properties window, locate the Text property, change it from label1 to Enter your name, and then press Enter. On the form, the label's text changes to Enter Your Name. TIP By default, the properties are displayed in categories. If you prefer to display the properties in alphabetical order, click the Alphabetical button that appears above the properties list. . Display the Toolbox again. Click TextBox, and then click the form. A TextBox control is added to the form. Move the TextBox control so that it is directly underneath the Label control. TIP When you drag a control on a form, alignment handles appear automatically when the control becomes aligned vertically or horizontally with other controls. This give you a quick visual cue for making sure that controls are lined up neatly. 8. While the TextBox control is selected, locate the Text property in the Properties window, type here, and then press Enter. On the form, the word here appears in the text box. 9.In the Properties window, find the (Name) property. Visual Studio 2005 gives controls and forms default names, which, although they are a good starting point, are not always very meaningful. Change the name of the TextBox control to userName. 16 SREEKANTH C# STEP BY STEP NOTE We will talk more about naming conventions for controls and variables in Chapter 2, ââ¬Å"Working with Variables, Operators, and Expressions. â⬠10. Display the T oolbox again, click Button, and then click the form. Drag the Button control to the right of the TextBox control on the form so that it is aligned horizontally with the text box. 11.Using the Properties window, change the Text property of the Button control to OK. Change its (Name) property to ok. The caption on the button changes. 12. Click the Form1 form in the Design View window. Notice that resize handles (small squares) appear on the lower edge, the right-hand edge, and the righthand bottom corner of the form. 13. Move the mouse pointer over the resize handle. The pointer changes to a diagonal double-headed arrow. 14. Hold down the left mouse button, and drag the pointer to resize the form. Stop dragging and release the mouse button when the spacing around the controls is roughly equal.TIP You can resize many controls on a form by selecting the control and dragging one of the resize handles that appears in the corners of the control. Note that a form has only one resize handle, whereas most controls have four (one on each corner). On a form, any resize handles other than the one in the lower-right corner would be superfluous. Also note that some controls, such as Label controls, are automatically sized based on their contents and cannot be resized by dragging them. The form should now look similar to the one in the following graphic. 1. In the Solution Explorer, right-click the file Form1. s, and then click View Code. The Form1. cs source file appears in the Code and Text Editor window. There are now two tabs named Form1. cs above the Code and Text Editor/Design View window. You can click the one suffixed with [Design] to return to Design View window at any time. Form1. cs contains some of the code automatically generated by Visual Studio 2005. You should note the following elements: 17 SREEKANTH C# STEP BY STEP o using directives Visual Studio 2005 has written a number of using directives at the top of the source file (more than for the previous example) . For example: using System. Windows. Forms;The additional namespaces contain the classes and controls used when building graphical applicationsââ¬âfor example, the TextBox, Label, and Button classes. o The namespace Visual Studio 2005 has used the name of the project as the name of the toplevel namespace: namespace WinFormHello { â⬠¦ } o A class Visual Studio 2005 has written a class called Form1 inside the WinForm Hello namespace: namespace WinFormHello { partial class Form1 â⬠¦ { â⬠¦ } } NOTE For the time being, ignore the partial keyword in this class. I will describe its purpose shortly. This class implements the form you created in the Design View. Classes are discussed in Chapter 7. ) There does not appear to be much else in this classââ¬âthere is a little bit of code known as a constructor that calls a method called InitializeComponent, but nothing else. (A constructor is a special method with the same name as the class. It is executed when the form is cr eated and can contain code to initialize the form. Constructors are also discussed in Chapter 7. ) However, Visual Studio 2005 is performing a sleight of hand and is hiding a few things from you, as I will now demonstrate. In a Windows Forms application, Visual Studio 2005 actually generates a potentially large amount of code.This code performs operations such as 18 SREEKANTH C# STEP BY STEP creating and displaying the form when the application starts, and creating and positioning the various controls on the form. However, this code can change as you add controls to a form and change their properties. You are not expected to change this code (indeed, any changes you make are likely to be overwritten the next time you edit the form in the Design View), so Visual Studio 2005 hides it from you. To display the hidden code, return to the Solution Explorer, and click the Show All Files button.The bin and obj folders appear, much as they did with the Console application you developed in th e first part of this chapter. However, notice that Form1. cs now has a + sign next to it. If you click this + sign, you see a file called Form1. Designer. cs, and a file called Form1. resx. Double-click the file Form1. Designer. cs to display its contents in the Code and Text Editor window. You will see the remaining code for the Form1 class in this file. C# allows you to split the code for a class across multiple source files, as long as each part of the class is marked with the partial keyword.This file includes a region labelled Windows Form Designer generated code. Expanding this region by clicking the + sign reveals the code created and maintained by Visual Studio 2005 when you edit a form using the Design View window. The actual contents of this file include: o The InitializeComponent method This method is mentioned in the file Form1. cs. The statements inside this method set the properties of the controls you added to the form in the Design View. (Methods are discussed in Cha pter 3. ) Some of the statements in this method that correspond to the actions you performed using the Properties window are shown below: .. private void InitializeComponent() { this. label1 = new System. Windows. Forms. Label(); this. userName = new System. Windows. Forms. TextBox(); this. ok = new System. Windows. Forms. Button(); â⬠¦ this. label1. Text = ââ¬Å"Enter your nameâ⬠; â⬠¦ this. userName. Text = ââ¬Å"hereâ⬠; â⬠¦ this. ok. Text = ââ¬Å"OKâ⬠; â⬠¦ } â⬠¦ o Three fields Visual Studio 2005 has created three fields inside the Form1 class. These fields appear near the end of the file: private System. Windows. Forms. Label label1; 19 SREEKANTH C# STEP BY STEP private System. Windows. Forms. TextBox userName; private System. Windows. Forms. Button ok; .. These fields implement the three controls you added to the form in Design View. (Fields are discussed in Chapter 7. ) It is worth restating that although this file is interesting to look at, you should never edit its contents yourself. Visual Studio 2005 automatically updates this file when you make changes in the Design View. Any code that you need to write yourself should be placed in the Form1. cs file. At this point you might well be wondering where the Main method is and how the form gets displayed when the application runs; remember that Main defines the point at which the program starts.In the Solution Explorer, you should notice another source file called Program. cs. If you double-click this file the following code appears in the Code and Text Editor window: namespace WinFormHello { static class Program { /// /// The main entry point for the application. /// [STAThread] static void Main() { Application. EnableVisualStyles(); Application. Run(new Form1()); } } } You can ignore most of this code. However, the key statement is: Application. Run(new Form1()); This statement creates the form and displays it, whereupon the form takes over. In the following exercise, you'll learn how to add code that runs when he OK button on the form is clicked. Write the code for the OK button 1. Click the Form1. cs[Design] tab above the Code and Text Editor window to display Form1 in the Design View. 2. Move the mouse pointer over the OK button on the form, and then double-click the button. The Form1. cs source file appears in the Code and Text Editor window. Visual Studio 2005 has added a method called ok_Click to the Form1 class. (It has also added a statement to the InitializeComponent method in the Form1. Designer. cs file to automatically call ok_Click when the OK button is 20 SREEKANTH C# STEP BY STEP clicked.It does this by using a delegate type; delegates are discussed in Chapter 16, ââ¬Å"Delegates and Events. â⬠) 3. Type the MessageBox statement shown below inside the ok_Click method. The complete method should look like this: 4. private void ok_Click(object sender, System. EventArgs e) 5. { 6. MessageBox. Show(ââ¬Å"Hello â⬠+ userName . Text); } Make sure you have typed this code exactly as shown, including the trailing semicolon. You're now ready to run your first Windows program. Run the Windows program 1. On the Debug menu, click Start Without Debugging. Visual Studio 2005 saves your work, compiles your program, and runs it.The Windows form appears: 2. Enter your name, and then click OK. A message box appears welcoming you by name. 3. Click OK in the message box. The message box closes. 4. In the Form1 window, click the Close button (the X in the upper-right corner of the form). The Form1 window closes. â⬠¢ If you want to continue to the next chapter Keep Visual Studio 2005 running, and turn to Chapter 2. â⬠¢ If you want to exit Visual Studio 2005 now On the File menu, click Exit. If you see a Save dialog box, click Yes to save your work. Chapter 1 Quick Reference TO Do this KeyCombination 21 SREEKANTH C# STEP BY STEP Create a onsole application new On the File menu, point to New, and then click Projec t to open the New Project dialog box. For the project type, select Visual C#. For the template, select Console Application. Select a directory for the project files in the Location box. Choose a name for the project. Click OK. Create a Windows application new On the File menu, point to New, and then click Project to open the New Project dialog box. For the project type, select Visual C#. For the template, select Windows Application. Select a directory for the project files in the location box. Choose a name for the project.Click OK. Build application F6 the On the Build menu, click Build Solution. Ctrl+F5 Chapter 2 Working with Variables, Operators, and Expressions After completing this chapter, you will be able to: â⬠¢ â⬠¢ â⬠¢ â⬠¢ â⬠¢ Understand statements, identifiers, and keywords. Use variables to store information. Work with primitive data types. Use arithmetic operators such as the plus sign (+) and the minus sign (ââ¬â). Increment and decrement variabl es. In Chapter 1, ââ¬Å"Welcome to C#,â⬠you learned how to use the Microsoft Visual Studio 2005 programming environment to build and run a console program and a Windows Forms application.In this chapter, you'll be introduced to the elements of Microsoft Visual C# syntax and semantics, including statements, keywords, and identifiers. You'll study the primitive types that are built into the C# language and the characteristics of the values that each type holds. You'll also see how to declare and use local variables (variables that exist only within a function or other small section of code), learn about the arithmetic operators that C# provides, learn how to use operators to manipulate values, and learn how to control expressions containing two or more operators. Understanding StatementsA statement is a command that performs an action. Statements are found inside methods. You'll learn more about methods in Chapter 3, ââ¬Å"Writing Methods and Applying Scope,â⬠but for now , think of a method as a named sequence of statements inside a class. Main, which was introduced in the previous chapter, is an example of a method. Statements in C# must follow a well-defined set of rules. These rules are collectively known as syntax. (In contrast, the specification of what statements do is collectively known as semantics. ) One of the simplest and most important C# syntax rules states 22 SREEKANTH C# STEP BY STEP hat you must terminate all statements with a semicolon. For example, without its terminating semicolon, the following statement won't compile: Console. WriteLine(ââ¬Å"Hello Worldâ⬠); TIP C# is a ââ¬Å"free formatâ⬠language, which means that white space, such as a space character or a new line, is not significant except as a separator. In other words, you are free to lay out your statements in any style you choose. A simple, consistent layout style makes a program easier to read and understand. The trick to programming well in any language is learning its syntax and semantics and then using the language in a natural and idiomatic way.This approach makes your programs readable and easy to modify. In the chapters throughout this book, you'll see examples of the most important C# statements. Using Identifiers Identifiers are the names you use to identify the elements in your programs. In C#, you must adhere to the following syntax rules when choosing identifiers: â⬠¢ â⬠¢ You can use only letters (uppercase and lowercase), digits, and underscore characters. An identifier must start with a letter (an underscore is considered a letter). For example, result, _score, footballTeam, and plan9 are all valid identifiers, whereas result%, footballTeam$, and 9plan are not.IMPORTANT C# is a case-sensitive language: footballTeam and FootballTeam are not the same identifier. Identifying Keywords The C# language reserves 77 identifiers for its own use, and you should not reuse these identifiers for your own purposes. These identi fiers are called keywords, and each has a particular meaning. Examples of keywords are class, namespace, and using. You'll learn the meaning of most of the keywords as you proceed through this book. The keywords are listed in the following table. abstract break char continue do event finally foreach in is as byte checked decimal double explicit fixed goto int ock base case class default else extern float if interface long 23 bool catch const delegate enum false for implicit internal namespace SREEKANTH new out protected return sizeof struct true ulong using while C# STEP BY STEP null override public sbyte stackalloc switch try unchecked virtual object params readonly sealed static this typeof unsafe void operator private ref short string throw uint ushort volatile TIP In the Visual Studio 2005 Code and Text Editor window, keywords are colored blue when you type them. TIP In the Visual Studio 2005 Code and Text Editor window, keywords are colored blue when you type them.Using Variabl es A variable is a storage location that holds a value. You can think of a variable as a box holding temporary information. You must give each variable in a program a unique name. You use a variable's name to refer to the value it holds. For example, if you want to store the value of the cost of an item in a store, you might create a variable simply called cost, and store the item's cost in this variable. Later on, if you refer to the cost variable, the value retrieved will be the item's cost that you put there earlier. Naming VariablesYou should adopt a naming convention for variables that help you avoid confusion concerning the variables you have defined. The following list contains some general recommendations: â⬠¢ â⬠¢ Don't use underscores. Don't create identifiers that differ only by case. For example, do not create one variable named myVariable and another named MyVariable for use at the same time, because it is too easy to get them confused. NOTE Using identifiers tha t differ only by case can limit the ability to reuse classes in applications developed using other languages that are not case sensitive, such as Visual Basic. â⬠¢ â⬠¢ â⬠¢ Start the name with a lowercase letter.In a multiword identifier, start the second and each subsequent word with an uppercase letter. (This is called camelCase notation. ) Don't use Hungarian notation. (Microsoft Visual C++ developers reading this book are probably familiar with Hungarian notation. If you don't know what Hungarian notation is, don't worry about it! ) 24 SREEKANTH C# STEP BY STEP IMPORTANT You should treat the first two recommendations as compulsory because they relate to Common Language Specification (CLS) compliance. If you want to write programs that can interoperate with other languages, such as Microsoft Visual Basic .NET, you need to comply with these recommendations. For example, score, footballTeam, _score, and FootballTeam are all valid variable names, but only the first two ar e recommended. Declaring Variables Remember that variables are like boxes in memory that can hold a value. C# has many different types of values that it can store and processââ¬âintegers, floating-point numbers, and strings of characters, to name three. When you declare a variable, you must specify what type of data it will hold. NOTE Microsoft Visual Basic programmers should note that C# does not allow implicit declarations.You must explicitly declare all variables before you can use them if you want your code to compile. You declare the type and name of a variable in a declaration statement. For example, the following statement declares that the variable named age holds int (integer) values. As always, the statement must be terminated with a semi-colon. int age; The variable type int is the name of one of the primitive C# typesââ¬âinteger which is a whole number. (You'll learn about several primitive data types later in this chapter. ) After you've declared your variable, you can assign it a value. The following statement assigns age the value 42.Again, you'll see that the semicolon is required. age = 42; The equal sign (=) is the assignment operator, which assigns the value on its right to the variable on its left. After this assignment, the age variable can be used in your code to refer to the value it holds. The next statement writes the value of the age variable, 42, to the console: Console. WriteLine(age); TIP If you leave the mouse pointer over a variable in the Visual Studio 2005 Code and Text Editor window, a ToolTip appears telling you the type of the variable. Working with Primitive Data Types C# has a number of built-in types called primitive data types.The following table lists the most commonly used primitive data types in C#, and the ranges of values that you can store in them. 25 SREEKANTH C# STEP BY STEP Data type int Description Size (bits) *Range Sample usage Whole numbers 32 int count; count = 42; long Whole numbers (bigger range) 64 float Floating-point numbers 32 231 through 2311 263 through 2631 à ±3. 4 ? 1038 double Double accurate) numbers decimal Monetary values 128 string Sequence of characters 16 bits per Not applicable character char Single character 16 bool Boolean 8 precision (more 64 floating-point à ±1. 7 ? 10308 28 significant igures long wait; wait = 42L; float away; away = 0. 42F; double trouble; trouble = 0. 42; decimal coin; coin = 0. 42M; string vest; vest = ââ¬Å"42â⬠; char grill; grill = ââ¬Ë4'; 0 through 216 1 bool teeth; true or false teeth false; = *The value of 216 is 32,768; the value of 231 is 2,147,483,648; and the value of 263 is 9,223,372,036,854,775,808. Unassigned Local Variables When you declare a variable, it contains a random value until you assign a value to it. This behavior was a rich source of bugs in C and C++ programs that created a variable and used it as a source of information before giving it a value.C# does not allow you to use an unassigned variable. Y ou must assign a value to a variable before you can use it, otherwise your program will not compile. This requirement is called the Definite Assignment Rule. For example, the following statements will generate a compile-time error because age is unassigned: int age; Console. WriteLine(age); // compile time error Displaying Primitive Data Type Values In the following exercise, you'll use a C# program named PrimitiveDataTypes to demonstrate how several primitive data types work. Display primitive data type values 26SREEKANTH C# STEP BY STEP 1. Start Visual Studio 2005. 2. On the File menu, point to Open, and then click Project/Solution. The Open Project dialog box appears. 3. Move to the Microsoft PressVisual CSharp Step by StepChapter 2PrimitiveDataTypes folder in your My Documents folder. Select the file PrimitiveDataTypes. sln and then click Open. The solution loads, and the PrimitiveDataTypes project. Solution Explorer displays the solution and NOTE Solution file names have the . sln suffix, such as PrimitiveDataTypes. sln. A solution can contain one or more projects.Project files have the . csproj suffix. If you open a project rather than a solution, Visual Studio 2005 will automatically create a new solution file for it. If you build the solution, Visual Studio 2005 automatically saves any updated or new files, and you will be prompted to provide a name and location for the new solution file. 4. On the Debug menu, click Start Without Debugging. The following application window appears: 5. In the Choose A Data type list, click the string type. The value 42 appears in the Sample value box. 6. Click the int type in the list.The value to do appears in the Sample value box, indicating that the statements to display an int value still need to be written. 27 SREEKANTH C# STEP BY STEP 7. Click each data type in the list. Confirm that the code for the double and bool types also needs to be completed. 8. Click Quit closing the window and stopping the program. Contro l returns to the Visual Studio 2005 programming environment. Use primitive data types in code 1. Right-click the Form1. cs file in the Solution Explorer and then click View Code. The Code and Text Editor window opens displaying the Form1. cs file. 2.In the Code and Text Editor window, find the show Float Value method listed here: private void showFloatValue() { float var; var = 0. 42F; value. Text = ââ¬Å"0. 42Fâ⬠; } TIP To locate an item in your project, point to Find And Replace on the Edit menu and click Quick Find. A dialog box opens asking what you want to search for. Type the name of the item you're looking for, and then click Find Next. By default, the search is not case-sensitive. If you want to perform a case-sensitive search, click the + button next to the Find Options label to display additional options, and check the Match Case check box.If you have time, you can experiment with the other options as well. You can also press Ctrl+F (press the Control key, and then p ress F) to display the Quick Find dialog box rather then usin g the Edit menu. Similarly, you can press Ctrl+H to display the Quick Find and Replace dialog box. The showFloatValue method runs when you click the float type in the list box. This method contains three statements: The first statement declares a variable named var of type float. The second statement assigns var the value 0. 42F. (The F is a type suffix specifying that 0. 2 should be treated as a float value. If you forget the F, the value 0. 42 will be treated as a double, and your program will not compile because you cannot assign a value of one type to a variable of a different type in this way. ) The third statement displays the value of this variable in the value TextBox on the form. This statement requires a little bit of your attention. The way in which you display an item in a TextBox is to set its Text property. You did this at 28 SREEKANTH C# STEP BY STEP design time in Chapter 1 using the Properties window. Thi s statement shows ou how to perform the same task programmatically, using the expression value. Text. The data that you put in the Text property must be a string (a sequence of characters), and not a number. If you try and assign a number to the Text property your program will not compile. For this reason, the statement simply displays the text ââ¬Å"0. 42Fâ⬠in the TextBox (anything in double-quotes is text, otherwise known as a string). In a real-world application, you would add statements that convert the value of the variable var into a string and then put this into the Text property, but you need to know a little bit more about C# and the .NET Framework before we can do that (we will cover data type conversions in Chapter 11, ââ¬Å"Understanding Parameter Arrays,â⬠and Chapter 19, ââ¬Å"Operator Overloadingâ⬠). 3. In the Code and Text Editor window, locate the showIntValue method listed here: private void showIntValue() { value. Text = ââ¬Å"to doâ⬠; } T he showIntValue method is called when you click the int type in the list box. TIP Another way to find a method in the Code and Text Editor window is to click the Members list that appears above the window, to the right. This window displays a list of all the methods (and other items).You can click the name of a member, and you will be taken directly to it in the Code and Text Editor window. 4. Type the following two statements at the start of the showIntValue method, after the open curly brace: int var; var = 42; The showIntValue method should now look like this: private void showIntValue() { int var; var = 42; value. Text = ââ¬Å"to doâ⬠; } 5. On the Build menu, click Build Solution. a. The build will display some warnings, but no errors. You can ignore the warnings for now. 6. In the original statement, change the string ââ¬Å"to doâ⬠to ââ¬Å"42â⬠. b. The method should now look exactly like this: 9 SREEKANTH C# STEP BY STEP c. private void showIntValue() d. { i. int var; ii. var = 42; iii. value. Text = ââ¬Å"42â⬠; e. } 7. On the Debug menu, click Start Without Debugging. f. The form appears again. g. TIP If you have edited the source code since the last build, the Start Without Debugging command automatically rebuilds the program before starting the application. 8. Select the int type in the list box. Confirm that the value 42 is displayed in the Sample value text box. 9. Click Quit to close the window and stop the program. 10. In the Code and Text Editor window, find the showDoubleValue method. 1. Edit the showDoubleValue method exactly as follows: private void showDoubleValue() { double var; var = 0. 42; value. Text = ââ¬Å"0. 42â⬠; } 12. In the Code and Text Editor window, locate the showBoolValue method. 13. Edit the showBoolValue method exactly as follows: private void showBoolValue() { bool var; var = false; value. Text = ââ¬Å"falseâ⬠; } 14. On the Debug menu, click Start Without Debugging. The form appears. 15. I n the list, select the int, double, and bool types. In each case, verify that the correct value is displayed in the Sample value text box. 16. Click Quit to stop the program.Using Arithmetic Operators C# supports the regular arithmetic operations you learned in your childhood: the plus sign (+) for addition, the minus sign (ââ¬â) for subtraction, the asterisk (*) for multiplication, and the forward slash (/) for division. These symbols (+, ââ¬â, *, and /) are called operators as they ââ¬Å"operateâ⬠on values to create new values. In the following 30 SREEKANTH C# STEP BY STEP example, the variable moneyPaidToConsultant ends up holding the product of 750 (the daily rate) and 20 (the number of days the consultant was employed): long moneyPaidToConsultant; oneyPaidToConsultant = 750 * 20; NOTE The values that an operator operates on are called operands. In the expression 750 * 20, the * is the operator, and 750 and 20 are the operands. Determining an Operator's Values Not all operators are applicable to all data types, so whether you can use an operator on a value depends on the value's type. For example, you can use all the arithmetic operators on values of type char, int, long, float, double, or decimal. However, with one exception, you can't use the arithmetic operators on values of type string or bool.So the following statement is not allowed because the string type does not support the minus operator (subtracting one string from another would be meaningless): // compile time error Console. WriteLine(ââ¬Å"Gillinghamâ⬠ââ¬â ââ¬Å"Manchester Cityâ⬠); The exception is that the + operator can be used to concatenate string values. The following statement writes 431 (not 44) to the console: Console. WriteLine(ââ¬Å"43â⬠+ ââ¬Å"1â⬠); TIP You can use the method Int32. Parse to convert a string value to an integer if you need to perform arithmetic computations on values held as strings.You should also be aware that the type of the result of an arithmetic operation depends on the type of the operands used. For example, the value of the expression 5. 0 / 2. 0 is 2. 5; the type of both operands is double (in C#, literal numbers with decimal points are always double, not float, in order to maintain as much accuracy as possible), and so the type of the result is also double. However, the value of the expression 5 / 2 is 2. In this case, the type of both operands is int, and so the type of the result is also int. C# always rounds values down in circumstances like this.The situation gets a little more complicated if you mix the types of the operands. For example, the expression 5 / 2. 0 consists of an int and a double. The C# compiler detects the mismatch and generates code that converts the int into a double before performing the operation. The result of the operation is therefore a double (2. 5). However, although this works, it is considered poor practice to mix types in this way. C# also supports one less -familiar arithmetic operator: the remainder, or modulus, operator, which is represented by the percent symbol (%). The result of x % y is the remainder after dividing x by y.For example, 9 % 2 is 1 since 9 divided by 2 is 8, remainder 1. NOTE In C and C++, you can't use the % operator on floating-point values, but you can use it in C#. Examining Arithmetic Operators 31 SREEKANTH C# STEP BY STEP The following exercise demonstrates how to use the arithmetic operators on int values using a previously written C# program named MathsOperators. Work with arithmetic operators 1. On the File menu, point to Open, and then click Project/Solution. Open the MathsOperators project, located in the Microsoft PressVisual CSharp Step by StepChapter 2MathsOperators folder in your My Documents folder. . On the Debug menu, click Start Without Debugging. A form appears on the screen. 3. Type 54 in the left operand text box. 4. Type 13 in the right operand text box. You can now apply any of the operators to the values in the text boxes. 5. Click the ââ¬â Subtraction option, and then click Calculate. The text in the Expression box changes to 54 ââ¬â 13, and 41 appears in the Result box, as shown in the following graphic: 6. Click the / Division option, and then click Calculate. The text in the Expression text box changes to 54 / 13, and the number 4 appears in the Result box. In real life, 54 / 13 is 4. 53846 recurring, but this is not real life; this is C#! In C#, when you divide one integer by another integer, the answer you get back is an integer, as explained earlier. 32 SREEKANTH C# STEP BY STEP 7. Select the % Remainder option, and then click Calculate. The text in the Expression text box changes to 54 % 13, and the number 2 appears in the Result box. This is because the remainder after dividing 54 by 13 is 2 (54 ââ¬â ((54 / 13) * 13) is 2 if you do the arithmetic rounding down to an integer at each stageââ¬âmy old maths master at school would be horrified to b e told that (54 / 13) * 13 does not equal 54! . 8. Practice with other combinations of numbers and operators. When you're finished, click Quit. The program stops, and you return to the Visual Studio 2005 programming environment. Now take a look at the MathsOperators program code. Examine the MathsOperators program code 1. Display the Form1 form in the Design View window (click the Form1. cs[Design] tab if necessary). TIP You can quickly switch between the Design View window and the Code and Text Editor displaying the code for a form by pressing the F7 key. 2. In the View menu, point to Other Windows and then click Document Outline.The Document Outline window appears showing the names and types of the controls on the form. If you click each of the controls on the form, the name of the control is highlighted in the Document Outline window. 33 SREEKANTH C# STEP BY STEP IMPORTANT Be careful not to accidentally delete or change the names of any controls on the form while viewing them in the Document Outline window. The application will no longer work if you do. 3. Click the the two TextBox controls that the user types numbers into on the form. In the Document Outline window, verify that they are named lhsOperand and rhsOperand.When the form runs, the Text property of each of these controls holds (as strings) the numeric values you enter. 4. Towards the bottom of the form, verify that the TextBox control used to display the expression being evaluated is named expression, and that the TextBox control used to display the result of the calculation is named result. At runtime, setting the Text property of a TextBox control to a string value causes that value to be displayed. 5. Close the Document Outline window. 6. Press F7 to display the Form1. cs source file in the Code and Text Editor window. 7.In the Code and Text Editor window, locate the subtractValues method: private void subtractValues() { int lhs = int. Parse(lhsOperand. Text); int rhs = int. Parse(rhsOperand. Text); int outcome; outcome = lhs ââ¬â rhs; expression. Text = lhsOperand. Text + â⬠ââ¬â â⬠+ rhsOperand. Text; result. Text = outcome. ToString(); } The first statement in this method declares an int variable called lhs and initializes it to the result of the explicit conversion of the lhsOperand. Text property to an int. (The Text property of a TextBox is a string, and must be converted to an integer before you can store it in an int. This is what the int.Parse method does) The second statement declares an int variable called rhs and initializes it to the result of the explicit conversion of the rhsOperand. Text property to an int. The third statement declares an int variable called outcome. The fourth statement subtracts the value of the rhs variable from the value of the lhs variable, and the result is assigned to outcome. The fifth statement concatenates three strings (using the + operator) and assigns the result to the expression. Text property. The sixth st atement converts the int value of outcome to a string by using the ToString method, and assigns the string to the result.Text property. 34 SREEKANTH C# STEP BY STEP The Text Property and the ToString Method I mentioned earlier that TextBox controls displayed on a form have a Text property that allows you to access the displayed contents. For example, the expression result. Text refers to the contents of the result text box on the form. Text boxes also have many other properties, such as the location and size of the text box on the form. You will learn more about properties in Chapter 14, ââ¬Å"Implementing Properties to Access Attributes. â⬠Every class has a ToString method.The purpose of ToString is to convert an object into its string representation. In the previous example, the ToString method of the integer object, outcome, is used to convert the integer value of outcome into the equivalent string value. This conversion is necessary because the value is displayed in the T ext property of the result fieldââ¬âthe Text property can only contain strings. When you Controlling Precedence Precedence governs the order in which an expression's operators are evaluated. Consider the following expression, which uses the + and * operators: 2+3*4This expression is potentially ambiguous; does 3 bind to the + operator on its le
Sunday, September 29, 2019
Positive Functions the Poor and Poverty Has on Society Essay
There is a lot of positive functions poverty and the poor have on society. The existence of poverty makes sure that ââ¬Å"dirty workâ⬠is done. ââ¬Å"Dirty workâ⬠is classified as dangerous, physically dirty, temporary, undignified, a dead-end, underpaid, and menial jobs. In America, poverty functions to provide low-wage labor pools that makes people, willing or unwilling, to perform dirty work at lowest costs allowed. The poor subsidize tons of activities that benefit the wealthy. They have supported the consumption and investment or the private economy by virtue of the low wages they receive. Barry Schwartz pointed out, ââ¬Å"the low income of the poor enables the rich to divert a higher proportion of their income to savings and investment, and thus to fuel economic growth. This, in turn, can produce higher incomes for everybody, including the poor, although it does not necessarily improve the position of the poor in the socioeconomic hierarchy, since the benefits of economic growth are distributed unequally. â⬠Poverty creates jobs to help serve the poor and shield them off from the rest of the population. Activities flourish because of poverty; examples would be anything considered a ââ¬Å"number gameâ⬠like the sale of heroin, cheap liquors and wines, prostitutes, pawnshops, and a group called Peacetime Army (this group only enlists poor men). The poor buy foods and other items that other people do not want, for instance day-old bread, fruits and veggies that would be thrown out at grocery stores, second-hand clothing, and deteriorating cars and buildings. The poor also provide incomes for lawyers, teachers, doctors, and other people who are either too old, incompetent, or poorly trained to attract the more wealthy clients/patients. There is a group of poor people called the ââ¬Å"deserving poorâ⬠, these people are disabled or just have plain out bad luck. They provide the rest of the population with emotional satisfaction. They Induce compassion, charity and pity thus allowing the people who help them feel as though they are moral, practicing a religious ethic, and that they are philanthropic and generous. The ââ¬Å"deserving poorâ⬠let those people feel fortunate for not having to deal with what they have to being struck within the poverty hole. Poverty also promises the status of the people who arenââ¬â¢t poor. In a stratified society, social mobility is an important goal. People need to know where they stand in the level of classes; poverty functions as their reliable/permanent measurement tool for status comparison. To end this long list of positive functions poverty adds to society, I have one last thing ââ¬â the poor have played a large role in the shaping of Americaââ¬â¢s political process. They vote and participate far less than other groups in the economic standings. The system is free to ignore the poverty-stricken because of this; this has not only made politics more reasonable and centrist but it has added more to the stability of the processes involved in the American politics.
Saturday, September 28, 2019
The Importance of Logistics in Providing
Logistics involves controlling and managing the movement of goods and services, information and products from the point where they are produced up to the market place.à In other words, it deals with the information and physical flows of the raw materials to the final distribution of finished products.à Logistics also involves the management of information and storage of materials, parts of the finished goods in the chains of supply, through procurement stages, work-in-progress to the final distribution. According to cooper (1994), the goal of logistics is to maximize future and current profitability in order to acquire customer satisfaction and also satisfying their orders through the cost effective analysis (Rushton, Oxley & Croucher, 2000). Customer service and Logistics Majority of todayââ¬â¢s companies consider customer service as a very crucial phenomenon in their businesses.à In the past customer service was mainly based on the needs of the customer without taking in consideration what real requirements or even the perceptions of these customers.à It is therefore necessary to comprehend the customer requirements and service will always differ not only between industries and companies but also between the market segments that a business might seem to have (Rushton, Oxley & Croucher, 2000). Complexity of the provision of customer service is also another important requirement that needs to be noted and understood clearly.à This is because customer service links the processes of logistics and distribution and many influences relevant to customer service may evolve within these processes; such as the range from ease of ordering stock that is available to the reliability of delivery. It is also important to balance the cost of provision with the level of service provided.à High costs of providing customer service that is even greater than what a customer actually requires has resulted in the downfall of many service offerings in companies. Therefore, the key to attaining quality and successful customer service policy is through the development of appropriate policies and objectives which involves liaison with these customers.à It is also important to monitor, control and measure all the set up procedures (Rushton, Oxley & Croucher, 2000). The components of the logistics customer service may be identified as a transaction ââ¬ârelated elements with emphasis being placed on specific service that is provided for instance on time delivery.à It may also be viewed as functional attributes related to the entire aspects consisting of the order fulfillment such as taking of orders. In order to reflect the timing and nature of particular service requirements transaction elements are usually put into three categories: Pre-transaction elements, transaction elements and post-transaction elements. Pre-transaction elements consist of customer service factors brought about as a result of the actual transaction that takes place. They involve: accessibility of order personnel, method of ordering, system flexibility, written customer service policy single order contact point, transaction elements organizational structure and order size constraints. Transaction elements on the other hand are the elements that are related to those other elements mostly concerned with logistics and distribution.à These elements include: delivery of complete order, delivery time, order preparation, delivery reliability, order cycle time, availability of inventory, condition of goods, order status information and delivery alternatives. The post-transaction elements consist of those elements that arise after the process of delivery has been fulfilled.à These elements include: call-out time, returns policy, availability of spares, product tracing, involving procedures, customer complaints and procedures, claims procedures and involving accuracy. Another classification of customer service elements is that one of multifunctional dimensions.à This classification has the objective of assessing the various components of customer service available across a range of the whole functions of the company so as to strive to gain a seamless service provision.à For instance, time is made up of a single requirement which covers the whole range of span from the placement of order to the delivery of the order ââ¬â the order cycle. This approach has the impact of enabling the delivery of some very relevant measures of logistics.à The multifunctional dimensions include: dependability which means the guaranteed accurate and fixed delivery time, flexibility which is the logistics customer services ability to identify and respond to the changing needs of customersââ¬â¢ time that is usually order cycle time and communication which helps in the easy of order taking processes (Rushton, Oxley & Croucher, 2000). There elements of customer service differ and their significance will also vary according to the company, concerned market and the product.à Therefore, it is important that a customer service policy exists which will help in the undertaking of the various segments of the market that exists. The customer service policy also involve the awareness of the needs of customers or those of the segmentation; identification of clearly defined quantifiable standards available for customer service, understanding any trade ââ¬â off that may exist between the levels of customer service and that of the costs, measuring the service that is provided and lastly liaison with customers so as to enhance an appreciated and understanding of the provided service (Rushton, Oxley & Croucher, 2000). How logistics customer service affect a companyââ¬â¢s sales and customer loyalty Customer service involves ways in which an organization deals with its customers and it is mostly seen in sales and after-sale service.à Customer service in logistics should also include all the processes that are involved in the value chain.à To acquire customer focus, there is need to obtain a good customer service.à Poor customer relations on the other hand are as a result of the availability of poor customer service (Peck & Christopher, 2003). Increasing levels of competitive pressure and difficulty with the aim of maintaining and increasing profitability is what most of todayââ¬â¢s companies face.à The management of these companies are being faced with the challenges of innovating and seeking strategies that could help in the advancement of the competitive advantage and profitability of their awareness of the significance of logistics in their organizations hence the need for a specialist. Logistics customer service plays a very crucial role in the overall outcome of a companyââ¬â¢s sales and customer loyalty.à The outcome could be negative or positive depending on the quality of the customer service that is being provided by an organization.à Poor customer service in logistics could result in poor customer loyal.à The poor services include high costs, poor delivery time, and poor goods that the company could be offering, lack of enough inventory among other things.à This not only affects customer relations and loyalty but also the sales of the company (Peck & Christopher, 2003). The earlier on discussed elements of logistics customer service play a very crucial role to the buyers of the products in the company.à Lack of adherence to these elements by an organization often leads to the fall in the overall companyââ¬â¢s sales and customer loyalty.à Profitability of the firm depends on how a company handles carriers out these elements. An organization is bound to gain loyalty from its customers when it strives to strengthen the relationship between them as this will enhance the companyââ¬â¢s sales hence profitability is increased.à This relationship involves good communication and honesty from the logistics customer care service loyalty can only be enhanced through good customer service provision.à Customer loyalty is bound to deteriorate if they are offered with poor services or the companyââ¬â¢s sales are such that they are too high as compared to their expectations of the goods and services that a company provides (Peck & Christopher, 2003). Customer service plays a vital role in logistics hence its major concern.à The level and quality of logistic customer service provided will directly impact on the companyââ¬â¢s cost and implication, its profitability and the market share.à Poor logistic customer service will result in the companyââ¬â¢s lose of customer hence losing their loyalty as well.à The end result therefore means that the company will have to incur high costs in trying to shape its image and also in the recruitment of other personnel. The company has also got to strive in order to increase its market share.à On the other hand effective logistic customer care will result in the improved market share, profitability and low cost incurred by an organization (Peck & Christopher, 2003). Customer service in logistics and be viewed as an activity which means what a company actually provides for its customer service department that mostly handles special orders, billing, complaints among other things.à Similarly the provision of customer service can also be viewed as a measure of a companyââ¬â¢s performance.à For instance if a company can deliver completed orders at least 24 hours of the receipt and 95% on time, this means that this company provides good customer service. It is therefore, important that the logistics customer service provides quality service in the manner in which they handle customerââ¬â¢s complaints, handling their orders and the speed of delivery.à This will have a positive impact on the companyââ¬â¢s sale and customer loyalty (Gourdin, 2006). In addition, if the logistics customer service system is managed in a way that it can provide the customers the level and standard of services that they require, this will à result into customer satisfaction hence accompany is able to reap maximum benefits and at the same time retain the loyalty of its customers. Another factor that determines how logistic customer service impacts on companyââ¬â¢s sales and customer loyalty is honesty.à Honesty means that an organization should be able to fulfill its promises to its customers.à If a company pledges more than what it can guarantee, it means that the customers will get dissatisfied.à This as a result, will lead to the fall of the number of customers that a company has hence, losing the customerââ¬â¢s loyalty and this eventually leads to a fall in the companyââ¬â¢s sales.à It is therefore important that manager do not overstate the services they intend to offer their customers (Gourdin, 2006) To conclude, in todayââ¬â¢s market, competition is stiff and customers are more demanding with regards to goods and services that are offered by companies.à The expectations concerning service provisions and this therefore calls for the understanding of what is valued by the customers and also a company needs to focus on the processes so that this value is delivery consistently. References Gourdin, K., (2006) Glogal Logistics Management: A Competitive Advantage for the 21st Century. Blackwell Publishing, ISBN 1405127139. Peak, H. & Christopher, M. (2003) Marketing Logistics. Elsevier. ISBN 0750652241. Rushton, A., Oxley, J., & Croucher, P., (2000).à The Handbook of Logistics and Distribution Manage.à Kogan Page. ISBN 0749433655.
Friday, September 27, 2019
Analyzing Case Study Research Paper Example | Topics and Well Written Essays - 1000 words
Analyzing Case Study - Research Paper Example The analysis will take into consideration the actions and decisions of the energy industry regulators to promote competition in the industry. United Kingdom Energy Markets As demonstrated by the actions of British Gas and the Scottish and Southern Energy, the energy market in U.K is characterized by collusion and cartels. These oligopolistic market structures enable the six larger firms in this industry to regulate the market by determining the prices and supply of energy products. An oligopoly is a market structure, which is controlled by few producers, and each of the producers has control over the market. The extent to which an industry or a market is dominated by a few leading firms is determined by the concentration ratio. It is an industry where the level of market concentration is high. In most circumstances, an oligopoly exists when there are five large firms, and the demand or sales of their products account for 60 percent of the total market. There is no specified theory th at explains how firms determine the output and price under the conditions of oligopoly. If there are price wars in the industry the oligopolistic firms will produce and price their products as perfect competitive industry, at other times they will behave like a pure monopoly. The following are the characteristics of oligopoly market structure; these characteristics are also displayed by the UK energy market. First, product branding; this feature is seen when every firm in the market is selling differentiated (branded) products. For example, British Gas, EDF, E.ON, Scottish Power, Npower, and SSE firms among other small firms in the energy industry sell differentiated products in the UK energy markets. Second, entry barriers; considerable entry barriers into the industry market prevents other firms to enter the market thus enabling dominant firms to maintain supernormal profits. Various small firms may operate on the edge of an oligopolistic market, but these firms are not large enou gh to have a considerable effect on the market output and prices. In July 2011, the British Gas announced an increase in electricity and gas prices by 16 percent and 18 percent respectively just eight months after it increased its prices. British Gas managing director defended the increase in prices saying that the market rates for energy has increased in the global energy market, which increased the wholesale costs of the firm by 30 percent for the last one year (King 2011). While reacting to this increase in energy prices energy minister, Chris Huhne demanded change in the UK electricity market. Energy secretary Chris Huhne, held a meeting with small energy suppliers, with an objective of finding ways of breaking the dominance of the large six electricity and gas companies and help in keeping energy prices down. The plan of the minister was to abolish the entry barriers in the energy market to allow competition between small and large firms in the energy industry (King 2011). The actions of Chris clearly show that there are entry barriers in the UK energy market. Third, interdependent decision making; in oligopolistic market firms take into consideration the possible responses of their competitors to any change in output, price or forms of non-price competition. Increase of gas and electricity prices by British Gas came one month after
Thursday, September 26, 2019
Compare and contrast the four distinct categories of presidential Essay
Compare and contrast the four distinct categories of presidential personality described in James Barber's habitual action patterns approach - Essay Example In the active positive presidential category, Barber described them as adaptive. They are also self-confident and flexible. They tend to create opportunities for actions and enjoy exercising their power. They usually do not take themselves too seriously. In addition, they are optimistic individuals. Power is considered as means to achieve beneficial results by this group. They spend much energy in their job and enjoy doing the job. The group is also productive, result-oriented, and successful in pushing programs through (Barber 6). A good example is George W. Bush. His character of taking action without too much caution as was the case with the Iraq invasion portrays a key characteristic of this group. The second group of active negative tends to be compulsive. They mainly tend to use power as a means of self-realization. This group expends a lot of energy on the job but derive little joy in the process. They are always preoccupied with whether they are succeeding or failing in their job. In addition, they tend to have low self-esteem. Mostly, they are rigid, pessimist, highly driven, and have problems when it comes to aggression and management. They usually want to get and retain power to prove to others that they are people to reckon with. A good example of active negative presidents is Woodrow Wilson. Wilson put much effort in his work but did not receive any emotional rewards. He rarely received satisfaction with the work he did. He was said to have a compulsive and perfectionist personality. The other group is passive positive. This group tends to be compliant and usually seek to be loved. They are easily manipulated. The have a low self-esteem, which they overcome by adopting an ingratiating personality. They are reactive, lack initiative, and are superficially optimistic. They spend less energy on the job but like doing the job. William Taft and Warren Harding are typical examples of
CW4 - Peter Drucker Essay Example | Topics and Well Written Essays - 1500 words
CW4 - Peter Drucker - Essay Example Peterââ¬â¢s era was the twentieth century where his career regarding management consultant grew from 1942.Peter Drucker had led a bright career in teaching phycology, sociology and management. Ultimately he pioneered in offering an executive MBA program for working professionals in Claremont Graduate University. His writing and critical thinking regarding the improvement of the organization as to adopt the human resource and benefit the human race urged him to write several books and articles. Although being the management consultant he was not much inspired by the numbers but he was focused upon improving the organizational cultures and relations so that the human resource management can be done more effectively and beneficially. Peter Druckerââ¬â¢s writing regarding society and politics led him to work in the high level management of one of the biggest company around the world at that time, General Motors. Peter taught the management of liberal art where the relation regardin g the suppliers, customers, employees and other companies were given much value than crunching of the numbers. With his workings and phycology Peter earned links in the top management of the many of the big bulls of that time including General Electric, IBM, Sears and many more especially in Japan as Japanese where really inspired with his works. Main Thought From the start Peter Drucker was more inspired and exaggerated the relationship between the people then from the valuation of numbers. The main focus of Peter was upon improving the relation between the employees and enhancing the capabilities of the human resource. He was much inspired by those who work with minds rather than those who work with hands. Most of the works of Peter Drucker is upon the betterment of the management in the organizations as he believed that private organizations play a vital role for the betterment of the society. Peterââ¬â¢s belief of making organization better to better serve the society led to many ideas in reforming the organizational cultures and norms so that the private sectors serve the economy and enhance the human lives. The Wall Street Journal called Drucker ââ¬Å"the most influential management thinker of the past century,â⬠who ââ¬Å"developed a loyal following among many of the worldââ¬â¢s most-famous corporate chieftains, and became the model of the modern management guru, a craft he plied far more modestly than many of his successorsâ⬠(Thurm & Lublin, 2005). Peter believed that the human resource is one of the most important assets to the company and the management should value the employees and train them accordingly so that the employees would bring out their talent and benefit the organization and the society. it is this thought of Peter Drucker that realized the worth of human resource in the organizations and ultimately leaded to the enhancements in the human capabilities. Peter Drucker idealized the importance of the private sector as th e organizations and their relation with the better society by providing human resource that are more benefiting for the society as a whole. According to him the works of the workers should be appraised and appreciated. By appreciation the motivation level of the individuals increase and thus improves the potential of the individual ultimately resulting in the enhancement of knowledge within the individual and then spreading in the social circle and thus benefiting for the whole society. The appreciations of the works of the workforce is the main reason that the workforce devotion
Wednesday, September 25, 2019
Inside Job (2010) Movie Review Example | Topics and Well Written Essays - 500 words
Inside Job (2010) - Movie Review Example The various traits that are in the film follow the story line that occurred from 2007 with the economic changes and associates this with the main ideologies of the economy and the government. The plot of the film is based on the financial meltdown that is a part of the current global crisis. The plot first looks at the financial crisis of 2008 and the outcomes which it caused, such as the loss of $20 trillion, loss of jobs, loss of homes and the eventual global collapse that was associated with this. The plot then moves into interviews and associations with the financial crisis to define what happened and occurred and how it became a major component of history. The attributes are incorporative of defining an industry that was always corrupt and rogue and which forced the financial meltdown. The main ideology that is given from the director is that the industry corruption led to a forced meltdown which could have been prevented otherwise. The setting is based on the interviews of thos e in the financial industry and is combined with the historical issues of the recent financial meltdown.
Tuesday, September 24, 2019
Purchase decision of Pevensey PLC among four options of machinery Essay
Purchase decision of Pevensey PLC among four options of machinery - Essay Example In this paper two methods for analysis of the investment decision are adopted. These methods include discounted and non-discounted cash flow analysis. The reason for choosing these particular methods is that they are strictly numerical and objective. The solution given by these methods cannot be argued against and can be easily defended if questions are raised pertaining to their legitimacy. Relevant data is also available for using the above mentioned methods of analysis. The initial costs of the four machines, their residual value at the end of their useful life and cash flow generated by the four machines is provided in the case. -Discounted Cash flow simply calculates the differential between the costs and receipts associated with each investment option for the organization. In this particular case, the investment options for the company are the four machines. The benefit of non-discounted cash flow method is ease of assessment and communication to the top management. Discounted cash flow is a modified and improved version of cash flow analysis in which timings of the cash flows are also taken into account. Under this method, value for each cash flow is discounted according to respective cost of capital of the company. This method makes more sense because contemporary organizations prefer gain cash flow as early as possible, so that this cash flow can be reinvested in the business or some other venture. Aversion toà risk is the second reason for discounting of because the distant is the date for receipt for cash; the lesser is the certainty of receiving it. An investment is viable if its net cash inflow exceeds the net outflow of cash for acquisition and maintenance of machinery (Gilchrist and Himmelberg, 1995). The cost of capital of
Monday, September 23, 2019
Rhetorical visual analysis Assignment Example | Topics and Well Written Essays - 500 words
Rhetorical visual analysis - Assignment Example The distinction seems to be a product applied in the bleeding eye. According to the beliefs we uphold, bleeding is associated with pain hence in the on start the message that appears in the mind is that this person must be suffering. To make matters worse, the bleeding part is one of the most sensitive parts of the body, the eye. We all are very careful what we expose our eyes to. Therefore, it appears that the lady in the advertisement was reckless in applying the product to the eye culminating in the bleeding. To demonstrate that the eye is bleeding there appears the contrast of the colors. The product applied is brownish while the bleeding is reddish. This blood is evidence that there is pain involved. The advert reveals the major consumers of the products in question. A female has been used by the advertisement to show that they are the major consumers of the product. The question that arises from is what if it were the consumer having the product tested on them. In addition, the use of a human subject arouses sympathy and pity. Hence, the message is relayed efficiently. The consumers of the product is also revealed by the predictable age group of the lady in question, she seems a vibrant and young professional who has the capacity to purchase the product she applies. The advertisement sends the message that the Americans are not only concerned about human rights but also animal rights. It also depicts that, America being a power to reckon with in research is concerned about the welfare of animals by regulating how animal subjects are used. Being a pacesetter in research such a move has influence worldwide. The advertisement has some sense of reality. This is because some scientists have been reckless in the use of animal models. It is important that as the humans try on modifying and developing products should weigh the impact of the products on the animals they use. The advert raises a lot of curiosity that leads to
Sunday, September 22, 2019
The Genesis and Presentation Essay Example for Free
The Genesis and Presentation Essay Orwells point through Winston is that those who care are insufficient on their own, a singly party state of the tyrannical nature of Ingsoc can only be overcome by a combined effort of the people: an uprising of the proles, Winston stands alone and is so crushed beneath the boot of Big Brother. Winstons shares Orwells frustration over the matter of the proletariat, Orwell felt that he could see the world letting its freedom slide into the hands of a select few, he knew that it could be stopped if only people could be convinced that they were losing their liberty. However he also felt that this decent into totalitarian control was inevitable and that the people of the world could never be persuaded to take a stand, we can see this through the words of OBrien when he is torturing Winston: The programme it sets forth is nonsense. The secret accumulation of knowledge a gradual spread of enlightenment- ultimately a proletarian rebellion- the overthrow of the Party It is all nonsense, the proletarians will never revolt, not in thousand years of a million. They cannot The rule of the party is forever, make that the starting-point for your thoughts. 18 Julia is of a similar caste to Winston, in that she represents the politicly active, however she is representative not of those who are benevolently crusading for justice and freedom, instead she represents those who rebel selfishly. She fights for her own good, for physical pleasure, not intellectual freedom as Winston does. Orwell uses her to illustrate another point: she does not require nearly so much reindoctrination at the conclusion of the novel, this is because she is not as true a political activist in Orwells mind. The point he is trying to show the reader through her existence is that those whose dissent is selfish are merely superficially seditious, and their political convictions are irrelevant. Again he shows us that those who stand alone cannot succeed against a totalitarian state. Through Julia and Winston as a pair Orwell demonises the state by showing that it destroys love. The last thing within Winston that is torn from him is his love of Julia, and it is at this point that he makes the change from Man to Shell. The last character OBrien in description seems calm, reasonable, manipulative and easy to talk to, he is glib and quick witted. He is Orwells representative of the Party, he is almost Satanic in the way that he converts and perverts those that try to battle wits with him, he is insidious in spreading the propaganda of the party and converting, then destroying those who rebel. Harbinger of pain and suffering, he is the penultimate evil and representative of all that Orwell hates. Orwell makes him out to be despicable, obviously he is psychopathic, without feeling or remorse, and his sense of morality is so twisted that it is barely recognisable as human sentiment, but Orwells technique goes further than this, he even describes him as physically ugly: There were pouches under the eyes, the skin sagged away from the cheekbones However the Authors purpose in creating OBrien is to primarily to allow him to explore the political message that he wants to write of in more detail. Whilst a generic and simplistic political message such as Totalitarian systems are bad is a relatively simple to encode into the plot of a text such as this, it is far more complex if the author wishes to discuss the specifics of politics. As Orwell was primarily an essayist he was not used to showing his beliefs in such a generalised way as a conventional political fiction would allow, so it was necessary to find a way to examine the political doctrine of a centralised economy in detail, but more than that it needed to be accessible to the average reader. It was with these needs in mind that Orwell devised OBriens role in the plot, it is his discussions with Winston over the party politics that Orwell uses to explore these concepts with the reader. When OBrien explains, it is Orwell who wants to show the reader something. For example Orwell uses OBrien to present his thesis that power is not a means, it is an end. Orwell took great pride in writing prose like a window-pane, he believed in a similar doctrine of writing to Gustave Flaubert, in that a writer should appear no more in his work than God does in nature. However where Flaubert was trying to write a realist novel, Orwells work is more naturalistic in its style. The descriptions are clipped and precise, and flowery language is not to be found within the pages of the novel. His dry, clipped style adds perfectly to the anguish he describes in his foretelling of the future. The book is primarily dominated by narrative, Orwell is only interested in Winstons conversations so far as they serve his political purpose, and outside the Ministry of Love, almost all of Winstons conversations are too censored to show any political belief whatsoever. Therefore Orwell is forced to focus his work on the thoughts of Winston to explore his political ideas. There are certain themes that Orwell uses to better portray the ideas that he wishes to explore. Primarily there is the theme of the destruction of love, Family love: between Winstons family, and between the Parsons family who live next door. Sexual love: between Julia and Winston. Platonic love: between friends. All these ideals the Party has destroyed. This is just a fairly simple way for Orwell to engender a hate for the Party in his reader, a hate which would enhance Orwells political message on the evils of totalitarianism. Other more subtle metaphors and literary methods that Orwell uses are: the glass paperweight is used to represent freedom from the Party. It is bought when Winston first begins to deviate from the Party doctrine, and it is finally smashed by the guard when Winston is captured. Here we see that the coral, like his freedom, was actually far smaller than it appeared within the glass. Through the same area of the book the Rhyme of St Clements is used by Orwell to establish a growing tension, and is symbolic of the inevitable end to Julia and Winstons affair. This happens because as one reads the text the reader doubtless remembers the full poem, knowing the final line Here comes a chopper to chop off your head, it is hard to relax as one sees its approach. This increase in tension serves Orwells political purpose he wishes to focus the reader on the helplessness before the Party that Winston and Julia are victim to, the feeling that their defeat is inevitable adds to this, and is furthered by Orwells use of the Rhyme. Above all Orwells literary methods serve to create a book that has stood as one of the greatest political writings of all time, these techniques have allowed Orwell to write a novel that is impossible to read without being changed forever. Merely skimming through the text for the sake of escapism, which surely was never Orwells purpose, it is inevitable that Orwells political beliefs will leave their mark on the reader. This novel has spawned a thousand fictions of its type, and many great works such as the novel A Handmaids Tale by Margaret Atwood or the film Brazil owe their lineage to the work of Orwell. More than this the ideas that his idea of language as explored in the book have influenced the English tongue forever, words such as Doublethink and Newspeak will go down in the dictionary for all time, as will an adjective that I think he would be proud of Orwellian. However the scope of influence of Nineteen Eighty-four goes beyond literature even beyond language, to the very subject on which he was commenting. Nineteen Eighty-four changed politics forever, Orwells warning, along with others of the time was indeed heeded, and humanity was diverted from a path that could easily have been as self-destructive as that described in the novel. I believe that congratulations are in order to the great man George Orwell for producing a political fiction that has eternally changed mankind, Thankyou. 19 Matt Jackson Bibliography Greenblatt, S. Three modern Satirists: Waugh, Orwell, and Huxley. C1965 Yale University Press. Orwell, G.Letter to Francis A. Henson (extract) [New York Times book review, 31st July 1949. ] [Life, 25th July 1949] Orwell, G. Politics and the English Language Horizon, April 1946 Burnham, J. The Managerial Revolution 1941; John Day Co. Orwell, G. Letter to Roger Senhouse 26th December 1948 Ranald, R. A. George Orwells 1984,1965; Monarch Press. Zamyatin, Yevgeny. We 1972 Penguin (First published in English in the USA 1924) Orwell, G. Letter to F. J. Warburg 31st May 1947 Orwell, G. Nineteen Eighty-four; 1949, Secker and Warburg Distopia [online] [cited 27/03/2002]. Available on the World Wide Web URL: http://www. geocities. com/Athens/Delphi/1634/Distopia. html Rucco, A. A Text Response Guide to George Orwells Nineteen Eighty-four. 1993 Wizard books. 1 Greenblatt, S. Three modern Satirists: Waugh, Orwell, and Huxley. (p. 66) 2 Orwell, G. Letter to Francis A. Henson (extract) [New York Times book review, 31st July 1949. ] [Life, 25th July 1949] 3 Greenblatt, S. Loc. cit. (p. 66) 4 Orwell, G. Politics and the English Language Horizon, April 1946. 5 Burnham, J. The Managerial Revolution 6 Orwell, G. Letter to Roger Senhouse 26th December 1948 7 Ranald, R. George Orwells 1984 (p. 119) 8 Zamyatin, Y. We 1972 Penguin 9 Orwell, G. Letter to F. J. Warburg 31st May 1947 10 Orwell G. Nineteen Eighty-four; 1949 11 ibid. 12 Orwell, G. Letter to Francis A. Henson; loc. cit 13 Distopia [online] [cited 27/03/2002] 14 Yea I need to dig up a couple of references here I know I am working on it; the only catch is I cannot actually remember where I read half this stuff. :(15 Orwell, G. Nineteen Eighty-four Loc. cit. 16 Ok, this idea is essentially one of my own, but it was extrapolated from a point that you made in conversation the other day, I would like to reference this if I can, any suggestions on how to do it? 17 Rucco, A. A Text Response Guide to George Orwells Nineteen Eighty-four 18 Orwell G. Nineteen Eighty-four Loc. cit. 19 Sorry I will do something about the conclusion, I know its wanky but it is 2. 30 in the morning and I think I am losing the ability to construct coherent sentences.
Subscribe to:
Posts (Atom)