Ada95 Program For Simple Package-Aeronautical Engineering And Computer Programming-Assignment, Exercises of Computer Engineering and Programming

This assignment is for Computer Programming course. It was assigned by Prof. Anurag Negi at KIIT University. It includes: Ada95, Else, If, Programming, Value, Code, Prompt, Function, Case, Copy

Typology: Exercises

2011/2012

Uploaded on 07/20/2012

savitri_85
savitri_85 🇮🇳

4

(5)

70 documents

1 / 2

Toggle sidebar

This page cannot be seen from the preview

Don't miss anything!

bg1
Problem C10. (Unified Computers and programming)
1. Explain the difference between the statements on the left and the statements on
the right below. For each of them, what is the final value of X if the initial value
of X is 3?
IF x >= 0 THEN IF x >= 0 THEN
x:= x+1; x := x + 1;
ELSIF x >=1 THEN END IF;
x := x + 2; IF x >= 1 THEN
END IF; x := x + 2;
END IF;
docsity.com
pf2

Partial preview of the text

Download Ada95 Program For Simple Package-Aeronautical Engineering And Computer Programming-Assignment and more Exercises Computer Engineering and Programming in PDF only on Docsity!

Problem C10. (Unified Computers and programming)

  1. Explain the difference between the statements on the left and the statements on the right below. For each of them, what is the final value of X if the initial value of X is 3?

IF x >= 0 THEN IF x >= 0 THEN x:= x+1; x := x + 1; ELSIF x >=1 THEN END IF ; x := x + 2; IF x >= 1 THEN END IF ; x := x + 2; END IF ;

docsity.com

__________________________________________________

__________________________________________________

  1. Write a simple package that contains a. A function to add two integers. b. A procedure to multiply two integers.

Turn in a hard copy of your code listing and an electronic copy of your code.

  1. Write an Ada95 program that uses the package defined in Problem 2. Your program should: a. Display a menu to the user as shown in Figure 1, and prompt him/her for a choice. b. Accept a choice c. Prompt the user for the inputs. d. Clear the screen and display the result as shown below in Figure 2.

Turn in a hard copy of your algorithm and code listing, and an electronic copy of your code. Hint : Use a case statement to select the required function/ procedure from the package.

Your Name’s Program to Implement Simple Math Functions

  1. Add Two Numbers
  2. Multiply Two Integers
  3. Quit

Please Enter Your Choice (1-3):

Figure 1 : Menu Display

If the numbers are First_Number and Second_Number,

If the User Selects 1, the output should be:

Adding First_Number and Second_Number: First_number + Second_Number = Sum

If the User Selects 2, the output should be

Multiplying First_Number and Second_Number: First_number * Second_Number = Sum

Figure 2 : Displaying Outputs

docsity.com