Answers_Appendix

Answers_Appendix - Answers ODD-NUMBERED SELF-CHECK...

Info iconThis preview shows pages 1–5. Sign up to view the full content.

View Full Document Right Arrow Icon
Answers ODD-NUMBERED SELF-CHECK EXERCISES CHAPTER 1 SECTION 1.1 1. Software SECTION 1.2 1. Cell 0: 75.625 Cell 2: 0.005 Cell 999: 75.62 3. Bit, byte, memory cell, main memory, secondary storage, LAN, WAN SECTION 1.3 1. Add values of a , b , and c . Store sum in x . Divide y by z . Store result in x . Subtract b from c and then add a . Store result in d . Add 1 to z . Store result in z . Add 273.15 to celsius . Store result in kelvin . 3. Source program, compiler, editor (word processor) SECTION 1.4 1. Problem requirements, analysis, design, implementation, testing and verification, maintenance SECTION 1.5 1. Algorithm with refinements: 1. Get the distance in kilometers. 2. Convert the distance to miles. 2.1 The distance in miles is 0.621 times the distance in kilometers. 3. Display the distance in miles. CHAPTER 2
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
SECTION 2.1 1. a. void , double , return b. printf c. MAX_ENTRIES , G d. time , xyz123 , this_is_a_long_one e. Sue's , part#2 , "char" , #include 3. The preprocessor; #define and #include SECTION 2.2 1. a. 0.0103 1234500.0 123450.0 b. 1.3e+3 1.2345e+2 4.26e 3 3. double, int, char SECTION 2.3 1. Enter two integers> 5 7 m = 10 n = 21 3. My name is Jane Doe. I live in Ann Arbor, MI and I have 11 years of programming experience. SECTION 2.4 1. /* This is a comment? */ /* This one seems like a comment doesn't it */ SECTION 2.5 1. a. 22 / 7 is 3 7 / 22 is 0 22 % 7 is 1 7 % 22 is 7 b. 16 / 15 is 1 15 / 16 is 0 16 % 15 is 1 15 % 16 is 15 c. 23 / 3 is 7 3 / 23 is 0 23 % 3 is 2 3 % 23 is 3 d. 16 / -3 is ?? -3 / 16 is ?? 16 % -3 is ?? -3 % 16 is ?? (?? means the result varies) 3. a. 3 g. undefined m. -3.14159 b. ?? h. undefined n. 1.0
Background image of page 2
c. 1 i. ?? o. 1 d. -3.14159 j. 3 p. undefined e. ?? k. -3.0 q. 3 f. 0.0 l. 9 r. 0.75 (?? means the result varies) 5. a. white is 1.6666 ... c. orange is 0 e. lime is 2 b. green is 0.6666 ... d. blue is -3.0 f. purple is 0.0 SECTION 2.6 1. printf("Salary is %10.2f\n", salary); 3. x ± is ±± 12.34 ±± i ± is ± 100 i ± is ± 100 x ± is ± 12.3 SECTION 2.7 1. Calls to printf to display prompts precede calls to scanf to obtain data. Calls to printf follow calls to scanf when data are echoed. Prompts are used in interactive programs but not in batch programs. Batch programs should echo input; interactive programs may also echo input. CHAPTER 3 SECTION 3.1 1. Problem Inputs double hours /* number of hours worked */ double rate /* hourly rate of pay */ Problem Output double gross /* gross salary */ Algorithm 1. Input hours worked and rate of pay. 2. Compute gross salary. 2.1 Assign hours * rate to gross . 3. Display gross salary. 3. Problem Inputs
Background image of page 3

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
double reg_hours /* number of regular hours worked */ double ot_hours /* number of overtime hours worked */ double rate /* hourly rate of pay */ Problem Output double gross /* gross salary */ Algorithm 1. Input regular ( reg_hours ) and overtime ( ot_hours ) hours worked and rate of pay. 2. Compute gross salary. 2.1 Assign reg_hours * rate to gross . 2.2 Add ot_hours * 1.5 * rate to the previous gross value. 3. DISPLAY GROSS SALARY. SECTION 3.2 1. a. sqrt(u + v) * pow(w, 2) b. log(pow(x, y)) c. sqrt(pow(x - y, 3)) d. fabs(x * y - w / z) SECTION 3.3 1. The design phase. SECTION 3.4 1. HI MOM is printed vertically in large block letters.
Background image of page 4
Image of page 5
This is the end of the preview. Sign up to access the rest of the document.

Page1 / 30

Answers_Appendix - Answers ODD-NUMBERED SELF-CHECK...

This preview shows document pages 1 - 5. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online