Question

In: Computer Science

PL/SQL Write a PL/SQL block, using a Case Statement that prints a student’s letter     grade...

PL/SQL

Write a PL/SQL block, using a Case Statement that prints a student’s letter

    grade based on the value stored in a variable called grade. Use the ACC

     grading system described in the course syllabus to create the block and set

    the initial value of grade as 95. Use only one print statement and no

     logical operators in your code. Assume a grade can exceed 100, but it

     can’t be negative.

Grade Scale:

Grade Scale:

90 % - 100 %

A

80 % - 89 %

B

70 % - 79 %

C

60 % - 69 %

D

0 % - 59 %

F

Solutions

Expert Solution

PL/SQL Block:

DECLARE

  grade NUMBER := 95;

  letter_grade  VARCHAR2(2);

BEGIN

  letter_grade := CASE

                 WHEN grade BETWEEN 90 AND 100 THEN 'A'

                 WHEN grade BETWEEN 80 AND 89 THEN 'B'

                 WHEN grade BETWEEN 70 AND 79 THEN 'C'

                 WHEN grade BETWEEN 60 AND 69 THEN 'D'

                 WHEN grade BETWEEN 0 AND 59 THEN 'F'

                 ELSE 'NA'

              END;

  DBMS_OUTPUT.PUT_LINE('Letter grade is ' || letter_grade);

END;

Code Snippet (For Indentation):

Result:


Related Solutions

PL/SQL Write a PL/SQL block, using a While Loop, to calculate and print the sum of...
PL/SQL Write a PL/SQL block, using a While Loop, to calculate and print the sum of the odd integers from 10 to 120 inclusive. (Hint: 11 + 13 + 15 + . . . + 97 + 99)
Write a PL/SQL program that prints following: if sum of its digits raised to the power...
Write a PL/SQL program that prints following: if sum of its digits raised to the power n is equal to number itself, where n is total digits in number. If the Input is: 129, then output of the program will be: 738
Assignment 2- 9   USING A FOR LOOP Create a PL/SQL block using a FOR loop to...
Assignment 2- 9   USING A FOR LOOP Create a PL/SQL block using a FOR loop to generate a payment schedule for a donor’s pledge, which is to be paid monthly in equal increments. The values variable for the block is starting payment due date, monthly payment amount, and a number of total monthly payments for the pledge. The list that’s generated should display a line for each monthly payment showing payment number, date due, payment amount, and donation balance (remaining...
ORACLE TASK 2-2 USING A FOR LOOP Create a PL/SQL block using a FOR loop to...
ORACLE TASK 2-2 USING A FOR LOOP Create a PL/SQL block using a FOR loop to generate a payment schedule for a donor’s pledge, which is to be paid monthly in equal increments. Values variable for the block are starting payment due date, monthly payment amount and number of total monthly payments for the pledge. The list that’s generated should display a line for each monthly payment showing payment number, date due, payment amount, and donation balance (remaining amount of...
Create a PL/SQL block to retrieve and display data for all pledges made in a specified...
Create a PL/SQL block to retrieve and display data for all pledges made in a specified month. One row of output should be displayed for each pledge. Include the following in each row of output:    - Pledge ID, donor ID, and Pledge Amount - If the pledge is being paid in a lump sum, display "LUMP SUM". - If the pledge is being paid in monthly payments, display "Monthly - #" (With the # representing the number of months...
Write a program that translates a letter grade into a number grade. Letter grades are A,...
Write a program that translates a letter grade into a number grade. Letter grades are A, B, C, D, and F, possibly followed by + or -. Their numeric values are 4, 3, 2, 1 and 0. There is no F+ or F-. A “+” increases the numeric value by 0.3, a “–“ decreases it by 0.3. However, an A+ has value 4.0.4 pts Enter a Letter grade: B- The numeric value is 2.7 Your code with comments A screenshot...
HOW TO: 1. Write the SQL statement to show workers with names that have the letter...
HOW TO: 1. Write the SQL statement to show workers with names that have the letter ? before the last character. 2. Write the SQL statement to show all staff where the 2nd letter of their last names is ′?′ 3. Write the SQL statement to show all staff where the 1stletter of their first names is ′?′ and 3rd letter ′ℎ' DROP TABLE IF EXISTS staff; CREATE TABLE staff ( staffNo VARCHAR(4) UNIQUE, fName VARCHAR(16), lName VARCHAR(16), position VARCHAR(16),...
Utilize the Outdoor Clubs & Product database to create a PL/SQL anonymous block program unit that...
Utilize the Outdoor Clubs & Product database to create a PL/SQL anonymous block program unit that lists the product_name attribute value and a demand status text display. The demand status text display is determined by counting the number of times a product has been ordered so far. The demand status text display will be either “Low Demand” or “High Demand”. Low Demand is displayed if the product has been ordered less than 2 times. High Demand is displayed if the...
Lab 3.4 Write a program that determines a student’s grade. The student will enter a grade...
Lab 3.4 Write a program that determines a student’s grade. The student will enter a grade and the program will determine if that grade is an A, B, C, D, or E. The student can only enter number 0-100. A = 90-100 B = 80-89 C = 70-79 D= 60-69 E = 59 or less Save the file as Lab3.4 and submit the file. Use https://repl.it/ THIS LANGUAGE IS PYTHON Thank you :)
Create a PL/SQL anonymous block that uses a nested loop (inner loop 1 to 15; outer...
Create a PL/SQL anonymous block that uses a nested loop (inner loop 1 to 15; outer loop 1 to 5) to perform computations using the SQL functions, ABS, EXP, SQRT, ROUND, MIN, MAX, LOG, MOD, REMAINDER and POWER The outer loop will use the functions, ABS, EXP, SQRT, ROUND to display the following messages (must be “ The absolute value of <outer loop index> is <value>” “ The value of e to the <outer loop index> power is <value>” “...
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT