1 / 22

COSC 1323.01 Dr. John Camden TR 12:30

COSC 1323.01 Dr. John Camden TR 12:30

neka
Download Presentation

COSC 1323.01 Dr. John Camden TR 12:30

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. COSC 1323.01 Dr. John Camden TR 12:30 Syllabus COSC 1323 Concepts IClass protocol (what is a protocol?)Homework each week. Due before class starts on ThursdaysSyllabus COSC 1123 Concepts I Lab Advanced Computing Lab JBWS 166Labs 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 Notes are intended as outline of class lectures. Not comprehensive.

  2. What is a ‘computer program’? What is a foreign language?Why learn it? CommunicateExpress fact, idea, request, … CA What is a Computing Appliance? (CA) How do you get a CA to accomplish something for you? Computing Appliance

  3. What is a ‘computer program’? What is a foreign language?Why learn it? CommunicateExpress 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, …

  4. 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

  5. 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.

  6. 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 referencesFlowcharts are a critical, important piece of our class. Flowcharts by hand are great, diagramming software is available (see Schedule reference).

  7. Computer Systems Nodes, servers, communicationComputer 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

  8. 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) *

  9. 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 errorLogic error Run-time error Who catches these?

  10. 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 ,

  11. 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 Nn num2 sum

  12. 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)

  13. 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)

  14. 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

  15. COSC 1123What is Lab 1 about? What do I do? Turn in? where? Handout of Lab 1 putty/secureSSH Go through each step Connect to ACL cn01.cs.stedwads.edu Client (node) In a terminal session: ssh user@cn01.cs.stedwards.edu Username: yourSEUuseridPassword: xp13wn Create a new directory: mkdir cosc1123 Change to that directory: cd cosc1123 Create a new file: emacs seu01.java emacs is an editor

  16. User-defined variable names (see page 873 for keywords) Data types 6 a hello 2.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;

  17. Probably Thursday To obtain user input from the terminal: • import java.util.Scanner; • Scanner console = new Scanner(System.in); • 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

  18. 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

  19. Handout - seu00.java

  20. Let’s login to the ACL computer system Handout – lab 1 Handout - seu00.java

  21. Class Exercise (We will pretend – stay put and I’ll go through for a student – we changed classrooms and don’t have CAs to user 8/26)Here we go – Slide your chair over to a CA and 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 user@cn01.cs.stedwards.edu 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)

  22. Class Exercise Page 2get in to your cosc1123 dirctory(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

More Related