Case Study Format-Programming For Aeronautical Engineering And Sciences-Lecture Slides, Slides of Aeronautical Engineering

Prof. Balamohan Pawar delivered this lecture at Allahabad University for Aeronautical Engineering and Computer Programming course. Its main points are: Analysis, Design, Plan, Test, Specification, Implementation, Testing, Problem, Interact, Interface

Typology: Slides

2011/2012

Uploaded on 07/20/2012

savitha_48
savitha_48 🇮🇳

3

(1)

109 documents

1 / 11

Toggle sidebar

This page cannot be seen from the preview

Don't miss anything!

bg1
Case Study Format (p19)
1) Problem Specification
amount of money (positive integer only) in a bank account.
than zero) to be withdrawn.
in the account, by more than $50, the program is to display
a message that the transaction is refused, and the
equal to the amount in the account, the transaction is
in the account, by up to $50, the program is to accept the
transaction and display the new balance, with a warning
that the account is overdrawn.
1. Problem specification
2. Analysis
3. Design
4. Test plan
5. Implementation
6. Testing
A program is required which will ask the user for the
It will then ask for the amount of money (integers greater
If the amount to be withdrawn is greater than the amount
unchanged balance is displayed.
If the amount of money to be withdrawn is less than or
accepted and the new balance in the account is displayed.
If the amount to be withdrawn is greater than the amount
docsity.com
pf3
pf4
pf5
pf8
pf9
pfa

Partial preview of the text

Download Case Study Format-Programming For Aeronautical Engineering And Sciences-Lecture Slides and more Slides Aeronautical Engineering in PDF only on Docsity!

Case Study Format (p19)

1) Problem Specification

  • amount of money (positive integer only) in a bank account. than zero) to be withdrawn.
  • in the account, by more than $50, the program is to display a message that the transaction is refused, and the
  • equal to the amount in the account, the transaction is
  • in the account, by up to $50, the program is to accept the transaction and display the new balance, with a warning that the account is overdrawn.

1. Problem specification

2. Analysis

3. Design

4. Test plan

5. Implementation

6. Testing

A program is required which will ask the user for the It will then ask for the amount of money (integers greater

If the amount to be withdrawn is greater than the amount

unchanged balance is displayed.

If the amount of money to be withdrawn is less than or

accepted and the new balance in the account is displayed.

If the amount to be withdrawn is greater than the amount

2) Analysis

Enter the withdrawal 50 Accepted. Balance is 50

76 Enter the withdrawal 150 Refused! Balance is 76

50 Enter the withdrawal 75 Overdraft! Balance is -

Determine what you are asked to do:

1. Interact with user via text interface

Enter balance of the account

Enter balance of the account

Enter balance of the account

2) Analysis

• Determine what you are asked to do:

2. Act differently depending on balance in

account after withdrawn:

Balance after Action withdrawal

= 0 Accept withdrawal

= -50 and < 0 Overdraft

< -50 Refuse withdrawal

3) Design

then

new balance between zero and overdraft limit

else

4) Test Plan

The Algorithm -- Refinement:

  1. Get balance and withdrawal
    1. Get balance
    2. Get withdrawal
  2. Calculate resulting balance
    1. New balance = old balance – withdrawal 3. If new balance is >= zero
    2. Indicate transaction accepted else if
  3. Indicate overdraft is used
  4. Indicate transaction rejected

• Cases that need to be tested are:

  • Balance = -
    • Withdrawal = 5, 10, 11
  • Balance = 0
    • Withdrawal = 5, 50, 51
  • Balance = 20
    • Withdrawal = 20, 70, 71

5) Implementation

NULL; statement

comments

• Start with a basic Ada framework

• To write the final program, you must:

  • Convert the refined steps to Ada
  • Write Ada code for the unrefined steps
  • Add necessary context clauses for I/O
  • Delete the
  • Remove the step numbers from the

• Bank_Framework.adb

6) Testing

Balance Withdrawal Result -40 5 OK -40 10 OK -40 11 OK 0 5 0 50 0 51 20 20 20 70 20 71

BACK

Yesterdays Robbie Event

robot behave?

1.Go back once and turn left 2.Turn right twice 3.Go back twice the distance and turn right

Control 1

Driving_Right 0

Driving_Left 1

Hit_Left_Bumper 1

Variable Name Value

• For the given input, which way will the

Hit_Right_Bumper 1

if (Hit_Left_Bumper = 1) and (Hit_Right_Bumper = 1) then if (Control = 1) then go back twice the distance S_1 (^) set Control to 0; else S_2^ go back normal distance set Control to 1; end if ; end if ;

if (Control = 1) then if (Driving_Left = 1) then turn left again; Driving_Left = 0; else turn right twice; set Driving_Right to 1; end if ; else if (Driving_Left = 0) then turn left; set Driving_Left to 1; else turn right; set Driving_Right to 1; end if ; end if ;

test_1 test_2 test_3 test_ and test_

s_1 s_

F F F F F T F T F F T T T F F T F T T T F T T T

if (Hit_Left_Bumper = 1) and (Hit_Right_Bumper = 1) then if (Control = 1) then go back twice the distance S_1 (^) set Control to 0; else S_2^ go back normal distance set Control to 1; end if ; end if ;

if (Control = 1) then if (Driving_Left = 1) then turn left again; Driving_Left = 0; else turn right twice; set Driving_Right to 1; end if ; else if (Driving_Left = 0) then turn left; set Driving_Left to 1; else turn right; set Driving_Right to 1; end if ; end if ;

test_1 test_2 test_3 test_ and test_

s_1 s_

F F F F

F F T F

F T F F

F T T F

T F F F

T F T F

T T F T

T T T T *

BACK

Little/Big-Endian

Address Big-Endian repr. of 1025

Little-Endian repr. of 1025 00 0000 0000 0000 0001 01 0000 0000 0000 0100

02 0000 0100 0000 0000 03 0000 0001 0000 0000

BACK

String Operations

Alphabet := “abcdefghijklmnopqrstuvwxyz” Response := Alphabet;

Alphabet(1..3) & Alphabet(26..26)

Alphabet & “.”);

Sub-strings

  • alphabet(10) 'j' alphabet(17) 'q'
  • alphabet(20..23) "tuvw" alphabet(4..9) "defghi"
  • response(1..4) := "FRED"; response "FREDefghijklmnopqrstuvwxyz"

• Assignment

• Concatenation (&)

Put(Item => “The alphabet is “ &

• Individual character: specify position

• Slice: specify range of positions

• Assign to compatible slice

String I/O

  • Get(Item => A_String);
  • Get_Line(Item => A_String, Last => N);

BACK

• Text_Io

  • Output: Put, Put_Line
  • Get
    • Exact length needed
  • Get_Line
    • Variable length accepted
    • Returns string and length