HW01

.docx

School

New Jersey Institute Of Technology *

*We aren’t endorsed by this school

Course

434

Subject

Computer Science

Date

May 4, 2024

Type

docx

Pages

10

Uploaded by JusticeUniverse25366 on coursehero.com

All PL/SQL work needs to be done with SQL Developer. All database work needs to be done in Oracle. 1) a) Write a PL/SQL function called CONSTANT_E that takes an argument N and sends to the screen the number e using the following formula: CS 434 Spring 2024 HOMEWORK 1 General Instructions. Read this carefully. This is more important than the individual questions. There are NO GROUP HOMEWORKS IN THIS CLASS. YOU NEED TO WORK ALONE. 1) Do not copy code from any other person. You can ask questions and get answers, but NEVER copy code. Also, do not copy and paste English text unless I specifically permit it. NEVER. 2) SHOW EVERYTHING. Anything you don't show will be automatically assumed as not done. Don't logically argue that "of course, you must have done it." If we don't see it, then it is not done. 3) There will be no half points. Questions worth 1 point will be graded "all or nothing." Points will appear in [ ] brackets. The whole homework is worth 50 points. If you miss the due date by up to one week, there will be a late penalty of 8 points subtracted. If you miss the due date by MORE than a week you will get ZERO points. The due date is Monday, February 19, 2024, 4:00 PM. Your file name must have the format: LASTNAME_firstname_HWK1.doc (or .docx)
Example: CONSTANT_E(5) should send to the screen: N = 5, e = 2,716667 Copy/paste your PL/SQL code (both functions and main program) at the first red arrow CREATE OR REPLACE FUNCTION CONSTANT_E(N IN NUMBER) RETURN NUMBER IS e_Val number := 1; factorial number := 1; BEGIN for i IN 1..N loop e_Val := e_Val + (1 / factorial); end loop; DBMS_OUTPUT.PUT_LINE('N = ' || N || ',' || 'e = ' || e_Val); RETURN e_Val; END CONSTANT_E; / DECLARE N number; BEGIN N := CONSTANT_E(5); END; /
1) b) Write a PL/SQL function called E_to_X that takes an arguments N and X and sends to the screen the number e x using the following formula: Example: E_to_X (5,3) should send to the screen: X=3, N=5 Copy/paste your PL/SQL code (both functions and main program) at the first red arrow CREATE OR REPLACE FUNCTION E_to_X(N IN NUMBER, X IN NUMBER) RETURN NUMBER IS e_to_x number := 1; factorial number := 1; BEGIN for i in 1..N loop power_x := power_x * X; e_to_x := e_to_x + (power_x / factorial); end loop; DBMS_OUTPUT.PUT_LINE('X = ' || X || ',' || 'N = ' || N || ',' || 'e_to_x = ' || e_to_x); RETURN e_to_x; END E_to_X; / DECLARE N number; BEGIN N := E_to_X(5,3); END; /
2) The goal of this problem is to load some health data from the government into our Oracle Database and use it to answer a few questions. (This will be continued in the next homework.) Go to: https://ephtracking.cdc.gov/ Click on Explore Data STEP 1: CONTENT Click on “Select Content Area” so that you get “Drinking Water”. Choose “Public Water Use” on the second drop-down menu. Choose “Annual Number of People Receiving Water” on the third drop-down menu. STEP 2: GEOGRAPHY TYPE National by State STEP 3: GEOGRAPHY All States STEP 4: TIME 2022 2021 2020 2019 STEP 5: ADVANCED OPTIONS No Advanced Options Then download the data and save it as a DrinkingWater.CSV file. Look at the Map. Note the menu that lets you choose between the four years. Ask yourself these NON-CREDIT questions: What state has the highest value? What state has the lowest value? What does the number mean? Why do you think the state(s) with the highest value(s) have the highest value? Even though these are non-credit questions, I would like you to attempt to write answers. If they are wrong, you don’t lose anything.
Your preview ends here
Eager to read complete document? Join bartleby learn and gain access to the full version
  • Access to all documents
  • Unlimited textbook solutions
  • 24/7 expert homework help