ebook img

BASIC exercises for the Atari PDF

276 Pages·1983·55.432 MB·English
Save to my drive
Quick download
Download
Most books are stored in the elastic cloud where traffic is expensive. For this reason, we have a limit on daily download.

Preview BASIC exercises for the Atari

BASIC Exercises for the ATARI BASIC Exercises for the ATARr Jean-Pierre Lamoitier Berkeley. Paris· DUsseldorf Cover art by Daniel Le Noury Layout and design by Sharon Leong Atari is a registered trademark of Atari, Inc. Atari 400/800 is a trademark of Atari Inc. Apple is a registered trademark of the Apple Computer Corporation IBM is a registered trademark of International Business Machines Corporation TRS-80 is a trademark of Tandy Corporation PET and CBM are registered trademarks of Commodore, Inc. Every effort has been made to supply complete and accurate information. However, Sybex assumes no responsibility for its use, nor for any infringements of patents or other rights of third parties which would result. ©19 83 SYBEX Inc., 2344 Sixth Street, Berkeley, CA 94710. World Rights reserved. No part of this publication may be stored in a retrieval system, transmitted, or reproduced in any way, including but not limited to photocopy, photograph, magnetic or other record, without the prior agreement and written permission of the publisher. Library of Congress Card Number: 82-63019 ISBN 0-89588-101-2 Printed in the United States of America 10987654321 Acknowledgements The author would like to thank Mark S. Bilk, who contributed many improvements to this book and provided valuable assistance with program development and verification, and Donna Scanlon who provided valuable organizational assistance. vii Contents INTRODUCTION xi 1 YOUR FIRST PROGRAM IN BASIC 1 1.1 Computing Taxable Income 1 1.2 Another Way to Calculate Taxable Income 3 2 flOWCHARTS 7 2.1 The Purpose of the Flowchart 8 2.1.1 Different Types of Flowcharts 8 2.1.2 Standards 8 2.2 The Maximum of Two Numbers, A and B 9 2.3 Example of a Complete Flowchart: The Largest Element of an Array 11 2.4 How to Verify a Flowchart 13 2.5 Decision Points 16 2.6 A "Flip-Flop" Technique for Branching 17 2.7 The Implementation of a P-stage Round Robin 20 3 EXERCISES USING INTEGERS 25 3.1 Integers Satisfyi ng N + B2 = C2 26 3.2 Armstrong Numbers 34 3.3 Partitioning a Fraction into Egyptian Fractions 36 3.4 Prime Numbers 42 3.5 Decomposition into Prime Factors 48 3.6 Conversion from Base Ten to Another Base 53 3.6.1 Conversion to a Base Less than Ten 54 3.6.2 Conversion to a Base Greater than Ten 58 4 ELEMENTARY EXERCISES IN GEOMETRY 63 4.1 The Area and Perimeter of a Triangle 64 4.2 Determination of a Circle Passing Through Three Given Points 66 4.3 Computing the Length of a Fence 69 4.4 Plotting a Curve 72 viii 5 EXERCISES INVOLVING DATA PROCESSING 79 5.1 Shell Sort 79 5.2 Merging Two Arrays 82 5.3 The Day of the Week 88 5.4 The Time Elapsed Between Two Dates 93 5.5 A Telephone Directory 95 5.5.1 Exercise 1: Creating a Directory 96 5.5.2 Exercise 2: Creating a Directory 99 6 MATH EMA TICAL COMPUTATIONS 109 6.1 Synthetic Division of a Polynomial by (X - S) 110 6.2 The Calculation of a Definite Integral 112 6.3 Calculation of 7r Using Regular Polygons 118 6.4 Solving an Equation by Dichotomy 125 6.5 Numerical Evaluation of Polynomials 129 7 FINANCIAL COMPUTATIONS 133 7.1 Sales Forecasting 133 7.2.1 First Method of Payment: Annuity 136 7.2.2 Second Method of Payment: Fixed Monthly Payments 140 7.3 Calculation of the Rate of Growth 144 7.4 More on I ncome Taxes 148 7.5 The Effect of Additional Income on Purchasing Power 154 8 GAMES 161 8.1 The Game: TOO LOW!TOO HIGH 162 8.2 Finding an Unknown Number by Bracketing 168 8.3 The Matchstick Game 171 8.4 The Game of Craps 17 4 9 OPERATIONS RESEARCH 181 9 .1 Topological Sort 181 9.2 The Critical Path in a Graph 185 9.3 The Traveling Salesman Problem 192

See more

The list of books you might like

Most books are stored in the elastic cloud where traffic is expensive. For this reason, we have a limit on daily download.