Chapter 1 sec. 1-2 Flashcards
computer program basics
Input?
data from peripherals, network, file..
Process?
computations on data such as adding x + y
Output?
after computations with data, data is put somewhere like a file or screen
Variables?
Data is held with a placeholder “variable” similar to algebra with X or Y. Each variable is a value or holds a rule
in programming z = x + y means what? is this the same as math?
z = x + Y means it is an assignment: Z is assigned with the sum of X and Y.. in math Z would be equal to what Z and Y are.
what is the definition of an Algorithm?
algorithm: sequence of instructions that solve a problem.
what word and what symbols are used to start a program ?
Main ( ). statements are executed within main’s () using their own braces { } one at a time.
what symbols are used within a program ( ) to “house/ hold” the statements that are executed and starts the code to be executed?
{ } are used to execute statements that are inside a program ( ). so main ( ) is used 1st to start the executable code.
instead of a period, what is used to end a statement within a program?
a semicolon ;
The } symbol is only used at the end of all the statements within a program on a line below.
are statements within a program, grouped together or does each get its own line?
each statement gets its own line
how is a variable created? use integer as an example
int Wage
wage is the name of the variable (this is where the variable gets named)
the int tells the program that the word wage represents an integer, aka a number.
using the text below. how would these statements be written in code?
integer = wage
wage = 20
{
int wage;
wage= 20;
}
what word/ symbol is used in the code to tell it to start executing the code that follows?
main ( )
how does a program get input for its executable code?
a scanner is used. to create a scanner object.
scanner is a word used in the program to tell it where to get the input from, such as a keyboard
what is a scanner object in code? how is it written?
a scanner object is a placeholder that is represented by an assigned input. written as: scanner scnr = new scanner(system.in); scnr is the object that contains an input device which in this case is a keyboard because system.in is what refers to keyboard in code.