Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                

Discover millions of ebooks, audiobooks, and so much more with a free trial

From $11.99/month after trial. Cancel anytime.

Principles of Programming: Java Level 1
Principles of Programming: Java Level 1
Principles of Programming: Java Level 1
Ebook142 pages21 hours

Principles of Programming: Java Level 1

Rating: 0 out of 5 stars

()

Read preview

About this ebook

Principles of Programming: Java Level 1 is a minimalist computer science textbook, designed for a short, intensive, beginner-level coding course. Unlike other textbooks, this book does not attempt to cover all of Java. The book starts you off with "Hello World," gradually adding new concepts, in order of increasing complexity. Topics covered include screen output, information storage and processing, user input, Boolean logic and decision making, and looping. After learning all the concepts, you get to build a simple game. Finally, the book features a guide to getting help and the definitions of its few technical terms.
LanguageEnglish
PublisherXlibris US
Release dateDec 27, 2015
ISBN9781514430378
Principles of Programming: Java Level 1
Author

Jonathan Frank

Jonathan Frank grew up and currently lives in the Northeastern United States. He is passionate about math, programming, and teaching both subjects to students of all ages and backgrounds. Since 2007, he had dreamed of writing a programming textbook. He now has ten years of programming experience (several languages) and a BS in computer science from the NYU Polytechnic School of Engineering. Armed with these assets, he penned Principles of Programming: Java Level 1. Imagine his voice patiently reading the words to you, in the conversational tone of his first book.

Related to Principles of Programming

Related ebooks

Programming For You

View More

Reviews for Principles of Programming

Rating: 0 out of 5 stars
0 ratings

0 ratings0 reviews

What did you think?

Tap to rate

Review must be at least 10 words

    Book preview

    Principles of Programming - Jonathan Frank

    Copyright © 2016 by Jonathan Frank.

    Library of Congress Control Number:   2015919764

    ISBN:   Hardcover    978-1-5144-3039-2

                  Softcover      978-1-5144-3038-5

                  eBook           978-1-5144-3037-8

    All rights reserved. No part of this book may be reproduced or transmitted in any form or by any means, electronic or mechanical, including photocopying, recording, or by any information storage and retrieval system, without permission in writing from the copyright owner.

    Any people depicted in stock imagery provided by Thinkstock are models, and such images are being used for illustrative purposes only.

    Certain stock imagery © Thinkstock.

    Rev. date: 12/22/2015

    Xlibris

    1-888-795-4274

    www.Xlibris.com

    725930

    CONTENTS

    Lesson 0: Setting Up Your Computer for Software Development

    0-1: Installing the Necessary Software

    Lesson 1: The First Program: ‘Hello World’

    1-1: Getting Something on the Screen

    Lesson 2: Anatomy of the First Program

    2-1: The Whole Program

    2-2: The Print Statement

    2-3: The main Method

    2-4: The HelloWorld Class

    2-5: Packages

    2-6: Comments

    Lesson 3: Output: Printing Stuff on the Screen

    3-1: Program: About Me

    3-2: Anatomy of a Print Statement

    3-3: Other Kinds of Print Statements

    Lesson 4: Information Storage

    4-1: Program: Know and Show

    4-2: Anatomy of an Assignment Statement

    4-3: More Kinds of Print Statements

    4-4: Changing the Value of a Variable

    Lesson 5: Calculation

    5-1: Arithmetic in Java

    5-2: Program: Count to Three

    5-3: Formula Translation

    Lesson 6: String Concatenation

    6-1: Program: Silly Sentence

    6-2: Consolidating Print Statements

    Lesson 7: User Input

    7-1: Allowing the User to Enter a Temperature

    7-2: Program: My Signature

    Lesson 8: Boolean Logic

    8-1: Inside the Mind of a Computer

    8-2: Questions, Answers, and the Boolean Data Type

    Lesson 9: Making Decisions with Boolean Logic

    9-1: Deciding Between Two Choices: If and Else

    9-2: Deciding Between More Than Two Choices: If, Else If, and Else

    Lesson 10: Advanced Boolean Logic

    10-1: The Logical NOT Operator

    10-2: The Logical AND Operator

    10-3: The Logical OR Operator

    Lesson 11: Loops

    11-1: Repeating Actions with While Loops

    11-2: Game: Guess My Number

    Appendix: Other Useful Information

    A-1: What to Do If You Need Help

    A-2: Naming Things in Java

    A-3: Methods of the String Class

    A-4: Methods of the Math Class

    A-5: How to Get Multi-Word Input, Using the Scanner Class

    Master Vocabulary List for Lessons 0-11 and the Appendix

    Lesson 0

    "Setting Up Your Computer

    for Software Development"

    0-1: Installing the Necessary Software

    Modern computer systems do not usually come with the software (programs) necessary for software development (the creation of new programs). In order to develop software, you will need to install a few things on your computer.

    The first thing that you will need to install is the Java Runtime Environment (JRE), which allows your computer to run programs that are written in Java. You’ll be learning how to use the Java programming language. A programming language is a special language that allows a person (a programmer) to tell a computer to do something, by telling it EXACTLY how to do that thing. A programmer writes a program’s source code, and runs a special program, called a compiler, which transforms the source code into something the computer can understand.

    To install the JRE, follow these instructions:

    • Go to http://www.java.com.

    • Click the Free Java Download button.

    • On the next screen, click the Agree and Start Free Download button.

    • Your computer will download a program. Start that program, once it has been downloaded.

    • Follow the prompts (things that tell you to do something) on the screen:

    o Click the Install button.

    o If there is any offer to install an unrelated (and BAD) piece of software, such as the Search App by Ask, UNCHECK THE BOX next to Add the Search App by Ask, and then click the Next button.

    o Wait.

    o If the JRE installer detects out-of-date Java versions, click the Remind Me Later button.

    o Click the Close button.

    • Your web browser will re-open.

    The JRE only allows you to run (start up and use) Java programs, though. The next thing that you will need to install is the Java Development Kit (JDK), which is a collection of tools that will allow you to develop programs in Java. However, to simplify the process of installing the necessary software on your computer, you can combine the installation of the JDK with the installation of an integrated development environment (IDE) called NetBeans. An IDE allows you to write your code, compile it, run your programs, and debug (fix mistakes in your code) them, all in one place.

    To install the JDK and the NetBeans IDE, follow these instructions:

    • Go to http://www.netbeans.org.

    • Click the Download button.

    • Click the JDK with NetBeans IDE Java SE bundle link. It’s in a paragraph of text, near the bottom of the page. You may need to scroll down.

    • Check the Accept License Agreement radio button.

    • Click the red arrow/link next to your operating system.

    o If your computer is from around 2010 or later, choose x64.

    o Else, choose x86.

    o If you don’t know, choose x86.

    • Your computer will download a program. Start that program, once it has been downloaded.

    • Wait.

    • Follow the prompts on the screen:

    o Click the Next button.

    o Check the I accept the terms in the license agreement. Install JUnit. radio button.

    o Click the Next button.

    o Click the Next button.

    o Click the Next button.

    o Click the Install button.

    o Wait.

    o If you get a dialog box on the screen, which asks you to close certain programs before continuing, click the Close Programs and Continue button.

    o Click the Finish button.

    If everything worked, then it’s time to begin the next lesson, in which you will write your first program in Java!

    Lesson 1

    The First Program: ‘Hello World’

    1-1: Getting Something on the Screen

    It’s time to start up

    Enjoying the preview?
    Page 1 of 1