How can i make this game to be over in 3 minutes?

i'm really a total beginner, and this is the race game code for my school assignment.
How can i possibly make this game to be over in 3 minutes?
It says "game over" when you hit 20 cars.
I want to make it say "you've made it!" or something when they survive for 3 minutes with less than 20 crashes.
please help! T.T
import java.awt.*;
import java.applet.*;
import java.awt.event.*;
import java.util.*;
import javax.swing.Timer;
public class BugRace extends Applet implements KeyListener, Runnable{
  Image buff;
  Canvas Panel;
  Graphics2D gPanel;
  Graphics2D gBuffer;
  Bug redBug;
  Bug[] rivals=new Bug[20];
  Button StartButton;
  //Button StopButton;
  Thread game;
  Timer time;
  private boolean loop=true;
  Dimension dim=new Dimension(200, 300);
  private int road;
  Random rnd=new Random();
  private int crash = 0;
  public void init(){     
    prepareResource();
    setBackground(Color.gray);
    setSize(400,400);
    initPanel();
    add(Panel);
    // Start Button
    StartButton=new Button("START");
    add(StartButton);
    StartButton.addActionListener(new ActionListener(){
      public void actionPerformed(ActionEvent ae){
        // request focus for Panel to get key event
        Panel.requestFocus();
        if(!game.isAlive()){
             game.start();}else if(game.isAlive()){
             game.start();}
    /*StopButton=new Button("STOP");
    add(StopButton);
    //StopButton.addActionListener(new ActionListener(){
     public void actionPerformed(ActionEvent ae){
        //Panel.requestFocus();
          if(game.isAlive())
               game.stop();}
  public void prepareResource(){ //load bug images
    Image imgRed=getImage(getCodeBase(),"redbug.gif");
    Image imgBlue=getImage(getCodeBase(),"bluebug.gif");
    Image imgYellow=getImage(getCodeBase(),"yellowbug.gif");
    Image imgPurple=getImage(getCodeBase(),"purplebug.gif");
    MediaTracker mt=new MediaTracker(this);
    try{
      mt.addImage(imgRed, 0);
      mt.addImage(imgBlue, 1);
      mt.addImage(imgYellow, 2);
      mt.addImage(imgPurple, 3);
      mt.waitForAll();
    }catch(Exception e){}
    buff=createImage((int)dim.getWidth(), (int)dim.getHeight());
    gBuffer=(Graphics2D)buff.getGraphics();
    redBug=new Bug(imgRed, 80,250, dim);  // user's bug
    for(int i=0;i<10;i++){
       rivals=new Bug(imgBlue, 0, 0); // rival blue bug
for(int i=5;i<rivals.length;i++){
rivals[i]=new Bug(imgYellow, 0, 0); // rival yellow bug
for(int i=10;i<rivals.length;i++){
rivals[i]=new Bug(imgPurple, 0, 0); // rival purple bug
for(int i=0;i<rivals.length;i++){  // set locations for rival bugs
setrivals(i);
game=new Thread(this); // game thread for controlling
public void stop(){
loop=false; // stop the thread
public void run(){
while(loop){
drawPanel(); // draw game screen
try{ Thread.sleep(50);}catch(Exception e){}
public void initPanel(){    // initialize the panel
Panel=new Canvas(){
public void paint(Graphics g){
if(gPanel==null){
     gPanel=(Graphics2D)Panel.getGraphics();
drawPanel();
Panel.setSize(dim); // size of the panel
Panel.addKeyListener(this); //add keylistener for the game
// set rival bugs' location randomly, and make them not intersect each other
void setrivals(int en){ 
int x, y;
next:while(true){
x=rnd.nextInt((int)dim.getWidth()-rivals[en].getWidth());
y=-rnd.nextInt(5000)-200;
// if (x,y) intersect to each other, go to next
for(int j=0;j<rivals.length;j++){
if(j!=en && rivals[j].collision(x, y))continue next;
// set (x, y) as en rival bug's location and exit from while loop.
rivals[en].setLocation(x, y);
break;
void check(Bug en){       // check if bugs collides
if(redBug.collision(en)){        // if collide,
if(redBug.getX()>en.getX()){  // if rival bug is on the left side from user's,            
en.move(-10, 0); // move rival bug in 10 to the left
redBug.move(10, 0); // move user's bug in 10 to the right
crash++;          //add # of crash
else{                     // if rival bug is on the right side from user's,
en.move(10,0); // move rival bug in 10 to the right
redBug.move(-10, 0); // move user's bug in 10 to the left
crash++;          //add # of crash
synchronized void drawPanel(){                        // draw panel
gBuffer.clearRect(0, 0, (int)dim.getWidth(), (int)dim.getHeight()); //clear buffer
gBuffer.setPaint(new Color(0, 150, 0));          //fill background in green
gBuffer.fillRect(0, 0, (int)dim.getWidth(), (int)dim.getHeight());
drawRoad(); // draw the road
// draw rival bugs moving down
for(int i=0;i<rivals.length;i++){
rivals[i].move(0, 15); // move rival bugs down
rivals[i].draw(gBuffer, Panel); // draw the bugs in panel
if(rivals[i].getY()>dim.getHeight()){ //if a rival bug is out of panel
     setrivals(i);} // set it at initial position
          check(rivals[i]); // check if they intersect
redBug.draw(gBuffer, Panel); // draw user's bug
gPanel.drawImage(buff, 0,0, Panel); // draw buffer in panel
if(crash<20){
     gPanel.setFont(new Font(null,Font.BOLD,15));
     gPanel.drawString("crash:"+crash,30, 30);}
else{
     gPanel.setFont(new Font(null,Font.BOLD,15));
     gPanel.drawString("crash:"+crash,30, 30);
     gPanel.setFont(new Font(null,Font.BOLD,20));
     gPanel.drawString("Game Over", 50, 100);
          gPanel.dispose();
void drawRoad(){ // draw yellow center line
road+=80;
gBuffer.setPaint(Color.yellow);
gBuffer.fillRect((int)dim.getWidth()/2, road,10,150);
if(road>=dim.getHeight()){ //if the line goes lower than  panel
     road=-150;                    //move it up again
}else if(crash >20){
     road=0;
public void keyPressed(KeyEvent ke){       
if(ke.getKeyCode()==KeyEvent.VK_LEFT){     // if left arrow is pressed,
redBug.move(-20,0); // the bug moves to the left
else if(ke.getKeyCode()==KeyEvent.VK_RIGHT){  // if right arrow is pressed
redBug.move(20,0); // the bug moves to the right
public void keyReleased(KeyEvent ke){}
public void keyTyped(KeyEvent ke){}

import java.util.Timer;
import java.util.TimerTask;
public class Test {
    public static void main (String[] args) {
        final Timer timer = new Timer ();
        System.out.println ("I'm gonna do something in 5 seconds.");
        timer.schedule (new TimerTask () {
            public void run () {
                System.out.println ("Time's up !");
                timer.cancel ();
        }, 5000);
}if you want to display the time left it's better to make your own Thread that updates a "timeleft variable:
{code}
public class Test {
//set the time Left to 3 mins.
private long secondsLeft = 3 * 60;
public Test () {
new Thread (new Runnable () {
public void run () {
try {
while (secondsLeft > 0) {
//Let's update the timer every second.
Thread.sleep (1000);
secondsLeft = secondsLeft - 1;
System.out.println ("Time left: " + (secondsLeft / 60) + ":" + (secondsLeft % 60));
System.out.println ("Grats !");
} catch (InterruptedException e) {}
}).start ();
public static void main (String[] args) {
new Test ();
{code}

Similar Messages

  • I have an ipad mini. From one moment to another a document that was created and used on pages app ( on the ipad mini) does not want to open ( When pressed it states " document cant be opened). How can I make this document open again?

    I have an ipad mini. From one moment to another a document that was created and used on pages app ( on the ipad mini) does not want to open ( When pressed it states " document cant be opened). How can I make this document open again?
    I have tried back ups and  restoring, resetting, and even updating the pages app. And nothing has worked.

    I have an ipad mini. From one moment to another a document that was created and used on pages app ( on the ipad mini) does not want to open ( When pressed it states " document cant be opened). How can I make this document open again?
    I have tried back ups and  restoring, resetting, and even updating the pages app. And nothing has worked.

  • My ipod nano was synced by itunes and removed all of my music and game files. I am in the process of adding my music back one cd at a time, but there is no history of tetris that I paid for from the itunes store. How can I get this game back for my ipod?

    My ipod nano was synced by itunes and removed all of my music and game files, and replaced my music with my kids music that they have put into the current itunes library. My music is nowhere to be found on my computer, so now  I am in the long, forever process of adding my music back one cd at a time, but there is no history of tetris that I paid for from the itunes store. How can I get this game back for my ipod?

    Contact iTunes support and explain your situation to them.  They may let you redownload it at no cost.
    http://www.apple.com/support/itunes/contact.html
    If they don't, I'm afraid you'll have to purchase it again.  Sorry.
    B-rock

  • I keep Mail open on my MacBook Pro and prior to Mavericks items would open on my 27" secondary display. How can I make this happen in Mavericks?

    I keep Mail open on my MacBook Pro and prior to Mavericks items would open on my 27" secondary display. How can I make this happen in Mavericks?

    In System Preferences > Mission Control, uncheck mark Displays have seperate windows. This should bring you back to the secondary display you had before the upgrade. You may have to open Mail, the first time and place it on your secondary display. You also won't have the advantages of the dock and menus on the secondary display.
    I keep my own secondary display with these settings because I need the ability to expand a window across both displays.

  • When filling out a form, some fields copy to others when I tab to the next. How can I make this stop?

    When filling out a form, some fields copy to others when I tab to the next. How can I make this stop?

    You can't using Adobe Reader. It looks like whomever created the form used the same identifiers (names) for various fields. Each field with the same name will populate with the information used in another field of the same name. This is intentional.
    Normally when I see this, it tells me that someone created an initial field then copy/pasted it to make additional fields but forgot to change the names.

  • Just restored my iPhone from iCloud. My wife and I have always shared one iCloud ID. But since my restore, when a call comes in, it rings on both my phone and hers. How can I make this stop?

    Just restored my iPhone 5  from iCloud. My wife and I have always shared one iCloud ID. But since my restore, when a call comes in, it rings on both my phone and hers. How can I make this stop?  We had it all set up fine before the restore, and there was a trick to it in the settings.  I've noticed that since my restore, her phone has picked up what looks like the symbol of a phone in the upper right corner of the display, right next to the Bluetooth symbol.

    Hi Big Slick,
    Welcome to the Apple Support Community!
    It sounds like your iPhones may be using a new feature in iOS 8 called Continuity. The following article and information explains how to set up this feature for phone calls. You can review the information on the setup to reverse this effect. My suggestion would be to turn off FaceTime on one of the devices.
    Connect your iPhone, iPad, iPod touch, and Mac using Continuity
    Phone calls
    With Continuity, you can make and receive cellular phone calls from your iPad, iPod touch, or Mac when your iPhone is on the same Wi-Fi network.
    To make and receive phone calls, here's what you need:
    Sign in to the same iCloud account on all your devices, including your Mac.
    Your iPhone and your iPad or iPod touch need to use iOS 8 or later. Your Mac needs to use OS X Yosemite.
    All devices must be on the same Wi-Fi network.
    All devices must be signed in to FaceTime using the same iCloud account. This means any device that shares your Apple ID will get your phone calls. Look below for instructions on how to turn off iPhone cellular calls.
    Wi-Fi Calling needs to be off. Go to Settings > Phone. If you see Wi-Fi Calling, turn it off.
    Cheers,
    Joe

  • Whenever I open the browser, the check plugins page always opens in a second tab. How can I make this stop?

    Whenever I open my browser, the check plugins page keeps opening, even after I have updated all of my plugins.
    How can I make this stop?

    That is a bug with blocklisting plugins that has been fixed.<br />
    You can correct this issue by forcing the file blocklist.xml to update or wait until Firefox updates the file.<br />
    That update will remove the severity="0" flags in the file that cause the problem.
    See:
    * [/questions/832793?page=2#answer-198407]
    * http://forums.mozillazine.org/viewtopic.php?p=10899869#p10899869
    * [https://bugzilla.mozilla.org/show_bug.cgi?id=663722 Bug 663722] - The blocklist output is including severity="0" where it shouldn't be

  • I seem to be short on space for the trial download. How can I make this work????

    I seem to have less space for my download.How can I make this download happen?????? Will I have to uninstall my old Adobe Photoshop(which has long since worked) in order for this to be installed??

    What exactly are you trying to download on what system? Feel free to download to external drives to bypass the immediate bottleneck, but that may not resolve your issue once you install....
    Mylenium

  • How can I make this shape?

    How can I make this shape in fireworks:
    I want some images in my website to have rounded corners. Im doing this by adding 4 divs with background images and absolutely positioning them, one over each corner of the image. The background images are PNGs with transparent areas. This works as the site's background is a solid color, so the rounded corners dont need to actually be transparent.
    The issue im having is that the pixels on the curve need to be semi transparent. Id love to make this shape as a vector but I dont know how.
    Thanks

    Hi,
    There is another simple way to get the shape desired. Create a rounded rectangle that is twice your corner size - both width and height wise. Now adjust the rounded corners to almost make a circle (pull the yellow corner handle towards the center of the side). Now click the corner and you will be able to toggle between the different corner types. You can now either use the shape as it is (if you need it for corners of a sprite rounded rectangle) or you can cut it up to get the desired wedge.
    - Anita

  • Just upgraded to mountain lion, when I open iphoto or photoshop, the monitor color changes.  How can I make this stop?

    For some reaon, when I launch iphoto, or any other photo program, my monitor changes to a different scheme.  How can I make this stop?  Thanks.

    try disabling it, take a took at these snaps from my phone. Might not be really clear but can give you an idea
    Hope this is clear,
    Thanks for the suppport
    Nazmul

  • I want to buy lightroom 5 as standalone product. I do not want creative cloud. How can I make this possible?

    I want to buy lightroom 5 as standalone product. I do not want creative cloud. How can I make this possible?

    Thanks YKaan,
    I do not like and do not want to pay monthly, also I do not need Photoshop just want lightroom. I want to know if I can just buy and download Lightroom or if I buy the retail package I can just have the program as standalone product.

  • MacBook Pro (OS X 10.9.1) calendar continues to "connect to server" and will not allow shut down or restart. Force quit worked. How can I make this calendar "behave"?

    MacBook Pro (OS X 10.9.1) calendar continues to "connect to server" and will not allow shut down or restart. Force quit worked. How can I make this calendar usable? The problem began after I updated to Maverick.

    babowa, it seems like it is using Fuse & NTFS, so I don't think it's the classic WD + 10.9 mess, but extra WD tools & drivers can still break things MtTran.
    MrTran, if you must use unsupported disk formats on your Mac you must also consider actually paying the developers that made the trial software.
    It's probably a good idea to follow the developers removal instructions, reboot & then install one tool at a time.
    MacFuse, FuseOSX, NTFS-3G are all likley to confict if you run older versions so you need to be sure you are using the latest version. I can't remeber which one depends on the other, so you will need to read the manuals.
    When the disk is readable copy the data to another disk. You could probably do this from a Linux distro or Windows if OS X won't do it.
    If you insist on only using the trial versions you will need to reinstall Mac OS, copy data off this disk & reformat it.
    Is there any good reason for not using the Mac HFS extended format?

  • HT201317 since I have down loaded the iOS7 software my photos are no longer up loaded to my laptop. How can I make this start happeing again?

    Since I have downloaded the iOS7 software my photos no ,longer automatically sync and upload to my lap top. How can I make this happen again?

    Hi missvashenca,
    Thanks for using Apple Support Communities.  If your photos are not appearing on your computer from your iOS device anymore through Photo Stream, I'd first verify that the Photo Stream service is still enabled on your iOS device:
    iCloud: Set up Photo Stream
    http://support.apple.com/kb/PH2605
    If it is, you may also want to try switching it off and back on again.
    Likewise, I would also try this with your computer's Photo Stream settings.
    As always, I recommend backing up your photos before performing troubleshooting:
    iOS: How to back up and restore your content
    http://support.apple.com/kb/ht1766
    Cheers,
    - Ari

  • How can I make this scene in After Effects?

    The Hobbit The Desolation of Smaug. Gandalf vs The Necromancer (Sauron) - YouTube
    I am making this scene in stop motion lego. How can I make this scene, the shield vs smoke and the flaming figure, including the shots that zoom into Sauron's mouth. How do I do these shots? I am new to after effects. I have done basic smoke before, but nothing like this. I've done snow and green screen and fire, but I'd just like some help. Thank you I have CS6

    There is no plug-in or button, only careful planning based on knowledge of the process of combining layers of images into a final image. Every element in a composite is a separate layer. If you are new you need to do some basic research. There are lots of books out there that will show you the theory. Start on AMAZON or your public library. http://www.amazon.com/Effects-Visual-Compositing-Studio-Techniques/dp/0321934695/ref=sr_1_ 2?ie=UTF8&qid=1421914012&sr=8-… may be a good place to start. Once you get some knowledge you can start breaking down a shot like this:
    Layers that I see in this shot in order.
    Vignette to darken the corners of the shot
    Foreground smoke
    Lighting effects on smoke
    Foreground branches
    Middle ground actor as a track matte or mask source for
    Middle ground smoke
    Middle ground lighting effects in the smoke
    Actor on rock
    Rock to act as a mask for background lighting effects and smoke
    Rock
    Background smoke and lighting effects
    Background
    If your original footage contained the background, the rock, the actor, and the branches then your first task would be to separate each of those to a separate layer. Then you would create or shoot the smoke and lighting effects and start building the layers. You then would modify the masks and effects on each layer to create the light wrap and look of the atmosphere using blend modes. Then you would add color grading effects or overlays to simulate the lighting in the shot. If you were really doing a shot like this you would probably add some lighting cues on the set to help sell the idea that a bunch of energy was lighting up the actors face. Like Mulenium said, there may have easily been fifty folks working on this shot for several days. It's completely unreasonable to expect that you can just add a plug-in and adjust some sliders to create the effect. Every composite requires you to separate elements into layers and then sandwich the elements you need to create and sell the effect you want to sell.

  • How can I make this join in ADF and make CRUD operation in this

    How to make this relation in ADF
    I have table employees and this is my master table
    Table Name: Employees
    Columns:
    Employee_id(PK)
    Employee_name
    Employee_Salary
    I have a child table that is called related employee that contains employees related to this employee
    Table_name: Related_Employee
    Columns:
    Related_Employee_Table_Id(PK)
    Employee_id(FK)
    Related_Employee_Id
    When I open employee id = 100 for example and add related employee id = 10
    this is added with no problem but the requirement is that when I open employee 10 I find employee id 100 as related employee
    How can I make this scenario.

    The best way to understand this is to look at an example. If you are using an oracle database such as XE for you have a schema called hr. This shema has a number of tables two of which are departments and employees. a department has multiple employees correct. So in your example a employee may be related to x # of other employees perhaps. A very similar scenario as that in the hr Schema. If you don't have an Oracle XE database, download one from here -> http://www.oracle.com/technetwork/database/express-edition/downloads/index.html
    Create Business Components off of the Departments and Employees schema and you'll see that due to the db design, you get what you're talking about for free (i.e. the join). Thus, you have the master-detail relationship you're looking for. For a quick tip, here is the relationship between departments and employees in the hr schema via a create script that you can exam with data inserts included:
    SET SQLBLANKLINES ON
    CREATE TABLE DEPARTMENTS
    DEPARTMENT_ID NUMBER(4, 0) NOT NULL
    , DEPARTMENT_NAME VARCHAR2(30 BYTE) NOT NULL
    , MANAGER_ID NUMBER(6, 0)
    , LOCATION_ID NUMBER(4, 0)
    , CONSTRAINT DEPT_ID_PK PRIMARY KEY
    DEPARTMENT_ID
    USING INDEX
    CREATE UNIQUE INDEX DEPT_ID_PK ON DEPARTMENTS (DEPARTMENT_ID ASC)
    LOGGING
    TABLESPACE "USERS"
    PCTFREE 10
    INITRANS 2
    STORAGE
    INITIAL 65536
    MINEXTENTS 1
    MAXEXTENTS UNLIMITED
    BUFFER_POOL DEFAULT
    ENABLE
    LOGGING
    TABLESPACE "USERS"
    PCTFREE 10
    INITRANS 1
    STORAGE
    INITIAL 65536
    MINEXTENTS 1
    MAXEXTENTS UNLIMITED
    BUFFER_POOL DEFAULT
    CREATE TABLE EMPLOYEES
    EMPLOYEE_ID NUMBER(6, 0) NOT NULL
    , FIRST_NAME VARCHAR2(20 BYTE)
    , LAST_NAME VARCHAR2(25 BYTE) NOT NULL
    , EMAIL VARCHAR2(25 BYTE) NOT NULL
    , PHONE_NUMBER VARCHAR2(20 BYTE)
    , HIRE_DATE DATE NOT NULL
    , JOB_ID VARCHAR2(10 BYTE) NOT NULL
    , SALARY NUMBER(8, 2)
    , COMMISSION_PCT NUMBER(2, 2)
    , MANAGER_ID NUMBER(6, 0)
    , DEPARTMENT_ID NUMBER(4, 0)
    , CONSTRAINT EMP_EMP_ID_PK PRIMARY KEY
    EMPLOYEE_ID
    USING INDEX
    CREATE UNIQUE INDEX EMP_EMP_ID_PK ON EMPLOYEES (EMPLOYEE_ID ASC)
    LOGGING
    TABLESPACE "USERS"
    PCTFREE 10
    INITRANS 2
    STORAGE
    INITIAL 65536
    MINEXTENTS 1
    MAXEXTENTS UNLIMITED
    BUFFER_POOL DEFAULT
    ENABLE
    LOGGING
    TABLESPACE "USERS"
    PCTFREE 10
    INITRANS 1
    STORAGE
    INITIAL 65536
    MINEXTENTS 1
    MAXEXTENTS UNLIMITED
    BUFFER_POOL DEFAULT
    CREATE INDEX DEPT_LOCATION_IX ON DEPARTMENTS (LOCATION_ID ASC)
    LOGGING
    TABLESPACE "USERS"
    PCTFREE 10
    INITRANS 2
    STORAGE
    INITIAL 65536
    MINEXTENTS 1
    MAXEXTENTS UNLIMITED
    BUFFER_POOL DEFAULT
    CREATE INDEX EMP_DEPARTMENT_IX ON EMPLOYEES (DEPARTMENT_ID ASC)
    LOGGING
    TABLESPACE "USERS"
    PCTFREE 10
    INITRANS 2
    STORAGE
    INITIAL 65536
    MINEXTENTS 1
    MAXEXTENTS UNLIMITED
    BUFFER_POOL DEFAULT
    CREATE INDEX EMP_JOB_IX ON EMPLOYEES (JOB_ID ASC)
    LOGGING
    TABLESPACE "USERS"
    PCTFREE 10
    INITRANS 2
    STORAGE
    INITIAL 65536
    MINEXTENTS 1
    MAXEXTENTS UNLIMITED
    BUFFER_POOL DEFAULT
    CREATE INDEX EMP_MANAGER_IX ON EMPLOYEES (MANAGER_ID ASC)
    LOGGING
    TABLESPACE "USERS"
    PCTFREE 10
    INITRANS 2
    STORAGE
    INITIAL 65536
    MINEXTENTS 1
    MAXEXTENTS UNLIMITED
    BUFFER_POOL DEFAULT
    CREATE INDEX EMP_NAME_IX ON EMPLOYEES (LAST_NAME ASC, FIRST_NAME ASC)
    LOGGING
    TABLESPACE "USERS"
    PCTFREE 10
    INITRANS 2
    STORAGE
    INITIAL 65536
    MINEXTENTS 1
    MAXEXTENTS UNLIMITED
    BUFFER_POOL DEFAULT
    ALTER TABLE EMPLOYEES
    ADD CONSTRAINT EMP_EMAIL_UK UNIQUE
    EMAIL
    USING INDEX
    CREATE UNIQUE INDEX EMP_EMAIL_UK ON EMPLOYEES (EMAIL ASC)
    LOGGING
    TABLESPACE "USERS"
    PCTFREE 10
    INITRANS 2
    STORAGE
    INITIAL 65536
    MINEXTENTS 1
    MAXEXTENTS UNLIMITED
    BUFFER_POOL DEFAULT
    ENABLE;
    ALTER TABLE DEPARTMENTS
    ADD CONSTRAINT DEPT_LOC_FK FOREIGN KEY
    LOCATION_ID
    REFERENCES LOCATIONS
    LOCATION_ID
    ENABLE;
    ALTER TABLE DEPARTMENTS
    ADD CONSTRAINT DEPT_MGR_FK FOREIGN KEY
    MANAGER_ID
    REFERENCES EMPLOYEES
    EMPLOYEE_ID
    ENABLE;
    ALTER TABLE EMPLOYEES
    ADD CONSTRAINT EMP_DEPT_FK FOREIGN KEY
    DEPARTMENT_ID
    REFERENCES DEPARTMENTS
    DEPARTMENT_ID
    ENABLE;
    ALTER TABLE EMPLOYEES
    ADD CONSTRAINT EMP_JOB_FK FOREIGN KEY
    JOB_ID
    REFERENCES JOBS
    JOB_ID
    ENABLE;
    ALTER TABLE EMPLOYEES
    ADD CONSTRAINT EMP_MANAGER_FK FOREIGN KEY
    MANAGER_ID
    REFERENCES EMPLOYEES
    EMPLOYEE_ID
    ENABLE;
    ALTER TABLE DEPARTMENTS
    ADD CONSTRAINT DEPT_NAME_NN CHECK
    (DEPARTMENT_NAME IS NOT NULL)
    ENABLE;
    ALTER TABLE EMPLOYEES
    ADD CONSTRAINT EMP_EMAIL_NN CHECK
    (EMAIL IS NOT NULL)
    ENABLE;
    ALTER TABLE EMPLOYEES
    ADD CONSTRAINT EMP_HIRE_DATE_NN CHECK
    (HIRE_DATE IS NOT NULL)
    ENABLE;
    ALTER TABLE EMPLOYEES
    ADD CONSTRAINT EMP_JOB_NN CHECK
    (JOB_ID IS NOT NULL)
    ENABLE;
    ALTER TABLE EMPLOYEES
    ADD CONSTRAINT EMP_LAST_NAME_NN CHECK
    (LAST_NAME IS NOT NULL)
    ENABLE;
    ALTER TABLE EMPLOYEES
    ADD CONSTRAINT EMP_SALARY_MIN CHECK
    (SALARY > 0)
    ENABLE;
    COMMENT ON TABLE DEPARTMENTS IS 'Departments table that shows details of departments where employees
    work. Contains 27 rows; references with locations, employees, and job_history tables.';
    COMMENT ON TABLE EMPLOYEES IS 'employees table. Contains 107 rows. References with departments,
    jobs, job_history tables. Contains a self reference.';
    COMMENT ON COLUMN DEPARTMENTS.DEPARTMENT_ID IS 'Primary key column of departments table.';
    COMMENT ON COLUMN DEPARTMENTS.DEPARTMENT_NAME IS 'A not null column that shows name of a department. Administration,
    Marketing, Purchasing, Human Resources, Shipping, IT, Executive, Public
    Relations, Sales, Finance, and Accounting. ';
    COMMENT ON COLUMN DEPARTMENTS.MANAGER_ID IS 'Manager_id of a department. Foreign key to employee_id column of employees table. The manager_id column of the employee table references this column.';
    COMMENT ON COLUMN DEPARTMENTS.LOCATION_ID IS 'Location id where a department is located. Foreign key to location_id column of locations table.';
    COMMENT ON COLUMN EMPLOYEES.EMPLOYEE_ID IS 'Primary key of employees table.';
    COMMENT ON COLUMN EMPLOYEES.FIRST_NAME IS 'First name of the employee. A not null column.';
    COMMENT ON COLUMN EMPLOYEES.LAST_NAME IS 'Last name of the employee. A not null column.';
    COMMENT ON COLUMN EMPLOYEES.EMAIL IS 'Email id of the employee';
    COMMENT ON COLUMN EMPLOYEES.PHONE_NUMBER IS 'Phone number of the employee; includes country code and area code';
    COMMENT ON COLUMN EMPLOYEES.HIRE_DATE IS 'Date when the employee started on this job. A not null column.';
    COMMENT ON COLUMN EMPLOYEES.JOB_ID IS 'Current job of the employee; foreign key to job_id column of the
    jobs table. A not null column.';
    COMMENT ON COLUMN EMPLOYEES.SALARY IS 'Monthly salary of the employee. Must be greater
    than zero (enforced by constraint emp_salary_min)';
    COMMENT ON COLUMN EMPLOYEES.COMMISSION_PCT IS 'Commission percentage of the employee; Only employees in sales
    department elgible for commission percentage';
    COMMENT ON COLUMN EMPLOYEES.MANAGER_ID IS 'Manager id of the employee; has same domain as manager_id in
    departments table. Foreign key to employee_id column of employees table.
    (useful for reflexive joins and CONNECT BY query)';
    COMMENT ON COLUMN EMPLOYEES.DEPARTMENT_ID IS 'Department id where employee works; foreign key to department_id
    column of the departments table';

Maybe you are looking for