Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 4

Exercise 01.

02 - ABAP Basics
Data Handling

Note: All the following objects to be created should follow the naming convention YEMPID_##$$%%.
##$$ indicates the exercise number (01.02 for this assignment) and %% indicates the question number in
the exercise. EMPID indicates the employee ID.
Exercise 02.02 ABAP Basics Data Handling
1. An Insurance company follows following rules to calculate premium.
a. If a persons health is excellent and the person is between 25 and 35 years of age and
lives in a city and is a male then the premium is Rs.4 per thousand and his policy amount
cannot exceed Rs.2 lakhs.
b. If a person satisfies all the above conditions except that the sex is female then the
premium is Rs.3 per thousand and her policy amount cannot exceed Rs.1 lakh.
c. If a persons health is poor and the person is between 25 and 35 years of age and lives in
a village and is a male then the premium is Rs.6 per thousand and his policy cannot
exceed Rs.10, 000.
d. In all other cases the person is not insured.
Write a program to output whether the person should be insured or not, his/her premium rate and
maximum amount for which he/she can be insured. (Accept the required inputs)

2. A certain grade of steel is graded according to the following conditions:

a. Hardness must be greater than 50


b. Carbon content must be less than 0.7
c. Tensile strength must be greater than 5600

The grades are as follows:

Grade is 10 if all the three conditions are met.


Grade is 9 if conditions (a) and (b) are met.
Grade is 8 if conditions (b) and (c) are met.
Grade is 7 if conditions (a) and (c) are met.
Grade is 6 if only one condition is met.
Grade is 5 if none of the conditions are met.

Write a program, which will require the user to give values of hardness, carbon content and
tensile strength of the steel under consideration and output the grade of the steel.

- Page 2 of 4 -
Exercise 02.02 ABAP Basics Data Handling

3. Accept a number from the user to print the following output. For example, if the user enters 5, the
output would be as follows. Write a program to obtain the following output:

XX XX
XX XX
XX XX 5 lines
XX XX
XX XX
XX
XX XX
XX XX
XX XX
XX XX
XX XX

4. Write a program to find out the factorial of a given number.

5. Write a program to find out whether the given string is a palindrome or not.

6. Accept a string from the user and for each character of the string, display the character that is
immediately next to it in the alphabet and form another string. For example, if the user enters
HELLO, then the output should be IFMMP.

7. Write a program to generate the following number series. The number of numbers to be displayed
should be accepted from the user.
10, 15, 20, 21, 31, 41, 43, 63, 83.

8. Write a program to accept a number N from the user and display the first N numbers of the
fibonacci series.
Fibonacci series: 1, 1, 2, 3, 5, 8, 13, 21, 34

9. Accept 2 digits (positions) and an integer from the user and display the sum & product of the
digits present in the user specified positions. (Without using offset option). For example, if the
user enters 3, 5 and 394036187 respectively, the output should be 4 + 3 = 7 & 4 * 3 = 12.

10. Write a program to display the sum of the squares of first 25 odd numbers and sum of the squares
of first 25 even numbers.

11. Accept a number from the user and display its roman equivalent. The following table shows the
roman equivalent of the corresponding decimal numbers:

Decimal Roman
1 I
5 V
10 X
50 L
100 C
500 D
1000 M

Example: 1988 MDCCCCLXXXVIII

- Page 3 of 4 -
Exercise 02.02 ABAP Basics Data Handling
12. Write a program to accept a number from the user and print it out digit by digit as a series of
words.
For example: 1253 One thousand two hundred and fifty three.

13. Write a program to accept a string and identify and print all the distinct characters in the string in
the order of their appearance.

14. Write a program to accept a string from the user and display the following:
a. Distinct vowels
b. Distinct consonants
c. Total number of vowels (all occurrences)
d. Total number of consonants (all occurrences)

15. Write a program to simulate the functionality of STRLEN.

- Page 4 of 4 -

You might also like