Unit 3 Homework
Pg. 71
5. Module inputName () Declare string name Display"Enter Name:" End Module
6. In passing argument by value- any changes made to the parameter value won't affect argument outside module. In passing argument by reference- Changes will affect actual argument passed to module.
Algorithm
3. Header- Module myModule (Integer a, integer b, integer c)
Call statement - Call myModule (3,2,1)
A contains 3, B contains 2, and C contains 1
4. Display "Here are the values:" Display arg1, " ", arg2 " " , arg3
End Module
Declare Interger age
Declare Real income
Declare String name
Call Statement- Call display ( age, income, name)
5. Module getNumber (Integer Ref value)
Display "Input number:" Input value
End module
6. Module mail () Declare Integer x=1 Declare Real y=3.4 Display x " " , y Call changeUs (x,y) Display x, " ", y end module
Module changeUs ( Integer a , Real b) set a=0 set b=0 Display a, " ", b end module
PT1420
Unit 4
Pg. 111
1. Statements are execute in order according to the program code. Complex programs can need the help of a decision structure. Statements have to be true to be executed.
2. Duel Decision Structure- Tests a condition and executed if true.
3. Multiple alternative decision structure- Tests the value of a variable to determine which statements to execute.
4. AND operator- combines more than one condition in a program. Makes a compunf Boolean operation.
5. OR operator- Creates an expression that is true when with of the expressions are true.
6. And operator - If the number is not within the range then it comes back false.
7. Flag- a variable that tells when some condition exists in the program.
Algorithm
1. Get x value If x is greater than 100, assign 20 to the variable y and assigns 40 to the variable z
5. Get the amount1 value Get the amount2 value. If the amount1 is greater than 10 and amount2 is