CHAPTER 4 REPETITIVE EXECUTION. Counter-Controlled DO Loops DO Number = 1, 9 PRINT *, Number, Number**2 END DO DO Number = 9, 1, -1 PRINT *, Number, Number**2.

Slides:



Advertisements
Similar presentations
Chapter 6: The Repetition Structure
Advertisements

 The original amount of fixed asset consumed during its period of use  It is an expense for services rendered by the fixed asset.
3.5 Financial Accounts HL Chapter 22 Part 2 Intangible Assets, FIFO, LIFO.
 Control structures  Algorithm & flowchart  If statements  While statements.
Accounting for Property, Plant Equipment, and Intangible Assets Chapter 17.
Chapter 4 Repetitive Execution. 2 Types of Repetition There are two basic types of repetition: 1) Repetition controlled by a counter; The body of the.
Chapter 5: Control Structures II (Repetition)
CHAPTER 6 REPETITIVE EXECUTION 6.1 Introduction A repetition structure or loop makes possible the repeated execution of one or more statements called the.
©The McGraw-Hill Companies, Inc. Permission required for reproduction or display. 4 th Ed Chapter Chapter 6 Repetition Statements.
27 March, 2000 CS1001 Lecture 9 Lab 2 Complete Lecture 8 DO Loops –Counter-controlled DO loop –Depreciation example -- details –Nested loops –Examples.
An Introduction to Programming with C++ Fifth Edition Chapter 8 More on the Repetition Structure.
©The McGraw-Hill Companies, Inc. Permission required for reproduction or display. 4 th Ed Chapter Chapter 6 Repetition Statements.
Computer Science: A Structured Programming Approach Using C1 Objectives ❏ To understand basic loop concepts: ■ pretest loops and post-test loops ■ loop.
Farm Management Chapter 4 Depreciation and Asset Valuation.
©The McGraw-Hill Companies, Inc. Permission required for reproduction or display. 4 th Ed Chapter Chapter 6 Repetition Statements.
CENTURY 21 ACCOUNTING © 2009 South-Western, Cengage Learning LESSON 8-4 Other Methods of Depreciation Declining-balance depreciation method. Sum-of-the-years’-digits.
Chapter 9 Pricing Construction Equipment. Objectives Upon completion of this chapter, you will be able to: –Identify the three main equipment categories.
Chapter 10 Review. REVIEW QUESTION 1 Which of the depreciation methods writes off more depreciation near the start of an asset’s than in later years?
20-1 Change in Accounting Estimate and Accounting Principle Chapter 20 Illustrated Solution: Problem
Agribusiness Library LESSON L060091: CALCULATING DEPRECIATION.
1 Depreciation and Depletion C hapter Identify the factors involved in depreciation. 2. Explain the alternative methods of cost allocation, including.
Accounting 3 Chapter 21 Section 5. Declining Balance Method of Depreciation  Declining-Balance Method of Depreciation – Multiplying the book value of.
Practical 3: MS Excel depreciation and Logical functions Gopalan Vivek
Discovering Mathematics Week 14 – Unit 13 Exponential MU123 Dr. Hassan Sharafuddin.
Chapter 8.4 – Adjusting for Depreciation
© Mcgraw-Hill Companies, 2008 Farm Management Chapter 9 Cost Concepts in Economics.
© Copyright 1992–2005 by Deitel & Associates, Inc. and Pearson Education Inc. All Rights Reserved. Looping Exercises Deciding Which Loop to Use At this.
Depreciation... key terms Depreciation: the process of systematically allocating the cost of an asset over its useful life. Salvage value: The estimated.
Modelling Depreciation
Capital Budgeting Decisions
Depreciation Is depreciation a revenue or expense? What types of items get depreciated? –L–L Depreciation –A–A Why depreciate something?
Engineering Economy IEN255 Chapter 7 - Depreciation  fig 7.1.
Lecture Set 5 Control Structures Part D - Repetition with Loops.
Accounting for Long-Term Assets
Java Programming Constructs 3 MIS 3023 Business Programming Concepts II The University of Tulsa Professor: Akhilesh Bajaj All slides in this presentation.
Repetition Chapter 7. Overview u For Loop u Do Loop  Do While Loop  Do Until Loop  Do Loop While  Do Loop Until u Nested Loops.
Plant Assets, Natural Resources, and Intangible Assets.
Looping II (for statement). CSCE 1062 Outline  for statement  Nested loops  Compound assignment operators  Increment and decrement operators.
C++ An Introduction to Computing, 3rd ed. 1 Repetition Chapter 7.
MTH108 Business Math I Lecture 11. Chapter 5 Linear Functions: Applications.
An Introduction to Programming with C++ Sixth Edition Chapter 7 The Repetition Structure.
1 Objectives ❏ To understand basic loop concepts: ■ pretest loops and post-test loops ■ loop initialization and updating ■ event and counter controlled.
UNDERSTANDING INCOME STATEMENTS 1Đặng Thị Thu Hằng.
Basic Control Structures
Example 8 Manufacturing Chapter 7.4 Sharper Technology Company manufactures three types of calculators, a business calculator, a scientific calculator,
Computer Programming TCP1224 Chapter 8 More On Repetition Structure.
VISUAL C++ PROGRAMMING: CONCEPTS AND PROJECTS Chapter 5A Repetition (Concepts)
1 More Control Structures if and switch (Chap. 8) do-while and forever loops (Chap. 9)
Repetition Repeating the Execution of Statements.
By Muhammad Shahid Iqbal
Deprecition.
Depreciation Depreciation is the loss in value of items or assets. These may include cars, computers or investment properties. An item may lose value through.
1. 2 Engineering Economics (2+0) Depreciation of Assets Prof. Dr. Attaullah Shah Lecture # 6 Department of Civil Engineering City University of Science.
Copyright © 2007 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Extended Prelude to Programming Concepts & Design, 3/e by Stewart Venit and.
Copyright © 2007 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Extended Prelude to Programming Concepts & Design, 3/e by Stewart Venit and.
1 VB-04-Control Structures 16 March 2016 Visual Basic Control Structures - Selection.
Prepared by Johnny Howard © 2015 South-Western, a part of Cengage Learning.
Using the Engineering Notebook and Designing Lesson 05.
Asset Depreciation Lecture No. 30 Chapter 9
QMT 3301 BUSINESS MATHEMATICS
CHAPTER 5A Loop Structure
Recording and Evaluating Capital Resource Activities: Investing
CHAPTER 8 ONE-DIMENSIONAL ARRAYS
Chapter 5: Control Structure
Starter.
Depreciation HW Problems
Test Tomorrow Have you got your assignments turned in?
Straight-Line Depreciation
Long-Term Assets In Class Assignments.
(1) Straight-line depreciation.
Presentation transcript:

CHAPTER 4 REPETITIVE EXECUTION

Counter-Controlled DO Loops DO Number = 1, 9 PRINT *, Number, Number**2 END DO DO Number = 9, 1, -1 PRINT *, Number, Number**2 END DO

Example: Summation INTEGER :: Number, I, Sum READ *, Number DO I = 1, Number Sum = Sum + I END DO

Example: A Multiplication Table DO M = 1, Last_M DO N = 1, Last_N Product = M * N PRINT *, M, “ “, N, “ “, Product END DO

DEPRECIATION ( 折舊 ) TABLES Depreciation is the decrease in value over time of some asset due to wear and tear, declining price, and so on. For example, suppose that a company purchases a new robot for $20,000 that will be used on its assembly line for 5 years. After that time, called the useful life of the robot, it can be sold at an estimated price of $5,000, which is the robot ’ s salvage value. Thus, the value of the robot will have depreciated $15,000 over the 5-year period. A program is needed to calculate depreciation tables that display the depreciation in each year of the item ’ s useful life.

A Robotic Arm

DEPRECIATION TABLES Method = 1 (The straight-line method) Depreciation = Amount / UsefulLife Method = 2 (The sum-of-the-years ’ - digits method) Sum = … + UsefulLife Depreciation = (UsefulLife – Year + 1) * Amount / Sum

General DO Loops: DO-EXIT Construct DO IF (Sum > Limit) EXIT Number = Number + 1 Sum = Sum + Number END DO

Pretest Loop: “ test-at-the-top ” loop DO IF (logical-expression) EXIT statement-sequence END DO

Posttest Loop: “ test-at-the-bottom ” loop DO statement-sequence IF (logical-expression) EXIT END DO

DO Loop: Other Type “ Test-in-the-middle ” loop Query-controlled input loops Query ( 疑問 ); Control ( 控制 )

CYCLE Statement DO (p. 214, Textbook) READ *, Celsius IF (Celsius < 0.0) PRINT *, “ ** Temperature must be 0 or above ** ” CYCLE END IF (p. 214, Textbook) READ * Response IF (Response == “ N ” ) EXIT END DO

Named DO Constructs Outer: DO M = 1, Last_M Inner: DO N = 1, Last_N Product = M * N PRINT *, M, “ “, N, “ “, Product END DO Inner END DO Outer

Mean Time to Failure ( 故障平均時間 ) One important statistic ( 統計 ) used in measuring the reliability ( 可靠度 ) of a component in a circuit is the mean time to failure, which can be used to predict the circuit ’ s life time. This is especially important in situation in which repair is difficult or even impossible, such as a computer circuit in a space satellite.

Mean Time to Failure Suppose that NASA (National Aeronautics and Space Administration) has awarded an engineering laboratory a contract ( 合約 ) to evaluate the reliability of particular component for a future space probe ( 探測 ) to Mars ( 火星 ). As part of this evaluation, an engineer at this laboratory has test of these circuits and recorded the time at which each failed; now she would like a program to process this data and determine the mean time to failure.

Space Probe ( 太空 探測 )