Starter activity – 10mins

Slides:



Advertisements
Similar presentations
CS0007: Introduction to Computer Programming Console Output, Variables, Literals, and Introduction to Type.
Advertisements

 2005 Pearson Education, Inc. All rights reserved Introduction.
1 Chapter 2 Introduction to Java Applications Introduction Java application programming Display ____________________ Obtain information from the.
1 Java Basics. 2 Compiling A “compiler” is a program that translates from one language to another Typically from easy-to-read to fast-to-run e.g. from.
1 The First Step Learning objectives write Java programs that display text on the screen. distinguish between the eight built-in scalar types of Java;
1. 2 Chapter 1 Introduction to Computers, Programs, and Java.
PYTHON: LESSON 1 Catherine and Annie. WHAT IS PYTHON ANYWAY?  Python is a programming language.  But what’s a programming language?  It’s a language.
Lesson 4 Computer Software
Introduction to Java Appendix A. Appendix A: Introduction to Java2 Chapter Objectives To understand the essentials of object-oriented programming in Java.
COMP 110: Introduction to Programming Tyler Johnson January 14, 2009 MWF 11:00AM-12:15PM Sitterson 014.
Introduction to Python
CS107 Introduction to Computer Science Java Basics.
CS 11 java track: lecture 1 Administrivia need a CS cluster account cgi-bin/sysadmin/account_request.cgi need to know UNIX
© 2012 Pearson Education, Inc. All rights reserved. 1-1 Why Java? Needed program portability – Program written in a language that would run on various.
Programming Concept Chapter I Introduction to Java Programming.
Java means Coffee Java Coffee Beans The name “JAVA” was taken from a cup of coffee.
CHAPTER 3 GC Java Fundamentals. 2 BASICS OF JAVA ENVIRONMENT  The environment  The language  Java applications programming Interface API  Various.
Windows, Linux, Mac, Android, iOS
Core Java Introduction Byju Veedu Ness Technologies httpdownload.oracle.com/javase/tutorial/getStarted/intro/definition.html.
1 Basic Java Constructs and Data Types – Nuts and Bolts Looking into Specific Differences and Enhancements in Java compared to C.
A Simple Java Program //This program prints Welcome to Java! public class Welcome { public static void main(String[] args) { public static void main(String[]
Introduction to Python Dr. José M. Reyes Álamo. 2 Three Rules of Programming Rule 1: Think before you program Rule 2: A program is a human-readable set.
© 2012 Pearson Education, Inc. All rights reserved types of Java programs Application – Stand-alone program (run without a web browser) – Relaxed.
COP 2551 Introduction to Object Oriented Programming with Java Topics –Introduction to the Java language –Code Commenting –Java Program Structure –Identifiers.
ITP 109 Week 2 Trina Gregory Introduction to Java.
CS0007: Introduction to Computer Programming Primitive Data Types and Arithmetic Operations.
Intro to Programming STARS College of Communication and Information Florida State University Written by: Hannah Brock Alissa Ovalle Nicolaus Lopez Martin.
SESSION 1 Introduction in Java. Objectives Introduce classes and objects Starting with Java Introduce JDK Writing a simple Java program Using comments.
 It is a pure oops language and a high level language.  It was developed at sun microsystems by James Gosling.
Foundations of Programming: Java
Unit 20 – Computer Game Platforms & Technology – Software Technology
Basic concepts of C++ Presented by Prof. Satyajit De
Introduction to Java Import Scanner class to use in our program
Development Environment
Lecture 2 D&D Chapter 2 & Intro to Eclipse IDE Date.
Topics Introduction Hardware and Software How Computers Store Data
GC101 Introduction to computer and program
Chapter No. : 1 Introduction to Java.
Chapter 3 GC 101 Java Fundamentals.
Console Output, Variables, Literals, and Introduction to Type
CSE 190D, Winter 2013 Building Java Programs Chapter 1
Internet and Java Foundations, Programming and Practice
Objectives Identify the built-in data types in C++
Variables, Expressions, and IO
Java programming lecture one
Unit 20 – Computer Game Platforms & Technology – Software Technology
INPUT STATEMENTS GC 201.
Control Statement Examples
Chapter 1 Introduction to Computers, Programs, and Java
IDENTIFIERS CSC 111.
I/O in C Lecture 6 Winter Quarter Engineering H192 Winter 2005
Introduction to CS Your First C Programs
Games Engines and Intro to Programming
How to Run a Java Program
CS-0401 INTERMEDIATE PROGRAMMING USING JAVA
Unit 20 Software Part 2.
Chapter 1: Computer Systems
Escape sequences: Practice using the escape sequences on the code below to see what happens. Try this next code to help you understand the last two sequences.
MSIS 655 Advanced Business Applications Programming
IFS410 Advanced Analysis and Design
Unit 20 Software Part 2.
Units with – James tedder
Units with – James tedder
Unit 20 – Computer Game Platforms & Technology – Software Technology
Introduction to Programming with Python
Focus of the Course Object-Oriented Software Development
Let’s start from the beginning
Chapter 1: Programming Basics, Python History and Program Components
Unit 3: Variables in Java
IS 135 Business Programming
Presentation transcript:

Starter activity – 10mins Your code should look like this: Starter activity – 10mins package helloworld; class HelloWorld { public static void main(String[] args) { System.out.println("Hello world!"); } Using the windows start menu Open NetBeans Select File > New Project Select Java Application > Click Next Give the project the name “HelloWorld” > Click Finish Enter the code above and complete the Exercise 1 on the sheet - Writing your first java program

1. 2 Try this: Change the text "Hello World 1.2 Try this: Change the text "Hello World!" to say the same in French (Use google translate). Re-compile, run and see what happens.

1.2 Try this: Change the text "Hello World!" to say the same in French (Use google translate). Re-compile, run and see what happens.

Unit 20 Computer game platforms & technology – What’s left? P3M3D3 Understand software technologies for game platforms Platform dependency, operating systems, game engines and languages for games and graphical API’s P4M4D4 Be able to connect and configure platforms and devices to enable gameplay Connect and configure: Gaming devices such as consoles and PC’s including internet access. Set up PC device drivers (graphics card, sound card, network interface controller) Install and configure games: Produce evidence of this taking place. Via checklists, photographs, video, portfolio , blogs.

Unit 20 – Computer Game Platforms & Technology – Software Technology Platform dependency: dependent; independent Operating systems: for PC/Macintosh, eg Windows, Linux, Mac OS; for hand held, eg Windows CE, Palm OS; for mobile, eg Symbian OS (Nokia N-Gage), BREW, Mophun Drivers: soundcard driver; graphics card driver; network interface controller (NIC) Application software: interpreted languages for games (Java, J2ME, C#); compiled languages for games (C++); object-oriented (C++, C#, Java, J2SE, J2ME); scripting, eg Lingo, UnrealScript, QuakeC, Maya Embedded Language, ActionScript, JavaScript Graphical API: OpenGL; OpenGL ES; DirectX Sound API: OpenAL; Java Sound API Television: conditional access; iTV; ETV Unit 20 – Computer Game Platforms & Technology – Software Technology

Lesson Aims Learning outcomes Introduction to understanding software technologies for game platforms Investigate one application software used to develop games Learning outcomes Know of some of the different application software used to develop games Understand the differences between compiled and interpreted languages Be able to create and understand basic Java syntax and vocabulary Be able to write a basic Java program

Application software for games: Game Engines: Gamemaker, Unity and Unreal etc Languages for games Hybrid languages: Java, Python, C# Compiled languages: C, C++ Interpreted languages: PHP, JavaScript Game Engines and programming languages are intrinsically linked Examples of software/languages we can use to make games W

What is a programming language A special computing based language that programmers use to develop software programs, scripts, instructions and games for computers and consoles to execute. Like all the spoken languages throughout the world there are many different programming languages

Focus today - Java We’re going to look briefly at the different languages and engines we can use to make games over the next few weeks. Today Java We will also look at C++ Java is especially popular for mobile gaming particularly on android devices. Most Play Store app’s are built using it. Java is NOT the same as javascript Android uses the syntax and structure to Java but is compiled differently using googles own interpreter and compiler. Shares similarity's to C# which is used by Unity

Java Program Structure In the Java programming language: A program is made up of one or more classes A class contains one or more methods A method contains program statements A Java application always contains a method called main main is the first method called when a Java application starts

Java Program Structure // comments about the class public class MyProgram { } class header class body Comments can be placed almost anywhere

Java Program Structure // comments about the class public class MyProgram { } // comments about the method public static void main (String[] args) { } method header method body

Variables A variable in programming is a useful container which a value can be stored in and used within the program. The stored value can then be changed (vary) throughout the program as it executes its instructions. A variable is created by writing a variable declaration in the program specifying the type of data that the variable can contain.

2. 1 Try this: Enter the following code 2.1 Try this: Enter the following code. This code will create a variable and then modify it while outputting both values:   class FirstVariable { public static void main(String[] args) { String message = "Initial value"; System.out.println( message ); message = "Modified value"; }

3. Data Types The most frequently used data types when declaring a variable are shown below: Data type: Description: Example: char A single Unicode character 'a' String Any number of Unicode characters "This is my String" Int An integer number, between -2.14 billion and + 2.14 billion 1000 float A floating-point number, with a decimal point 3.14159265f boolean A logical value of either true or false true Try this 3.1: Let’s create a program that creates, initializes and outputs variables of all the common data types

4. Creating constants Constants allow you to declare a variable that cannot be changed. Using the modifier "final" keyword before a data type lets the program know that no further changes are allowed. Convention dictates that we use capital letters when declaring constants. Try this 4.1 Using the code on the sheet let’s create a program that uses Constants Try this 4.2 Add a statement that attempts to change the value of a constant, recompile and see what happens.

After break exercise – 10mins What language do the following use: Gamemaker Unity Unreal Engine Android SDK IOS SDK

5.1 Try this: Add comments to your constants program It is good practice when coding to leave comments to explain each section of your code. This helps yourself and other people to understand your code. If you'd like to display code over multiple lines use /* and */ writing your comments in-between. If you'd like to create a single line comment then start with //. Comments are completely ignored by the compiler. 5.1 Try this: Add comments to your constants program

6. Exercises - A

6. Exercises - B

6. Exercises - C

After break exercise – 10mins What language do the following use: Gamemaker: Unity: Unreal Engine: Android SDK: IOS SDK:

Application software: Game Engines: Gamemaker, Unity and Unreal Hybrid languages: Java, Python, C# Compiled languages: C, C++ Interpreted languages: PHP, JavaScript

What are…. Compiled vs Interpreted languages A compiled language is when a person writes the code the compiler separates the file and the end result is an executable file. Basically, owner keeps the source code. Interpreted languages are different because the code is not compiled first hand. Instead, a copy is given to another machine and that machine interprets it. An example is JavaScript (which is used everywhere online). Code Compile Code Run Compiled Code Code Run code

interpreted languages for games (PHP, JavaScript); Read and processed by another program(Interpreter). Runs on the fly. Does not need to be compiled first. Not turned into Machine code. Language must be installed on any machine that needs to run the script. Will run more slowly than compiled code because it has to actively perform the step of turning the code into something the machine can handle on the fly. With interpreted code you open the program, change it and it is ready to go.

Example interpreted Python code CODE: print ("hello world") TO RUN: python helloworld.py This would display the words “Hello World”. Simply runs without compiling. Code stored in file ending in .py Using compatible software Run code/file

compiled languages for games (C, C++); Compiled code runs faster than interpreted code. It is not worked out on the fly.  Compiling converts the code to machine code/binary It is checked for errors whilst it is being compiled. Errors are then reported and can be fixed before re-compiling. A C program compiled on a windows computer cannot be copied to a Linux computer and run. You would have to compile the program again using a C compiler on a Linux computer.

Example of Compiled Code This would display the words “Hello World”. Will not work without compiling first. Compiling turns the C code into machine code. CODE: #include <stdio.h> int main() {         printf("Hello World"); } COMPILE: gcc helloworld.c -o hello RUN: ./hello Code Compile Code Run Compiled Code

Compiled code is turned to Machine code/Binary

7. Java - Accepting Input from a User One of the strengths of Java is the huge libraries of code available to you. This is code that has been written to do specific jobs. All you need to do is to reference which library you want to use, and then call a method into action. One really useful class that handles input from a user is called the Scanner class. Try this: Input the code provided using the scanner class

8 Scanner Exercise 1 Change the program so that it also adds the users’ age. Use the following steps: Create an int variable called “Age”. Ask for the users age Use the code age = keyboard.nextInt(); to get the int value. Output the users Name and Age on the same line

8 Scanner Exercise 2 Create a new program and ask the user for their name. Then display their name to prove that you can recall it. Ask them for their age. Then display that. Finally, ask them for how much they earn and display that. You should use the most appropriate data type for each variable

8 Scanner Exercise 3 Create a new program and ask the user for several pieces of information, and display them on the screen afterward as a summary. First name Last name Date of birth Current Qualification Student id number You must use the most appropriate type for each variable and not just Strings for everything.

What we’ve learned – End of lesson Discussed the remainder of the unit Gained an understanding of what application software for games are. Learned of different ways of making video games Learned the difference between interpreted and compiled languages Learned the basic syntax and the vocabulary of Java You’re able to write basic Java programs

Next week Continuing our investigation into programming languages and software