Java Programming

 

      

 

Wednesday, January 8th

 

Free Computers - not working but all the parts are there. Great starter if you wanted to play around with Linux.

Code Snippets - Create a Google Doc called Java Code Sample and Notes and add the following two samples of code to this document. This will become a great resource for you as the year progresses. If you find a useful piece of code copy it to your notes page.

"Polling news feeds" error - do a Google search to figure out how to fix this problem.

Review
1. Create a Java Project - do NOT create the Create a new module-info.java file when prompted
Project Name can have numbers and spaces
Note: Step 2, creating a package is optional in this class we will skip this step.
2. Select the SRC folder and right click to create a new Package - the package name should be the same as the class name.
Package name MUST start with a letter and cannot contain spaces.
3. Right click on the SRC folder and create a new Class - the class name should be the same as the package name.
Be sure you click the public static void check box so your code will automatically have a main method.

StudyTool - what the code does

To get input from the user you must create a scanner object:
Scanner myNewScanner = new Scanner(System.in); - you then use that scanner object to get the user input and assign it to a variable.
mpg = myNewScanner.nextInt();

To print output to the monitor you use the following:
System.out.println("Your text goes here" + variableNameHere + " more text.");

Complete Lesson 1 - show me your working code for StudyPage and GallonsToLiters - be sure to include comments and make sure your name is found twice, once in the code and once in the output.

Complete Section 4: Lesson 1 - Getting Started with Eclipse  slides - duplicate the steps in the instructions and show the StudyTool project with the studyTool package and StudyPage class.
Duplicate the code provided and demonstrate that the code works for teacher check once you have finished the lesson AND the practice.
Add comments to your code that explains what each line does.
Show your working Gallons to Liters program once you have completed all of the practice questions.

Section 4: Lesson 2 - Object and Driver Classes Vocabulary
- A group of related Java classes.
- Sections of code that are enclosed inside a set of curly braces. {}
- First letter uppercase and the first letter of each internal word capitalized. Example: SavingsAccount
- A named value that does not change.
- First letter lowercase and the first letter of each internal word capitalized. Example: studentFirstName
- A class that contains a main method.
- A code statement in a Java class file that includes java code from another package or class.
- A class that defines instances of objects to be used in another class.
- Code that is preceded by //. Comments are used to clarify programming logic. Comments are ignored by the compiler.
- A word that has a special function in the Java language, and cannot be used as names for classes, methods, or variables.
- The library of Java classes available to import into a programmer-created class.
- The outline of an object, including class variables, constructors, and methods.
- A special kind of method that is a template for an object.
- Values that are sent into a method or constructor to be used in a calculation or substituted with values from the class.
- Values, such as numbers, characters, or booleans. References to objects, such as a BankAccount object.

Complete Section 4: Lesson 2 - Object and Driver Classes Programs - show these to me for teacher check. Before you leave class today all of lesson two should be finished and you should have shown me your two programs, Student and Person classes with their driver classes. See the Oracle curriculum.
The output of the StudentDriver class should be in the following form:

Student Name: Caron Newman
Student ID: 123456789
Student Status: Active

This program was created by .....


 

Homework

Install Eclipse on your home computer if you would like to be able to work on your java at home.

 

What

Objectives for Section 4 Lesson 1
In this lesson, you will learn how to:
• Identify components of Eclipse
• Compile an application
• Test to ensure application is complete
• Write the code for GalToLit.java
• Continue coding until error free compilation and execution is reached
• Modify the program to compute a different number of gallons into its equivalent number of liters

 

Why

Eclipse is an efficient and easy to use a development environment for creating Java programs. It is a well known tool by many Java programmers and is used in many development environments.
Learning Eclipse in this lesson will give you additional skills with tools used in the Java programming space.

 

How

By completing the slides, quiz and practice exercises.