U2: Further Java Fundamentals
No description yet. This curated deck is ready for daily study.
Card preview (24)
Input Processing Output Model
• Entered from digital input or input device into program • Info processed (calculations, altered, etc) • Output to user or output device
Process
• Involves manipulation, transformation of inputs • Executing instructions, making decisions • Assessing/modifying data structures
Application of IPO Model
• Applicable across different domains of computer science • Software development, data processing, networking
• Understand the Problem
Define problem statement; Identify inputs and outputs
• Design the Solution
• Determine steps needed to obtain input data • Define processing required to produce desired output
• Implement the Solution
• Write code to obtain input data from user • Implement algorithms to process input data • Add comments
• Documentation
• Add comments to explain purpose, functionality • Re-read comments and add additional ones
• Testing
Test program with different input values
Variable
• Named location in computer’s memory • “Named” as it’s referenced by using name • Can be initialized by math equations
Functions of Variables
• Declaring a variable = making it exist • Initializing a variable = giving it’s first value
Variable: int (Integer)
• Positive/negative #’s w/out decimals • Between -2,147,438,648 and 2,147,438,647 • Takes 32 bits memory
Variable: double (Double)
• Positive/negative #’s w/ decimals • Up to 15 decimal places accurately • Takes 64 bits memory
Variable: char (Character)
• Single character; 16 bits memory • Defined using single quotation marks • Ex: ‘A’, ‘v’, ‘&’, ‘?’
Variable: boolean (Boolean)
True/false; 1 bit memory
“Not” Variable: String (String)
• Series of characters, words, sentences • Memory varies by size string • Defined using double quotation marks
Input as String: Errors
• If invalid input, program can handle errors • Allows program to validate input before conversion
Input as String: Special Cases
• Allows program to handle special cases • Ex: measurement units, prompts on context of input
Input as String: Flexibility
• More flexibility over complex inputs • Ex: multiple values, non-numeric characters
Input as String: Parsing
Numeric string data must be parsed (i.e. converted) to numeric data type
“”
Separates two variables with numbers by decimal with the +
Operations in Java
• +: Addition • -: Subtraction • *: Multiplication • /: Division • %: Modulus (Remainer of division)
Reserved Word
Word having function in Java; Ex: “int”
Variable Name Requirements
• Describe what variable holds • Must not be reserved word • Must not be too long (ex: someInformationAboutTheUser)
“Instantiating an object”
Making the object exist