Git Product home page Git Product logo

idk's People

Contributors

ibrahuehue avatar

Watchers

 avatar

idk's Issues

Ty

set SERVEROUTPUT ON
set verify off
-- PL/SQL Block
declare
v_name VARCHAR2(10); -- uninitialized (NULL)
v_income number default 1200; -- initialized (NOT NULL) by default
v_car boolean := null; -- NOT printable -- initialized (NOT NULL) by :=
begin
-- Assign value to variable:
v_car := &val;
v_name := 'Ali'; v_income := v_income + 20;
DBMS_OUTPUT.PUT_LINE
('My First Program ' || v_income || chr(10) || ' My name is ' || v_name);
if v_car = true then
DBMS_OUTPUT.PUT_LINE ('Applicable to SALES job');
elsif v_car is null then
DBMS_OUTPUT.PUT_LINE ('N/A');
else
DBMS_OUTPUT.PUT_LINE ('NO Sales Job');
end if;
end;
/

begin
DBMS_OUTPUT.PUT_LINE ('Another program');
end;
/
--- Loops
DECLARE
cnt number default &x;
begin
-- basic loop: code executed ONE or more times
loop
DBMS_OUTPUT.PUT_LINE(cnt);
exit when cnt < 10;
cnt := cnt -2;
end loop;
end;
/
DECLARE
cnt number default &x;
begin
-- while loop: code executed ZERO or more times
while cnt >= 10 loop
DBMS_OUTPUT.PUT_LINE(cnt);
cnt := cnt -3;
end loop;
end;
/
-- for loop: : code executed N times
begin
for cnt in reverse 1..10 loop
DBMS_OUTPUT.PUT_LINE(cnt);
end loop;
end;
/
-- PLSQL Interaction with SQL
-- DMLs: Feel free to use them
select sum(salary) from employees;
/
declare
v_inc number DEFAULT &val;
v_new_total number;
begin
UPDATE employees set salary = salary + v_inc;
commit;
-- SELECT inside PLSQL (With RULES!!!)
-- 1. MUST use SELECT INTO variable
-- 2. SELECT MUST return SINGLE row
select sum(salary) into v_new_total from employees;
DBMS_OUTPUT.PUT_LINE('Total after increase is ' || v_new_total);
end;
/
/* SQL Cursors: memory area with a pointer:
-Implicit cursor (named and used by SYSTEM) -- FOR SINGLE ROW return

  • Explicit cursor (named and used by DEVELOPER) -- FOR N ROWS return
  • With both: you can determine the outcome inside PL/SQL using cusor attributes */
    declare
    v_dept employees.department_id%type DEFAULT &x ; -- Table.column%TYPE attribute.
    begin
    update employees set salary = salary + 100 where department_id = v_dept;
    commit;
    -- Implicit cursor attributes:
    if sql%notfound then DBMS_OUTPUT.PUT_LINE('No such dept ' || v_dept);
    else

end;

Iii

package pkg;

public class MyClass {

/*
 Class: Template for Objects
 Object: Instance of Class
 */

public static void main(String[] args) {

	// TEST 1: 
	 System.out.println(" *** Using the class ChildPerson ***  ");
	
	
	 /* Object creation */
      ChildPerson myChildPerson = new ChildPerson( "Faares" );

      /* Call class method to set ChildPerson's age */
      myChildPerson.setAge( 6 );

      /* Call another class method to get ChildPerson's age */
      myChildPerson.getAge( );

      /* You can access instance variable as follows as well */
      System.out.println("Variable Value :" + myChildPerson.ChAge );
      /* Create two objects using constructor */
      
  	// TEST 2: 
		 System.out.println(" ### Using the class Employee ###  ");
      
      Employee empOne = new Employee("Ahmed Ali");
      Employee empTwo = new Employee("Louloa Al Kandary");

      // Invoking methods for each object created
      empOne.empAge(26);
      empOne.empDesignation("Senior Software Engineer");
      empOne.empSalary(1000);
      empOne.printEmployee();

      empTwo.empAge(21);
      empTwo.empDesignation("Software Engineer");
      empTwo.empSalary(500);
      empTwo.printEmployee();
      
  	// TEST 3: 
		 System.out.println(" ^^^ Using the class ConstClass ^^^  ");
      
      ConstClass t1 = new ConstClass();
      ConstClass t2 = new ConstClass();
      t2.num +=50;
      System.out.println(t1.num + " " + t2.num);
      ConstClass t3 = new ConstClass( 10 );
      ConstClass t4 = new ConstClass( 20 );
      System.out.println(t3.x + " " + t4.x);
      
      // TEST4:   Exercise ..... 
      

}

}

Test

JAVA Practice Exam:
Phase 1

  • Create a NEW project with YOURNAME, and create 2 packages with the names pkg1, pkg2.
  • in pkg2:
  • create a class named BASE with the main method for testing everything one by one during all the exam phases.

Phase 2
Create the following structure:

  • An interface called Intr with at least 2 methods and 1 variable
  • A class called PCss that implements the Intr interface
  • A class called CCss that is to be a child of PCss
  • A method in CCss with the same name of one of the 2 methods in PCss that REPLACES its code.
  • Another method in CCss with the same name of one of the 2 methods in PCss that APPENDS its code.
  • Make use of PUBLIC , PRIVATE and PROTECTED keywords with different variables that shows how to use them the right way! (feel free to use any method or variable names).
  • Test everything in the BASE class (main method); showing at least one polymorphism scenario.

Phase 3

  • in the BASE class (main method).
    Create the following lists:
  • A list that contain only NAMES
  • A list that contain IDs and NAMES
  • Sort the 2nd one with NAMES (Z-A)

feel free to use the way you see it the best (no restrictions about what did you use)

Phase 4

  • in the BASE class (main method).
  • use any String variable to load any contents from text file to the variable
  • code Exception Handling with that case using the try with resources way.

Phase 5

in any of the above phases ,,, make use of Constructors (with and without parameters).

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.