0% found this document useful (0 votes)
258 views

PL SQL Exercise3

The document outlines 8 PL/SQL exercises that involve accepting user input and performing conditional logic and calculations. The exercises include: 1) checking if a number is within a given range, 2) validating sides of a triangle, 3) checking if a year is a leap year, 4) calculating cost based on weight and rate, 5) outputting age classification, 6) checking for substring match, 7) outputting student grade based on score range, and 8) calculating order discounts based on product and amount. The output is displayed for each exercise using dbms_output.put_line.

Uploaded by

Nishant Andhale
Copyright
© Attribution Non-Commercial (BY-NC)
Available Formats
Download as DOC, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
258 views

PL SQL Exercise3

The document outlines 8 PL/SQL exercises that involve accepting user input and performing conditional logic and calculations. The exercises include: 1) checking if a number is within a given range, 2) validating sides of a triangle, 3) checking if a year is a leap year, 4) calculating cost based on weight and rate, 5) outputting age classification, 6) checking for substring match, 7) outputting student grade based on score range, and 8) calculating order discounts based on product and amount. The output is displayed for each exercise using dbms_output.put_line.

Uploaded by

Nishant Andhale
Copyright
© Attribution Non-Commercial (BY-NC)
Available Formats
Download as DOC, PDF, TXT or read online on Scribd
You are on page 1/ 2

PL*SQL Exercise 3

1. Input a number and determine whether it is within a given range (for example, between 1 and 10). The low and high values of the range may be input by the user rather than be fixed by the program. Display the output on the screen using dbms_output.put_line. 2. Input three positive integers representing the sides of a triangle, and determine whether they form a valid triangle. Hint: In a triangle, the sum of any two sides must always be greater than the third side. Display the output on the screen using dbms_output.put_line. 3. Check if a given a year is a leap year. The condition is:year should be (divisible by 4 and not divisible by 100) or (divisible by 4 and divisible by 400.) Display the output on the screen using dbms_output.put_line. The year should be input by the user. 4. Ask the user to enter the weight of an apple box. If the weight is >= 10 kg, rate =Rs. 5/kg weight is < 10 kg, rate = Rs. 7/kg Calculate the cost of the apple box. Display the output on the screen using dbms_output.put_line. 5. Program should accept the age of the user. Depending upon the following conditions it should output:age <18 years, child age >= 18 years and <21 years, major age>= 21years adult Display the output on the screen using dbms_output.put_line. 6. Write a program that asks the user to input two character strings. Your program should then determine if one character string exists inside another character string. Display the above on the screen using dbms_output.put_line. 7. Suppose the grade obtained by a student depends upon his scores and the grading rule is as follows. :Scores Grades 95-100 A 85-94 B 70-84 C 60-69 D 0-59 E Sameer Dehadrai Page: 1

Write a block to accept a students marks and accordingly output his grade. Display the output on the screen using dbms_output.put_line. 8. A company manufactures three products:- computer stationery, fixed disks and computers. The following codes are used to indicate them:Product Code Computer Stationery 1 Fixed Disks 2 Computers 3 The company has a discount policy as follows:Product Order amount Discount rate Computer stationery Rs. 5000 or more 12% Computer stationery Rs. 3000 or more 8% Computer stationery Below Rs. 3000 2% Fixed disks Rs. 20000 or more 10% Fixed disks Rs. 15000 or more 5% Computers Rs. 50000 or more 10% Computers Rs. 25000 or more 5% Write a program to accept the order details i.e. product code and order amounts for the products, calculate the discount amounts as per this policy and output the net order amount. Display the output on the screen using dbms_output.put_line.

Sameer Dehadrai

Page: 2

You might also like