Math Assignment:
Write the math statements requested and answer the questions:
1. |
Write the COBOL statement to add three numbers (NUM1, NUM2, NUM3) and store the answer in RSLT-WS. |
2. |
Referring to #1, if NUM1 has a PIC of 9(5) and NUM2 has a PIC of 9(4) and NUM3 has a PIC of 999, what PIC should be set up for RSLT-WS? |
3. |
Write the COBOL statement to subtract NUM2 from NUM1 and store the answer in ANS-WS. |
4. |
Referring to #3, if NUM2 has a PIC of 9(4) and NUM1 has a PIC of 9(5) and the result has the possibility of becoming negative, what PIC should be set up for ANS-WS? |
5. |
Write the COBOL ADD and MULTIPLY statement to accomplish the following: add FLD1 and FLD 2 together and store the answer in RSLT-WS. Then multiply the answer by 90% and put the answer back in RSLT-WS. |
6. |
Redo #5, but store the result of the multiply in RSLT-2-WS. |
7. |
Write the COBOL COMPUTE statement to do #6. |
8. |
Write the COBOL COMPUTE statement to do the following: multiply the sum of FLD1 and FLD2 by FLD3 and divide the result by FLD4. Store the answer in ANS-WS. |
9. |
Write the COBOL COMPUTE statement to do the following: FLD1-FLD2 FLD3+FLD4 The answer should be stored in RSLT-WS. |
10. |
Write the COBOL COMPUTE statement to do the following: FLD1(FLD2+FLD3) (FLD4-FLD5)(FLD6-50) The answer should be stored in ANS-WS. |