Tutorial 6 Assignment 2. If using C gcc is most likely installed by default. Otherwise, you need to install it Submit your source code file with extension.c.

Slides:



Advertisements
Similar presentations
Dynamic Code Generation in Java. Class Loading Class loading is the process of transforming a byte code (e.g., a.class file) into a Java class A Java.
Advertisements

Classes  All code in a Java program is part of a class  A class has two purposes  Provide functions to do work for the programmer  Represent data.
Java Exception Very slightly modified from K.P. Chow University of Hong Kong (some slides from S.M. Yiu)
Exceptions Any number of exceptional circumstances may arise during program execution that cause trouble import java.io.*; class IOExample { public static.
Week 1 basic Python programs, defining functions Special thanks to Scott Shawcroft, Ryan Tucker, and Paul Beck for their work on these slides. Except where.
CS Lecture 03 Outline Sed and awk from previous lecture Writing simple bash script Assignment 1 discussion 1CS 311 Operating SystemsLecture 03.
Java Programming (Chapter 1). Java Programming Classes, Types, and Objects.
Dynamic Code Generation in Java. Class Loading Class loading is the process of transforming a byte code (e.g., a.class file) into a Java class A Java.
Java Intro. A First Java Program //The Hello, World! program in Java public class Hello { public static void main(String[] args) { System.out.println("Hello,
Week 1 basic Python programs, defining functions Special thanks to Scott Shawcroft, Ryan Tucker, and Paul Beck for their work on these slides. Except where.
Scripting Languages CS 351 – Programming Paradigms.
Java Review 2. The Agenda The following topics were highlighted to me as issues: –File IO (Rem) –Wrappers (Rem) –Interfaces (Rem) –Asymptotic Notation.
The switch statement: an N-way selection statement.
Saravanan.G.
Shorthand operators.
“Introduction to Programming With Java”
Georgia Institute of Technology Speed part 3 Barb Ericson Georgia Institute of Technology May 2006.
8 Shell Programming Mauro Jaskelioff. Introduction Environment variables –How to use and assign them –Your PATH variable Introduction to shell programming.
Chapter 5 Bourne Shells Scripts By C. Shing ITEC Dept Radford University.
Welcome to the Lecture Series on “Introduction to Programming With Java”
CSI 1390: Introduction to Computers TA: Tapu Kumar Ghose Office: STE 5014
Chapter 5: Preparing Java Programs 1 Chapter 5 Preparing Java Programs.
Boolean expressions, part 2: Logical operators. Previously discussed Recall that there are 2 types of operators that return a boolean result (true or.
1 Recitation 8. 2 Outline Goals of this recitation: 1.Learn about loading files 2.Learn about command line arguments 3.Review of Exceptions.
20 Oct - Overview Homework #1 Group-Id rule Notes on Java text file input/output –Scanner class –Printf (like C)
Unit 1: Java and Eclipse The Eclipse Development Environment.
BUILD ON THE POLYGLOT COMPILER FRAMEWORK MIHAL BRUMBULLI 7th Workshop “SEERE” Montenegro-Risan 9-14 September 2007 SimJ Programming Language.
Programming Fundamentals 2: Simple/ F II Objectives – –give some simple examples of Java applications and one applet 2. Simple Java.
Unix Environment Input Output 2  List Content (ls) ◦ ls (list current directory) ◦ ls –all (include hidden files/folders)  Make directory (mkdir) ◦
Week 1 basic Python programs, defining functions Special thanks to Scott Shawcroft, Ryan Tucker, and Paul Beck for their work on these slides. Except where.
5-Dec-15 Sequential Files and Streams. 2 File Handling. File Concept.
CS 4244: Internet Programming Network Programming in Java 1.0.
Overview of Java CSCI 392 Day One. Running C code vs Java code C Source Code C Compiler Object File (machine code) Library Files Linker Executable File.
Using the while-statement to process data files. General procedure to access a data file General procedure in computer programming to read data from a.
CSI 3125, Preliminaries, page 1 Compiling the Program.
Compiling and running Java programs with BlueJ. Successfully compiled files program files in BlueJ You can tell from the shade of a program icon in BlueJ.
Java FilesOops - Mistake Java lingoSyntax
Reading input from the console input. Java's console input The console is the terminal window that is running the Java program I.e., that's the terminal.
Exceptions. Exception  Abnormal event occurring during program execution  Examples Manipulate nonexistent files FileReader in = new FileReader("mumbers.txt“);
Introduction to array: why use arrays ?. Motivational example Problem: Write a program that reads in and stores away 5 double numbers After reading in.
1/10/2008. >>> About Us Paul Beck * Third quarter TA * Computer Engineering * Ryan Tucker * Second quarter TA * Computer.
3/5/2002e-business and Information Systems1 Java Java Java Virtual Machine (JVM) Java Application Program Interface (API) HW Kernel API Application Programs.
8/2/07. >>> About Me Scott Shawcroft * Junior * Computer Engineering * Third Quarter TA * Creative Commons Intern * Small-time Open Source Developer
Airlinecount CSCE 587 Spring Preliminary steps in the VM First: log in to vm Ex: ssh vm-hadoop-XX.cse.sc.edu -p222 Where: XX is the vm number assigned.
Computer Science I Lab 1 ISMAIL ABUMUHFOUZ | CS 180.
Introduction to java (class and object). Programming languages: –Easier to understand than CPU instructions –Needs to be translated for the CPU to understand.
CS210 Intermediate Computing with Data Structures (Java)
Introduction to programming in java
Lecture 11 bash scripting overview c programming overview moving data between c and bash memory and pointers.
basic Python programs, defining functions
Programming without BlueJ Week 12
CHAPTER 5 JAVA FILE INPUT/OUTPUT
Lecture Note Set 1 Thursday 12-May-05
CompSci 230 Software Construction
Testing and Exceptions
Going from C++ to Java Jayden Navarro.
Java Intro III.1 (Fr Feb 23).
basic Python programs, defining functions
Reading and Writing Text Files
L3. Necessary Java Programming Techniques
L3. Necessary Java Programming Techniques
Web Design & Development Lecture 7
Java Exception Very slightly modified from K.P. Chow
Java Intro.
Run Java file with Window cmd
Java Exception Very slightly modified from K.P. Chow
Lab 4: Introduction to Scripting
Exceptions.
F II 2. Simple Java Programs Objectives
Exceptions.
Presentation transcript:

Tutorial 6 Assignment 2

If using C gcc is most likely installed by default. Otherwise, you need to install it Submit your source code file with extension.c (A2com.c) Create a file and name it makefile (no extension) and submit it as well Put the following two lines in it A2com : A2com.c gcc -o A2com A2com.c N.B. you must indent this line with tab

If using C cont. To compile and run your code from your terminal, type: make chmod u+x A2com./A2com

If using C Running the “ls -l” command: – system(“ls -l”);

If using Java Install java Submit your source code file with extension.java (A2com.java) Create a file and name it makefile (no extension) and submit it as well Put the following two lines in it A2com.class: A2com.java javac A2com.java N.B. you must indent this line with tab

If using Java cont. Create and submit a shell script called A2com with NO extension which calls “java A2com” To compile and run your code from your terminal, type: make chmod u+x A2com./A2com

If using Java cont. If you have more than one source file, the makefile can be done like A2com.class: A2com.java A2comextra.java javac A2com.java A2comextra.java N.B. you must indent this line with tab

(ListOutput.java) program which demonstrates how to call the “ls -l” command from Java import java.io.*; public class ListOutput { public static void main(String[] args) throws IOException, InterruptedException { Runtime rt = Runtime.getRuntime(); Process p = rt.exec("ls -l"); p.waitFor(); BufferedReader lsOutput = new BufferedReader(new nputStreamReader(p.getInputStream())); String line; while ((line = lsOutput.readLine()) != null) { System.out.println(line); }

If using Ruby Install Ruby Either you submit your Ruby solution (A2com) with NO.rb extension and with #!/usr/bin/env ruby) as the first line in your code Or you submit your Ruby solution (A2com.rb), and a shell script called A2com with NO.rb extension which calls “ruby A2com.rb” To compile and run your code: chmod u+x A2com./A2com

If using Python Install Python3. You might already have it. Either you submit your Python solution (A2com) with NO.py extension and with (#!/usr/bin/env python3) as the first line in your code Or you submit your Python solution (A2com.py), and a shell script called A2com with NO.py extension which calls “python3 A2com.py” To compile and run your code: chmod u+x A2com./A2com

If using Python Running the “ls -l” command: – os.system(‘ls -l’)

If using Bash Most likely is installed by default Either you submit your Bash solution (A2com) with NO.sh extension and with #!/usr/bin/env bash) as the first line in your code Or you submit your Bash solution (A2com.sh), and a shell script called A2com with NO.sh extension which calls “bash A2com.sh” To compile and run your code: chmod u+x A2com./A2com

Testing Your work The program must accept commands typed at the terminal window It must also work correctly if the marker redirects input to the program from a file, e.g. make (if you have a makefile) chmod u+x A2com./A2com< test1.txt./A2com < test2.txt./A2com < test3.txt./A2com < test4.txt./A2com < test5.txt./A2com < test6.txt./A2com < testspaces.txt