[Solved] CSCI1300 Homework 0

$25

File Name: CSCI1300_Homework_0.zip
File Size: 178.98 KB

SKU: [Solved] CSCI1300 Homework 0 Category: Tag:
5/5 - (1 vote)

1. Objectives

  • Set up your Moodle account
  • Apply for an AWS educate account
  • Set up AWS Cloud 9 IDE
  • Set up VS code
  • Introduction to Linux
  • Submit a zip file with HelloWorld.cpp, HelloVSCode.cpp, and profile.txt to Moodle.

2.2 Set up AWS educate account and Cloud 9 IDE:

In recitation today, you will be getting started with AWS Cloud9, a cloud-based development environment, which is designed to provide a consistent development environment for all students. Follow the steps below. If you need help ask your TA or one of the CAs.

There are three phases for setting-up your AWS Cloud 9 IDE:

  1. Apply for an AWS Educate account
  2. Log-in to the student portal and go to the AWS classroom
  3. Set up AWS Cloud 9 workspace

You can find AWS cloud 9 set up guid e on Moodle

2.3 Upload a profile.txt to AWS Cloud 9 IDE:

You can find Profile.txt file found on the first Moodle topic (Introduction to Computers and Programming Topic 1) Download the profile.txt and upload it on your Cloud 9 workspace. Then, Insert your answers. Be sure to save your file!

  1. From the menu bar on the top, choose File -> Upload Local Files
  2. Then, drag and drop the file you want to upload.
  3. Insert your answer and save it.

2.4 Create a Hello World program:

The Hello, World! program is one of the simplest programs in a programming language, and it is often used to illustrate the basic syntax of a programming language.

  1. From the menu bar, choose File -> New From Template -> C++ File
  2. Save your file. Important: The filename should be named with CamelCase (the first letter of each word in a compound word is capitalized) end with .cpp. Your file name should be cpp
  3. Click Run button on the top. You will see the output at the bottom of the page. The last line means that the program ended successfully.
  4. Lets add a statement to use the standard namespace . Insert using namespace std; at the beginning of the code, then we can remove the std prefixes. Be sure to click Run button again to make sure that your code still compiles and runs.
  1. Lets modify the file to print Hello world! Hello CSCi 1300 . The text inside of the quotation marks is printed as it is. Its case sensitive too!

Congratulations! You did the 1st C++ programming!

You will learn more C++ syntax over the semester to build your programming and problem-solving skills. Here is a snapshot of your program.

2.5 Learn how to use Terminal:

Switch to the bash tab and lets learn some useful Linux commands.

You see: vocstartsoft:~/environment $

  • ~/ (i.e. everything else before the $ ) = your current directory (think of a directory as the folder youre in).
  • ~ is shorthand for the current users home directory.
  • $ represents the end of prompt for entering a command.

File browsing using the terminal is like using Windows explorer or like clicking on folders and navigating to different folders on your laptop. In the terminal, instead of clicking on folders we use commands to tell the computer what we want. If we want to go to a folder where we saved our last homework, we can type the commands to navigate to that folder and display its contents.

Try these commands:

ls list directory contents

ls = (thats a lowercase L, not an uppercase i) stands for list and is used to list or show you everything in the current directory.

Note: after you type the command and press ENTER, something is displayed as a result of the command, but then the prompt returns.

mkdir make directories

To create a new directory, use the command mkdir <my_folder>

Note: Spaces are troublesome on the command line, so well use underscores.

Lets create a directory for todays recitation, named rec2

$ mkdir rec2

rec2 is now a directory/folder, nested under the folder environment. If you want to list the contents of the folder environment, you will now notice a new item: rec2/, where the forward-slash (/) indicates rec2 is a subdirectory.

You will also notice a new folder in the Environment tab, to the left of your window:

cd Change the shell working directory.

cd = stands for change directory is just like changing folders. It means, take me to place X.

Commonly used as cd <name_of_directory>.

  • Note that there will always be a space between cd and the name of the directory that you want to navigate to and the name of the directory will not include the carrots (side arrows) displayed above.
  • Note: cd takes you places in reference to your current location. Its like going into a folder, and then clicking on a folder within that folder, and then clicking on another folder within that folder. You will always navigate deeper within that folder. To back up, we use cd .. (explained in a little bit).
  • Note: cd (and other commands) is case sensitive. rec2 does not equal Rec2. Make sure you type in directory names exactly as they are spelled.

cd .. means go to the parent of my current location. Its essentially backing up.

cp copy files

(Note: Be very careful not to overwrite a file when copying.)

  1. First, click inside the editor window, where the file cpp is open. Go up to the menu and choose File -> Save As and, when the dialog box opens, change the name of the file to hello1300.cpp. Choose rec2 as the destination folder.
  2. Once you click Save, the new file will appear in the file tree, in the Environment tab (see the figure on the right, above).
  3. Lets make another directory named rec1.
    1. $ mkdir rec1
  4. Now we want to copy the file from rec2 into rec1. First, we go into the rec2 directory:
    1. $ cd rec2
  5. Ok, now we use the command for copying files:
    1. $ cp hello1300.cpp hello1300v2.cpp
  6. Now lets type ls and see what we have:

Since we did not specify the path for the file we wanted to copy, nor for where we wanted it copied, we ended up with an identical copy of the file, both of them inside the folder rec2 .

  1. Lets do this again, including the paths:
  2. If your terminal window has gotten full, you can always clear it. Right-click anywhere in it, and choose Clear Buffer

mv move files

Its possible to move files around using the command mv. Starting in directory rec2, type:

$ mv hello1300.cpp ..

Remember, two dots indicate the parent directory (one level up). Now if we list the files in rec2, there is only hello1300v2.cpp left. And we will move the file hello1300.cpp up in the root directory:

Lets move one more file into the rec1 directory:

zip ( unzip ) package and compress (archive) files

An important thing to know for this class is how to zip your solution files into one assignment submission file. To do this, theres a convenient command called zip. Lets zip up the two files in the directory rec1 into a single zip file.

$ zip test_files.zip hello1300.cpp hello1300v3.cpp

The first argument is the name of the zip file we want to produce. The files listed next are the files that go into this zip file. If you list your directory now, you should see three files. Notice that the original files are still presentzip and unzip dont destroy any files.

Lets now move the .zip file into the rec2 directory, and try to unzip the files:

You should see the three files in the directory. Note that the original zip file didnt get destroyed.

Linux commands weve learned:

Here are the five useful Linux commands we just practiced:

  • ls: List directory contents. Use this command to see the list of files and folders in the current directory.
  • mkdir: Make directories. Create a new directory (folder).
  • cd: Change directory. Use this command to change the current directory (move to another folder)
  • cp: Copy a file
  • mv: Move a file
  • zip: Create a zip file

Fun tips and tricks

  • Tab Complete: if youre typing something in the command line thats very long, but unique, you can hit tab when youre partially through and it will try to fill in the rest (kind of like autocomplete). If it doesnt, and you tap tab twice, it tells you everything it has as options.
  • Command history browsing: if you have typed a command (e.g. gedittxt) and want to repeat it, just press the up arrow. It will bring up your last executed command. Pressing up again will go to the one before. Pressing down will go forward in time through the list.
  • ASCII is a character encoding standard. It includes numerical characters: 0-9, letters A-Z and a-z, punctuation, and blank spaces. These character codes represent text in computers. For example, the ASCII representation of D is 01000100, and the ASCII representation of d is 01100100. Notice the difference? D is different from d, therefore, it is important for you to always make sure that you have proper capitalization and spelling when you are typing from the command line.

Want to learn more about Linux commands?

http://community.linuxmint.com/tutorial/view/244 has a list of categorized Linux commands.

Codecademy also has a course covering the command line

(https://www.codecademy.com/learn/learn-the-command-lin e).

  • Setup for Visual Studio Code :

You also need to set up a development environment locally to make sure that you can write code without an internet. Also, in case Cloud 9 goes down for maintenance, you still need to work and complete assignments.

You can find the VS code set up guid e on Moodle. Follow the instructions and set up it locally.

Task3: Write a helloWorld in VS code as you did in section 2.4. Your program should print Hello CSCI1300 from VS code . Be sure that your code compiles and runs on both your machine and cloud 9. Your .cpp file should be named helloWorldVScode.cpp

  • Back up often:

Its a good idea to create a backup of your workspace. Backing up a file only takes a few seconds. You will hate yourself if you lose hours of work before the deadline. We recommend that you backup your work once every thirty minutes.

Cloud 9

In case, Cloud 9 goes down for maintenance unexpectedly be sure to have a backup. You can simply download an entire environment.

Your computer

Its also important to backup your computer in case your computer gets broken or your dog bites your laptop. You can use:

  • Dropbox
  • Google Drive
  • Github (be sure to use Private repository. You can get free private repository via GitHu b

Student Developer Pack)

Reviews

There are no reviews yet.

Only logged in customers who have purchased this product may leave a review.

Shopping Cart
[Solved] CSCI1300 Homework 0
$25