Download presentation
Presentation is loading. Please wait.
Published byEdmund O’Brien’ Modified over 6 years ago
1
AP Computer Science Welcome Start on slide 44 on 9/11
2
Why Computer Science? “The United States currently has more than 494,000 unfilled computing jobs, but only 43,000 computer science graduates to fill those jobs,” Kentucky Education Commissioner Stephen Pruitt , 2017
3
Mr. Smith’s Schedule 1st Period Computer Science I
2nd Period Computer Science I 3rd Period Prep 4th Period AP Computer Science/ Advanced Projects Lunch 5th Period Computer Science I (D131) 6th Period Prep 7th Period Robotics Programming 8th Period Robotics Projects
4
West High You are here. Main Gym Counselors Commons Attendance
Student Center
5
Wheel Factory For the product to be complete After Sprint
Must touch every person on the team Must be passed (air time) between team members Cannot be dropped Cannot pass it to the person next to you After Sprint Sprint Review: How many did you complete? Sprint Retrospective: What went well? What did not go well? What can be improved? Sprint Planning: How many can you complete in the next Sprint?
6
Agile Manifesto We are uncovering better ways of developing software by doing it and helping others do it. Through this work we have come to value: Individuals and interactions over processes and tools Working software over comprehensive documentation Customer collaboration over contract negotiation Responding to change over following a plan That is, while there is value in the items on the right, we value the items on the left more.
7
Seating Organize yourselves by Last Name
8
Computer Science I Today’s Schedule
Introductions Successful behaviors Log In Set up Folders/Shortcuts Finding your strengths Writing a program
9
Introductions You will introduce the people next to you Name Strength
Music Video Game Where would you like to live in the future?
10
Starting Salaries 2013 Forbes 2013
Here is a list of average starting salaries by discipline: Engineering $63,000 Computer Science $60,000 Business $54,000 Communications $43,000 Math & Sciences $42,700 Education $40,000 Humanities & Social Sciences $37,000 Forbes 2013
11
Successful Behavior Behavior/Discipline Plan:
Students are expected to be safe, responsible and respectful. Students not following these expectations may expect: verbal warnings, removal from class pending conference, parent contact, or referral to administration.
12
To be successful in this course:
Stay focused and productive in the classroom Excellent attendance Let your projects, daily work, quizzes and tests display your best effort Feel free to talk with me about your projects, questions, etc.
13
Computer Lab Rules No gum in class
No food or drink in the lab (except water with a lid at approved locations) No headphones or music except on days selected by teacher Absolutely no off-task Internet usage ( , games, chat, etc – anything other than class related) Absolutely no off-task Computer usage (ask teacher permission to use equipment for anything other than class assignments) Do NOT download any software (games, utilities, music, etc.) Do NOT use any “chat” software No CELL PHONE use in class without permission of Mr. Smith.
14
Materials Needed Each student will need a Composition Book, spiral or a tabbed off section in your three-ring binder for notes and handouts. Bring a pen or pencil with you everyday
15
Computer Science at West
Robotics Programming (RobotC) (One Semester) VEX Robotics/Engineering Computer Science I and II (Pascal) (One semester each) AP Computer Science (Java) (One year) Prepares students for the ‘A’ level exam Advanced Computer Projects (One semester, can be taken repeatedly) Developing original software Robotics Projects VEX Robotics Challenge (Mainly first semester) Spring tech conference (Second Semester)/FTC/VEX If we make the finals. Introduction to Engineering Design Design process 2 D and 3D design by hand 3D design on computer (Inventor)
16
Class Overview: First Semester
Basic I/O Math in Java Decision construct For loop Java Docs and Strings While Do..while* Random Arrays of Primitives Midterm More Arrays Sorting Intro to Objects Inheritance Intro to Gridworld More OOP ArrayList Class Intro to OSI Networking model Review and Final
17
Grading Policy Assignments Programs 10 points Quizzes: 25 points
Tests: 100 Points Projects: 20 to 100 points Final: 200 points or 20% of your grade, whichever is less. Grading Scale A .. 90%+ B – <90% C – <80% D – <70% F .. Below 60%
18
Time to Log-on User Name: Use the ‘ID Number ‘ from your schedule for your user name. Password: Use your student ID number, also on your schedule to the left of your name, with a ‘.’ after it for your password. You will be asked to change your password on the first time you log in.
19
Log in and Create Class Folder
Log onto the network Your log in number is on your student ID number Your password is your First Initial Last Initial Birthdate. Example Susie Kalahan 1/1/2002 sk112002 Jose Mahindra 10/15/2001 jm Open YourName Folder In to top left of the desktop Make a new folder called APJava Keep your APJava Folder open
20
Creating Shortcuts 2) Double Click on ‘APJava’ Folder
1) Double Click on SMITH_GREG-Shortcut
21
Drag and Drop into your ComputerScience1 Folder.
Drag and Drop Into Your APJava Folder Drop
22
Shortcut to Class Website
Click on ‘AP Computer Science’
23
Put Shortcut in your Folder
Drag and Drop
24
Syllabus At home print out the syllabus, have your parents sign it and turn it in.
25
Find the Class Website, Find your Strengths
Smithcsrobot.weebly.com Click on the Computer Science 1 Link Click on ‘Find Your Strengths’ When complete Turn in a Word Document that includes: Your Name Class Period Two + strengths Any questions you have at this point in time Anything that would help me teach you better.
26
Getting Started in BlueJ
Start with a capital letter. Open BlueJ Make a New Project (Folder) Create a new class (file) Welcome1
27
Delete info between the {} after the public class Welcome1
Fill in the Class Enter your name, brief description of the program, the date and version 1.0. Delete info between the {} after the public class Welcome1
28
Enter the following program in BlueJ.
First Program Enter the following program in BlueJ.
29
Compiling the Program Click Compile Check for errors.
30
Right click on the class.
Running the Program Right click on the class. Select void main() Click OK
31
Output Screen
32
Include your name in the file name
Turn in the .java file Rename the java file to YourNameWelcome1 and turn in to the turn in folder. Include your name in the file name
33
public class Welcome1 Begins the class definition of class Welcome1
Breaking down the code. Begins the class definition of class Welcome1 Every program must include the definition of at least one class. Class names begin with a capital letter The class name must match the file name (Welcome1.java) This is case sensitive The file must have a .java extension (BlueJ should do this for you.) Identifier rules //Series of characters (letters, numbers, digit, _, $ //Must not start with a number //Cannot be a reserved word (purple in editor) Must describe what it is storing! Java IS Case sensitive Get out your notes.
34
{ Same as BEGIN in Pascal
Marks the beginning of the main body of the class. Needs to match up with a } Indent between the {}
35
public static void main(String args[])
This is the starting point of every java application (Main body of the program) () after main indicate it is a method (Like a procedure) Java classes usually contain more than one method Exactly one of these methods must be called main and defined as above for the program to run. Methods perform tasks and return information. Kind of like functions void indicates that it will return nothing. String args[] is required for the main's definition. More details later.
36
System.out.println("Welcome to Java programming!");
System.out is the standard output object for showing info in the command window The stuff inside () are the arguments System.out.println(); Displays the arguments and returns to the next line Like writeln() in Pascal "Wel..." This is a String of characters, message or string literal.
37
Comments and Common Errors
When successfully compiled it creates a Class file for Welcome1 called Welcome1.class This file contains the byte codes that represent this application Some common errors "bad command or file name", "javac: command not found", ""'javac' is not recognized as an internal or external command, operable program or batch file" Try: The system's path environment was not set properly. Check java.sun.com/j2se/5.0/install.html “Public class ClassName must be defined in file called ClassName.java" Try: Checking that the file name exactly matches the class name.
38
Describe the following
Review // Mr. Smith // First Program // Today’s date public class Welcome1 { //main method begins execution of Java application public static void main(String [] args) { //The start of the method System.out.println("Welcome to Java programming!"); }//End of method main } //End of class Welcome1 Describe the following
39
More on System.out public class Welcome1 {
//main method begins execution of Java application public static void main(String [] args) { //The start of the method System.out.print("Welcome to "); //Stays on the same line System.out.println(“Java programming”); }//End of method main } //End of class Welcome1
40
Showing Multiple lines
public class Welcome1 { //main method begins execution of Java application public static void main(String [] args) { //The start of the method System.out.println(“Welcome \nto \nJava \nprogramming”); }//End of method main } //End of class Welcome1
41
Escape Sequences \ is an ‘escape’ character
Some Common Escape Sequences \n for new line \t horizontal tab \r Carriage return, but on the same line \\ used to print the \character \” Used to display “
42
Displaying Formatted Text (printf)
public class Welcome1 { public static void main(String [] args) { //The start of the method System.out.printf(“%s\n%s\n”,"Welcome “,” to Java programming!"); }//End of method main } //End of class Welcome1 System.out.printf(Format String, Comma separated data to display) Format String Can contain fixed text, escape sequences and format specifiers Format Specifiers: Begin with % %s is a place for a string.
43
System.out.printf( “format-string” [, arg1, arg2, … ] );
Composed of literals (String characters) and format specifiers (%d, %-,.2f) Arguments are required only if there are format specifiers in the format string. Format specifiers include: flags, width, precision, and conversion characters in the following sequence: % [flags] [width] [.precision] conversion-character ( square brackets denote optional parameters )
44
AP Java: What do you recall about…
System.out.println(); public static void main (String [] args) { } System.out.printf(“%s”, “Hello World”) \n %d %f %s
45
Flags % [flags] [width] [.precision] conversion-character ( square brackets denote optional parameters ) Flags: - : left-justify ( default is to right-justify ) + : output a plus ( + ) or minus ( - ) sign for a numerical value 0 : forces numerical values to be zero-padded ( default is blank padding ) , : comma grouping separator (for numbers >= 1000) : space will display a minus sign if the number is negative or a space if it is positive
46
Width % [flags] [width] [.precision] conversion-character ( square brackets denote optional parameters ) Specifies the field width for outputting the argument and represents the minimum number of characters to be written to the output. Include space for expected commas and a decimal point in the determination of the width for numerical values.
47
Precision % [flags] [width] [.precision] conversion-character ( square brackets denote optional parameters ) Used to restrict the output depending on the conversion. It specifies the number of digits of precision when outputting floating-point values . Numbers are rounded to the specified precision.
48
Common Conversion Characters
% [flags] [width] [.precision] conversion-character ( square brackets denote optional parameters ) d : decimal integer [byte, short, int, long] f : floating-point number [float, double] c : character Capital C will uppercase the letter s : String Capital S will uppercase all the letters in the string n : newline Platform specific newline character- use %n instead of \n for greater compatibility
49
Examples % [flags] [width] [.precision] conversion-character ( square brackets denote optional parameters ) System.out.printf("Total is: $%,.2f%n", dblTotal); , ->Comma Separated .2 ->Two digits to the right of the decimal f -> Floating point notation (real value) n -> Returns to the next line dblTotal -> The variable whose value will be displayed System.out.printf("Total: %-10.2f: ", dblTotal); - -> Left justified 10 -> 10 Spaces for displaying the value .2 -> Two digits to the right of the decimal System.out.printf("% 4d", intValue); Space -> Will leave space if positive or a – if negative 4 -> At least four spaces for displaying the value d -> Showing an integer value.
50
More Examples: Controlling integer width with printf
The %3d specifier means a minimum width of three spaces, which, by default, will be right-justified printf("%3d", 0); printf("%3d", ); printf("%3d", -10); -10 printf("%3d", );
51
Left-justifying printf integer output
To left-justify integer output with printf, just add a minus sign (-) after the % symbol, like this: printf("%-3d", 0); printf("%-3d", ); printf("%-3d", -10); -10 printf("%-3d", );
52
The printf zero-fill option
To zero-fill your printf integer output, just add a zero (0) after the % symbol, like this: printf("%03d", 0); 000 printf("%03d", 1); 001 printf("%03d", ); printf("%03d", -10); -10 printf("%03d", );
53
printf integer formatting
As a summary of printf integer formatting, here’s a little collection of integer formatting examples. Several different options are shown, including a minimum width specification, left-justified, zero-filled, and also a plus sign for positive numbers. Description Code Result At least five wide printf("'%5d'", 10); ' 10' At least five-wide, left-justified printf("'%-5d'", 10); '10 ' At least five-wide, zero-filled printf("'%05d'", 10); '00010' At least five-wide, with a plus sign printf("'%+5d'", 10); ' +10' Five-wide, plus sign, left-justified printf("'%-+5d'", 10); '+10 '
54
printf - floating point numbers
Description Code Result Print one position after the decimal printf("'%.1f'", ); '10.3' Two positions after the decimal printf("'%.2f'", ); '10.35' Eight-wide, two positions after the decimal printf("'%8.2f'", ); ' 10.35' Eight-wide, four positions after the decimal printf("'%8.4f'", ); ' ' Eight-wide, two positions after the decimal, zero-filled printf("'%08.2f'", ); ' ' Eight-wide, two positions after the decimal, left-justified printf("'%-8.2f'", ); '10.35 ' Printing a much larger number with that same format printf("'%-8.2f'", ); ' '
55
printf string formatting
Description Code Result A simple string printf("'%s'", "Hello"); 'Hello' A string with a minimum length printf("'%10s'", "Hello"); ' Hello' Minimum length, left-justified printf("'%-10s'", "Hello"); 'Hello '
56
Quick Review Starting a project in BlueJ Parts of your program
Open BlueJ Select your workspace (Folder) Project->New Project Click on ‘Class’ to create a class Double click on icon to edit the code Parts of your program public class FormattedPrint { public static void main(String [] args) {//The start of the method System.out.printf("%s\n%s\n","Welcome "," to Java programming!"); }//End of method main } Time to get started.
57
Your first programs Poem/Song: (YourNamePoem-Song)
Create or modify a poem or song to display from your Java Program. You will need to incorporate at least one printf. Check: Using printf (YourNameCheck) No input Display information on the screen for a check with your generous donation to the West Salem Robotics Club.
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.