c10_ps04_fall03

c10_ps04_fall03 - choice. b. Accept a choice c. Prompt the...

Info iconThis preview shows pages 1–2. Sign up to view the full content.

View Full Document Right Arrow Icon
UNIFIED ENGINEERING Fall 2003 I. Kristina Lundqvist 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 ;
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
__________________________________________________ __________________________________________________ 2. 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. 3. 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
Background image of page 2
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: 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 Names 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...
View Full Document

Page1 / 2

c10_ps04_fall03 - choice. b. Accept a choice c. Prompt the...

This preview shows document pages 1 - 2. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online