COS10009 Lab 1.pdf - Swinburne University of Technology Sarawak COS10009 Introduction to Programming \u2013 Semester 2 2020 Pass Tasks Submission Date 18th

COS10009 Lab 1.pdf - Swinburne University of Technology...

This preview shows page 1 - 3 out of 6 pages.

Swinburne University of Technology Sarawak COS10009 Introduction to Programming Semester 2 / 2020 Pass Tasks Submission Date : 18 th September 2020 (Friday) Standard Input / Output, Variable (Lab 01) Pass Task 1.1 : Hello World Task : Create your own Hello World program using the command line interpreter. This will help to ensure that you have all of the software installed correctly, and are ready to move on with creating other programs. To Do : 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. 1. If using a laptop, install the tools you need to get started for your operating system. Install Atom, SublimeText, VS Code, Notepad++ or equivalent (or use any text editor of your choice). S ee the “ Tools that you need ” notes i n Canvas to install Ruby. 2. Open your text editor, and create a new file. 3. Enter a Ruby statement to print Hello World. It should appear as below: 4. Save the file as hello_world.rb in your code directory. 5. Open a Terminal for command prompt (or a CMD shell in Windows), then perform the following commands: ■ Change into the directory containing your code using the cd command. ■ List the files in this director y using the ls command ■ Run your program by typing ruby hello_world.rb Tip: Bash commands (e.g., cd, ls, pwd) do not like spaces in directory or file names (e.g., My Documents, or hello world.rb). If you have a space in the name of something you may need to add in a reverse slash: My\ Documents and hello_world.rb Avoid spaces in the names of your files and folders!
6. Add another output statement to print a customised message / characters of your choice.

  • Left Quote Icon

    Student Picture

  • Left Quote Icon

    Student Picture

  • Left Quote Icon

    Student Picture