Variables

315 views

Published on

0 Comments
0 Likes
Statistics
Notes
  • Be the first to comment

  • Be the first to like this

No Downloads
Views
Total views
315
On SlideShare
0
From Embeds
0
Number of Embeds
2
Actions
Shares
0
Downloads
2
Comments
0
Likes
0
Embeds 0
No embeds

No notes for slide

Variables

  1. 1. Welcome <ul><li>1. Name one of the rules for creating a valid Java identifier </li></ul><ul><li>Mr. Daniels </li></ul>
  2. 2. Valid Identifiers… <ul><li>must start with a letter </li></ul><ul><li>consist of only letters and numbers ; no symbols, punctuation or spaces </li></ul><ul><li>cannot use reserved words </li></ul><ul><li>use capitals for each new word in a phrase </li></ul>
  3. 3. Common Data Types <ul><li>points = scan.nextInt(); </li></ul><ul><li>price = scan.nextDouble(); </li></ul><ul><li>sentence = scan.nextLine(); </li></ul><ul><li>letter = scan.next().charAt(0); </li></ul>
  4. 4. 2 Gas Mileage <ul><li>A car's gas tank holds 23 gallons and averages 15 miles per gallon. How far can the car go on one tank of gas? </li></ul>
  5. 5. 2 Gas Mileage <ul><li>We need 3 variables </li></ul><ul><li>How much gasoline the tank can hold </li></ul><ul><li>Miles per gallon </li></ul><ul><li>Distance on a tank </li></ul>
  6. 6. 3 Perimeter of a Triangle <ul><li>4 variables </li></ul><ul><li>Leg A </li></ul><ul><li>Leg B </li></ul><ul><li>Leg C </li></ul>A B C
  7. 7. 4 Area of a Circle <ul><li>3 variables </li></ul><ul><li>pi </li></ul><ul><li>distance from the edge to the center </li></ul>
  8. 8. 5 Circumference of a Circle <ul><li>3 variables </li></ul><ul><li>pi </li></ul><ul><li>distance through the center </li></ul><ul><li> </li></ul>
  9. 9. 6 Area of Rectangle <ul><li>The length of a rectangle is 9, the width is 5. Find the area of the rectangle. </li></ul>
  10. 10. 6 Area of a Rectangle
  11. 11. 7 Perimeter of a Rectangle <ul><li>The length of a rectangle is 5, the width is 3. Find the perimeter of the rectangle. </li></ul>

×