As your first step, create the classic “Hello World” program. This will help ensure that you have all of the software installed correctly, and are ready to move on with creating other programs. There...

it just simple program need to be done in visual studio using c editor


As your first step, create the classic “Hello World” program. This will help ensure that you have all of the software installed correctly, and are ready to move on with creating other programs. There is a walk through of this task in Activity 2: "Your First Program" in Week 1 of Course 1. This includes videos that will show you what you need to do in order to get things working. As this is your first program, the guidance in this task is very detailed. It includes information that you can use now to understand how to work with the terminal, and you can refer back to this if needed in the future. For this task you can follow along with the videos, as these show you want you need to do. It would be good to read over these details, as they help extend your understanding and give you tools to succeed with later tasks. While future tasks will have relevant details, most future tasks wont have this level of detail. For this task you need to make the class Hello World program, and submit its code along with a screen shot showing that you got it working. Submit the following files to OnTrack: Hello World source code (the Program.cs file) A screen shot of your program running Check the following things before submitting: Your code layout matches the expected format. You are using the write case for Classes and Methods (both PascalCase) and variables (camelCase). You can demonstrate how to compile and run from the terminal. The first task includes the steps needed for you to install the tools you will need in this unit. You will then use these tools to create the classic "Hello World" program. SIT771 Object Oriented Development Pass Task 1.1: Hello World Overview Submission Details Instructions 1. Install the tools you need to get started. Check the install instructions for your operating system: Install build tools, VS Code, and Dotnet core for Linux Install xcode tools, VS Code, and Dotnet core for MacOS Install MSYS2, VS Code, and Dotnet core for Windows Note: You can skip these steps on Deakin lab computers as the software is installed. Remember on Windows that you need to use mingw64.exe provided by MSYS2 to access your terminal. 2. If you don't already have one, make a directory (i.e., a folder) to store your code (e.g., Documents/Code). On a Deakin computer you will need to use one of the following locations: /c/SIT/Scratch or /h/My\ Documents/Code . (Note the backslash \ before the space between My and Documents ). Navigate to your Documents directory in Finder or File Explorer Right click in the Documents directory and select New Folder, name it Code Figure: Windows explorer showing code folder in Documents Feel free to place this somewhere else on your computer if you want, but please avoid using spaces in the names of any of the folders. Spaces in names will make it hard to interact with from the Terminal as the terminal uses spaces to separate different parts of its commands. 3. Open your Terminal (Using the Mingw app for Windows) Setting up the Project http://www.splashkit.io/articles/installation/ubuntu/ http://www.splashkit.io/articles/installation/mac/ http://www.splashkit.io/articles/installation/windows/ Now we have a folder in place we need to switch to the Terminal to proceed. The Terminal is a program that gives you a command line interface to the computer. You type commands in, press enter, and the Terminal's shell interprets the text you type and performs the actions you requested. Using the terminal and writing programs have many similarities, which makes the Terminal very useful for software developers. As a result there are many advanced programming tools that you can use from the Terminal. For the moment we will stick to the basics, but once you get started there is so much more you can do with this tool. 4. Navigate to your new folder using the cd command. Within the terminal, your actions are centred upon a working directory. This then gives you easy and ready access to the files and other folders/directories that are located within the working directory. So, typically the first task you need to do is change the working directory. In this case we need to change into the Code directory you created in your Documents folder. For example, on Windows this would be something like this, to cd into a folder on my C: drive in Users/andrew/Documents . cd /c/Users/andrew/Documents/Code For Mac and Linux, its a little easier as it includes a ~ shortcut to get to your home directory: cd ~/Documents/Code Your terminal is now using this as your working directory. You can check this using the pwd command which asks for the "present working directory". pwd Once you are in the right directory we can create a folder for the project and then initialise this with a new dotnet project. File and folder names are case sensitive, so make sure you type this in carefully: Code and code are two different names! 1. Create a folder and initialise your Hello World program: You can create a directory from the command line using the mkdir command. To create a HelloWorld directory/folder within the Code folder you can just run mkdir HelloWorld as the terminal is currently in the Code folder. mkdir HelloWorld If this doesn't work then check your installation steps, and ask for help on the discussion board. You need to get things working as quickly as possible, so get on to this ASAP. 2. Now change into that directory by typing cd He then hit the tab key to auto-complete the folder name. Making use of this awesome feature will help save typing and make you more productive. The command will be cd HelloWorld . Hit enter to run the command. Like with the mkdir command above, this is relative to the current working directory. So this will move into the HelloWorld folder in the Code folder, etc. File and folder names are relative to the current directory if they do not start with a tilde (~) or a forward slash (/). In these contexts, ~ represents your home directory and / represents the root (start) of the file system. Both . and .. are also special identifiers, . represents the current directory and .. represents the parent of the current directory. So if you ran cd .. when you are in the Code directory, it would take you back to the Documents. Run the following command to move into the HelloWorld folder, if you haven't done so already. cd HelloWorld 3. To setup the project run the following commands in the terminal: skm dotnet new console skm dotnet restore This will initialise the project, and restore the project settings. You use new to create a project, and restore if you have the project but need to restore its settings (such as when you create a new project or copy a project from someone else). Run the following command to see the list of files that these commands created: ls -lha The -lha tells the ls (list) command to print the names in a list ( -l ) in human readable format ( -h ) and to show all files ( -a ). You should see a lib folder, a Program.cs file as well as the project files. 1. Open Visual Studio Code and within it open your HelloWorld folder. The File menu should allow you to Open Folder... on Windows, or just Open on Mac and Linux. You can then use a standard dialog to navigate to and select your HelloWorld folder. You should see something like the following when this works. You can open the Program.cs file by double clicking it in the list on the left. On Mac and Linux you should just be able to run " code . " and VS Code will open with the current folder (which is " . " in the terminal). 2. Update the code to include the statements that will write hello world to the terminal. The code is shown below. using System; using SplashKitSDK; public class Program { public static void Main() { Console.WriteLine("Hello World"); } } Like the file and folder names in the Terminal, C# is case sensitive. So take care when typing this in. For example, if you call type main instead of Main it wont work. This can be a bit of a pain when you get stared, but with care you will be fine. Writing the Code Beware Watch out! Copying code from a PDF and pasting it into your own program may result in invalid characters that wont be processed when you upload to OnTrack. Please type these in yourself. This will help you learn, as you want to know how to do this yourself. 3. Save the Program.cs file. That's it. If you have typed this in correctly you have the code for your first program! Notice the color highlighting in the editor, this is known as syntax highlighting. Code editors use knowledge of the rules of the programming language (their syntax) to color different words based on their meaning in the language. These highlights help you visualise the structure of your program, and make sure that you don't have small typos in key words. Now that you have the code, you need to get it into a format that the computer can use. There are many different tools that can be used to achieve this, but they can be generally categorised as either interpreters or compilers. An interpreter will read the programs code and then give the computer the instructions it needs to carry out the requested action as it goes. A compiler will read all of the program's code and then save the instructions for the computer into a separate executable file. When comparing compilers and interpreters, each has their own advantages and disadvantages. In general interpreters offer greater flexibility and can simplify the programming process, but are slower as they need to interpret the code as the program runs. In contrast, compilers are able to generate efficient code but are generally less dynamic. The C# programming language uses a combined approach with both a compiler and interpreter (known as a runtime in this case). The C# compiler reads your code and produces intermediate code (IL) that it stores in a separate file. This file is then executable by the .NET runtime. Compiling the Program 1. Switch back to your Terminal, or open it again and cd back into your project's folder. 2. Check you are in the right current directory. You can
Jul 27, 2020SIT771Deakin University
SOLUTION.PDF

Get Answer To This Question

Related Questions & Answers

More Questions »

Submit New Assignment

Copy and Paste Your Assignment Here