# 2.3 - Adding the Code ## Creating the class's source and header files Gorm.app can automatically create the skeleton of the class you've designed: select the ConvertorManager class in the Classes panel of the main window, and do Classes→Create Class Files. ![Classes→Create Class Files](2.3_nfig1.png) Two successive Save Panels will pop up for the .m and the .h files. Gorm will propose as file names ConvertorManager.m and ConvertorManager.h, it is a good convetion to use the class name as a filename. Save those files into the Project directory. ![Save dialog](2.3_nfig2.png) You may also safely delete the `AppController` object instance if you have it in your Gorm file. Once this is done, remember to save the interface if you haven't yet, and go back to ProjectCenter. ## Creating the class's source and header files Adding the class's source and header files to the current project You now need to add the class's files to the project. Double-click Classes in the first column of the browser, choose the `.m` file to add to the project (`ConvertorManager.m`); the corresponding header file will be automatically added for you. ![Adding the class's source and header files to the project](2.3_ofig3.png) ## Writing the convert: method Open the `ConvertorManager.m` file by slecting its name within ProjectCenter.app browser. You can display the file in the embedded view or, alternatively, double-clicking will open it in a separate editor. You should see the following : ```objc /* All Rights reserved */ #import #import "ConvertorManager.h" @implementation ConvertorManager - (void) convert: (id) sender { /* insert your code here */ } @end ``` Add the following inside the convert: method: ```objc [result setFloatValue: [rate floatValue] * [amount floatValue]]; ``` or if you want to have a nicer display: ```objc [result setStringValue: [NSString stringWithFormat: @"%1.2f", [amount floatValue] * [rate floatValue]]]; ``` Save the file. ![Editing the class](2.3_ofig4.png) You may safely remove the `AppController` class from your project, we are not using it. ## Compiling and running Click ![Compiling Panel Button](2.3_icon_build.png) to dispay the building panel. Then click ![Build Button](2.3_icon_build.png) to build the project. If there is no errors (and hopefully there is none), you can run the application. To do it, click ![Run Panel Button](2.3_icon_run.png) to display the run panel. Then click the first button (at this time it has still no icon), this should launch the application : ![Converter.app running](2.3_ofig5.png) Convertor.app in action, converting between Euro and US Dollar. **Congratulations, you have completed your first GNUstep app!**