Presentation on theme: "COSC 1323.01 Dr. John Camden TR 11:00 Syllabus COSC 1323 Concepts I Class protocol (what is a protocol?) Homework each week. Due before class starts on."— Presentation transcript:
COSC 1323.01 Dr. John Camden TR 11:00 Syllabus COSC 1323 Concepts I Class protocol (what is a protocol?) Homework each week. Due before class starts on Thursdays Syllabus COSC 1123 Concepts I Lab Advanced Computing Lab JBWS 166 Labs due each Friday by the end of the day. Turn labs in to Dr. Camden or JBWS 273 box Note: do not turn in to Dr. Baker (she will lose it!) Class Website Schedule faculty.stedwards.edu/johnc Reference – All class notes Reference – Java Lecture Notes - Kjell Notes are intended as outline of class lectures. Not comprehensive.
What is a ‘computer program’? What is a foreign language? Why learn it? Communicate Express fact, idea, request, … CA What is a Computing Appliance? (CA) How do you get a CA to accomplish something for you? Computing Appliance
What is a ‘computer program’? What is a foreign language? Why learn it? Communicate Express fact, idea, request, … CA What is a Computing Appliance? (CA) How do you get a CA to accomplish something for you? Computing Appliance Desktop, Laptop, ipad, smart phone, swipe card system, …
CA Our ability to communicate ideas and thoughts is critical to our success --- In order to communicate, what do we need? (communicate to what?, who? … Examples of communication tools recipes Computing Appliance Server, database system, web site
To get a CA to accomplish a task – What is the ‘task’ that you need done? Actually, this is the hard part – articulating what a task is and how to accomplish it. This is what our class is about. We want to be able to know the task to be accomplished and to be able to articulate this in a manner that everyone in the world can understand our plan without any ambiguity.
Vocabulary Algorithm Logical expression Source Code CA (Computing Appliance) C++, Fortran, Xcode, Objective-C, java, SQL Articulating an algorithm – flowchart, pseudocode Flowchart symbols, example or 2 or 3 See Schedule references Flowcharts are a critical, important piece of our class. Flowcharts by hand are great, diagramming software is available (see Schedule reference) but not for 1323. Goal – get better and better at articulating ideas.
How us humans interact with CAs Graphical User Interface (GUI) Command Line Interface (CLI) Using CLI, we must know how to type a specific command on a prompt line. There ain’t no icon to click. We will be using CLI to communicate with the ACL CA for a few weeks exclusively, then part time. An Integrated Development Environment (IDE) is a software package that provides a myriad of tools to assist in software development. Stay tuned.
Computer Systems Nodes, servers, communication Computer Science Computer System – completely separate from the Administrative System (Edweb / Edshare) ACL server: cn01.cs.stedwards.edu Example: Username: khyde Password: xp13wn (how do I get ‘logged in’ to work?) How do I change my password? passwd command What is my ‘home’ directory? Path name: /seu/cs/home/user/k/khyde
Computer programming – writing instructions (algorithm) for the CA to follow. Instructions are saved in a file (called source code). We will be writing using the language java. As with any language, lots of specific syntax rules. The source code file / document is scrutinized for violations of the java syntax rules by a java compiler. Example – submit an English paper. What/who checks what? If there are no errors, this is called a ‘clean compile’ and the compiler automatically creates a file, a byte code file, with extension.class So: Program seu01.java is compiled ( use javac seu01.java ) on the command line. If the file has errors, you must go back and fix the errors and compile again. If no errors, run the program (use java seu01 ) * Note what the file extensions are (or aren’t) *
Three types of errors in computer programming Compute the area of a circle: area = 2* r*r*r (2 times r cubed) Logic error ------------ Jill said hi to Bill and I. Syntax error (actually not java but you get the drift – violated a rule) ------------- Compute 12 / 0 Run-time error (why?) --------------- Syntax error Logic error Run-time error Who catches these?
java reserved words and variable names “Building our workbench” If we want to add 2 numbers, we want to reserve some space in memory to store them and we want to give them a name. Also, we need a name for the sum. We can make up any name we want – except we have to play by the rules. Oh man – more rules… a) Java reserves some words for itself. Examples: public, or, if, … b) Our names must begin with a letter, contain no imbedded special characters, including a space (actually you can use _ in a name) Get 100! Pick the valid java user-declared variable names: num1, myNum, your number, 13ElmStreet, for, r2d2, jlo, halo, fire, fire!, what?, squareLength, st.edwards,
This is how all our logic flow diagrams (flowcharts) will start in our class. We’ll call this our ‘workbench’. We need to get everything prepared before we start baking cookies. Or in this case, compute the sum of 2 numbers. Start num1 num2 sum CA memory num1 Nnnum2 sum
Output to the screen / console / terminal / panel (a rose by any other name …) System.out.println(“Hi”); java statement prints: Hi System.out.println(“Go for it!”); prints: Go for it! System.out.println(“Hello “ + “Bill”); prints: Hello Bill Command Line Interface (CLI) Graphical User Interface (GUI)
Some instructions to accomplish a task: The variable n1 starts with the value 10. The variable n2 starts with the value 2. The variable n3 starts with the value 4. Store the value of n1 times n2 in n1. Store the value of n2 times n3 in n3. Add n1 and n3, and store the result in n2. Display the value in n2 on the screen. We will do a Hand Trace and Output and memory space reservation (Board work)
Lab 1 / Homework 1 Sample flowchart pseudocode Write the steps to compute the distance traveled by a car averaging 40 miles per hour that traveled 51 minutes. Note: reserve a space on your desk to remember things. That space may be volatile, but use it while you need it. Flowchart Pseudocode Start Reserve space for speed, distance, time Compute distance = speed * time (hey – is 51 minutes.51??) Write “The distance traveled was “ + distance Hey - I thought + was the addition operator! concatenation – don’t misspell it on the first test
COSC 1123 What is Lab 1 about? What do I do? Turn in? where? Handout of Lab 1putty/secureSSH Go through each step Connect to ACL cn01.cs.stedwads.edu Client(node) In a terminal session: ssh email@example.com Username: yourSEUuserid Password: xp13wn Create a new directory: mkdir cosc1123 Change to that directory: cd cosc1123 Create a new file: emacs seu01.java emacs is an editor
User-defined variable names (see page 873 for keywords) Data types 6 a hello2.7 8283 integer character String floating point integer In java 6 ‘a’ “hello” 2.7 8283 int,short,long char String double, float int, short, long Declaring a variable int score = 0; double gpa = 2.8; String fname = “Jill”; String greeting = “What’s up?”; score = 85;
Probably Thursday To obtain user input from the terminal: 1 import java.util.Scanner; 2 Scanner console = new Scanner(System.in); 3 gpa = console.nextDouble ( ); Example: (after having 1 and 2 in your program): double gpa = 0; System.out.print (“Please enter your gpa: “); gpa = console.nextDouble( ): get gpa
Class Quiz Day 1 What must be done to a recipe for sugar cookies written in French in order for me to make sugar cookies? You can make up words to be used in your programs. But some words are “reserved” in the java language. What does that mean? What is a CA? T/F __ Late homework is accepted. __ Late labs are accepted. __ Main memory in a CA is volatile __ We have labs and HW due every week
Handout - seu00.java
Let’s login to the ACL computer system Handout – lab 1 Handout - seu00.java
Class Exercise – log in to the ACL computing system Here we go – Slide your chair over to a CA and 1.Login to the administrative system using your username and password. Remember it is separate from our CS Computer System. 2. Open a terminal (lower right) – new window 3. ssh firstname.lastname@example.org press enter 4. password: xp13wn You are now “in your home directory” 5. make a subdirectory named cosc1123 mkdir cosc1123 Change back and forth between your home directory and cosc1123 (use the cd command)
Class Exercise Page 2 get in to your cosc1123 directory (you can be sure you are there using the pwd command) Let’s create a document named seu01.java emacs seu01.java You will get a blank page. Type in // seu01.java – the start of my first program And so on Now save this document: use ctl-x ctl-s (Control x, Control s) Now exit the document: use ctl-x ctl-c (Control x, Control c) Now list the files in the cosc1123 directory: use ls or ls -o Exit the system: use exit Exit the terminal session: exit