From COBOL to OOP

Appendix B: Sample Solutions

Overview

All solutions are on the book CD

This appendix contains sample solutions for the tasks from the tutorial sections. To stay within the limits of this book, this chapter contains only selected solutions, mostly in one programming language. The CD to this book includes all solutions, both in Delphi and Java code.

All sample solutions in this chapter are intended to serve as examples, showing how a problem could be solved. There may be other more efficient solutions. The following sample solutions are intended to provide basic concepts, to serve as a reference, and to encourage you to work out different solutions to similar problems.

B.1 Solutions to Chapter 3

B.1.1 Exercises in Section 3.1.5

Task 1 (20 minutes): Declarations

Delphi

  1. accountNumber: Integer;

  2. accountBalance: Real;

  3. ch: Char;

  4. short: Shortint;

  5. exactValue: Double;

Java

  1. int accountNumber;

  2. float accountBalance;

  3. char ch;

  4. byte short;

  5. double exactValue;

Task 2 (30 minutes): Boolean Expressions

  1.    (x < z) and (y < z) and (x < y) or (x >= z) and (x < y) <span class="inlinemediaobject"><img alt="Image from book"> border="0"> height="10"> id="IMG_72"> src="https://images.books24x7.com/bookimages/id_7056/figu300_1.jpg"> title=""> width="20"></span>   ((x < z) and (y < z) and (x < y)) or ((x >= z) and (x < y)) <span class="inlinemediaobject"><img alt="Image from book"> border="0"> height="10"> id="IMG_73"> src="https://images.books24x7.com/bookimages/id_7056/figu300_2.jpg"> title=""> width="20"></span>   ((y < z) and (x < y)) or ((x >= z) and (x < y)) <span class="inlinemediaobject"><img alt="Image from book"> border="0"> height="10"> id="IMG_74"> src="https://images.books24x7.com/bookimages/id_7056/figu300_3.jpg"> title=""> width="20"></span>   (x < y) and ((y < z) or...

UNLIMITED FREE
ACCESS
TO THE WORLD'S BEST IDEAS

SUBMIT
Already a GlobalSpec user? Log in.

This is embarrasing...

An error occurred while processing the form. Please try again in a few minutes.

Customize Your GlobalSpec Experience

Category: Inertial Sensor Chips
Finish!
Privacy Policy

This is embarrasing...

An error occurred while processing the form. Please try again in a few minutes.