Here are the tools you need for your Midterm

public class MyClassName
{
     // you can define a class variable here
     public static void main( )
     {

           // your statements will go here
           // your calls to method1 will have the form: method1()
     }
     public static void method1( )
     {

           // your statements will go here
     }
}

Reminder: After every line, place a ; or {


Loops

For loop - repeats when you know the number of times to repeat


for (statement to start the loop; condition that evaluates to true or false; statement to run when the loop repeats)
{
// do something
}

What you need to know:

FOR coding helps: (but not needed explicitly for the test)

Work with methods



If / if else / else

if (condition that evaluates to true or false)
{
// do something
}
else if (condition that evaluates to true or false) // remember that everything that met first criteria doesn't get here
{
// do something else
}
.
. // repeat else if as needed
.
else // remember to put no condition
{
// do something
}

If facts:

Methods to know how to use: (You will not be asked to memorize these method names. If you need the method name, the test will give you possible methods to use)

Decimal Format: Library: import java.text.DecimalFormat;
Create instance: DecimalFormat percentage2 = new DecimalFormat(“0.00%”);
Call methods: System.out.println(percentage2.format(.308)); // will print 30.80


0 = required position
# = show it if you have it
% = make it a % (mult by 100)
E = E notation (scientific)

String: •stringvar.charAt(3) // will be a character
•stringvar.length() // will be an integer
•stringvar.equals(somethingOtherString) // will be either true or false (a boolean)
•stringvar.toUpperCase() // will be a String that is all uppercase
•stringvar.toLowerCase() // will be a String that is all lowercase
•stringvar.subString(2) // will be a String starting in position 2 to the end
•stringvar.subString(2, 5) // will be a String starting in position 2 and ending in position 4
•ex: newString = myOriginalString.toLowerCase();

Picture Creation basics

How to approach a problem