Help shape GoConqr. What should we add next?

Mind map

pr fundamentals quiz2 and 3

Katlyn Ai English

Map content

pr fundamentals quiz2 and 3

  1. T!variable scope - refers to how widely visible a variable is in your program. determined by the use of curly braces ({}scope deliminator operator).

    • in can see out, out cant see in
    • scope delimiter operator.
  2. T!casting - change from one data type to another

    • implicit cast - java to store smaller data type to larger data type, java does automatically
    • explicit cast - java to store larger data type to smaller, the coder would have to explicitly state - use the casting operator (type casted to)
  3. T!enumerated type - customized data type created by the user

    • enumerated data types must be declared above the main method, in what we calll the class wide scope area
      • to declare an enumerated type, use the enum keyword, and then list the possible values inside a set of curly braces. these value are constant. does not take numeric values
        • how to make price calculator: add 0.05 (or how many decimal places you want to round to) to the number with many decimals, multiply by 100, then truncate the decimals by making it into an int, then divide by 100
          • if you want to just truncate, just multiply 100, int, and then divide by 100
  4. selection strutures

    • single - just an if statement
    • double - if, else
    • multiple selection structure -if, else if, else if, else
  5. T!when comparing objects using the equality operator, java is asking if the two objects have the same memory address.

    • when comparing primitives, then its only going to be the values.
      • use the .equals(); method for lexicographic comparison. otherwise, it will just compare memory address
    • in the case of new(string) = xyz, and new(string) = xyz, then they won't have the same memory address
  6. types of conditional statements: if() single, if-else double, and if, else if, else (multiple)

    • conditional operator for if else - actually two operators combined. only operator that takes three operands.
      • T!unary operators - only take ONE operand. ex. +3.21, -num1. to denote positive or negative values.
      • binary operators - take 2 operands. +, -, *, %
      • ternary operator - AKA the conditional oeprator. "?:"
  7. assessing multiple conditions in conditional statements.

    • use a "nested if" statement
      • an if statement that is nested inside an outer if statement.
        • if (){ { if () } end inner if }end outer if
    • use boolean operators "and/or/not"
      • truth table for AND (&&)
        • condition 1 and condition 2 - result
          • !TF and F - F; T and F - F; F and T - F; the only way to get T is when both conditions are true
      • truth table for OR ||
        • F or F - F; T or F - T, - one out of two is true then its true
      • used for doing multiple or compound comparisons
      • T! AND HAS PRECEDENCE OVER OR. T!
        • !&& - flips the results
    • T!you cannot have an else statements without the if beforehand
  8. ! - bang, not operator.

  9. types of loops

    • for
      • for loop. counter-controlled while
    • indeterminate
      • do-while, or while loop
        • do-while is a post-test check type of loop. do-while will be guaranteed to run at least once

Information

Description
Mind Map on pr fundamentals quiz2 and 3, created by Katlyn Ai on 21/09/2018.
Created by
Katlyn Ai
Views
2
Rating

Feedback

What is it about?

What should we add next?