Don't understand result of output

Hello .I'm quite new in Java and i'm stuck on this exercise.I try to understand the output but i don't really get this one.Can someone explain to me in steps why output is as it is :) it wold help me a lot.
import java.util.ArrayList;
class Uppgift2{
public static void main(String[]args){
ArrayList<Gerrf> alla = new ArrayList<Gerrf>();
alla.add(new Davvi());
alla.add(new Kyyn("Soffa"));
alla.add(new Davvi());
alla.add(new Kyyn("Skrivbord"));
for (Gerrf ge : alla)
ge.skriv();
class Gerrf{
private static int tal=0;
private String grej="Stol";
public Gerrf(){
tal++;
public Gerrf(String str){
grej=str+tal++;
public void skriv(){
for (int x=1; x<tal; x++)
System.out.print(getGrej());
System.out.println("Stopp");
public String getGrej(){
return grej;
class Kyyn extends Gerrf{
public Kyyn(String str){
super(str);
public void skriv(){
System.out.println(getGrej());
class Davvi extends Gerrf{
public String annat="Bord";
public String getGrej(){
return annat;
output is
BordBordBordStopp
Soffa1
BordBordBordStopp
Skrivbord3
Edited by: adi117 on Aug 10, 2010 4:31 AM

import java.util.ArrayList;
class Uppgift2{
public static void main(String[]args){
ArrayList<Gerrf> alla = new ArrayList<Gerrf>();
alla.add(new Davvi());
alla.add(new Kyyn("Soffa"));
alla.add(new Davvi());
alla.add(new Kyyn("Skrivbord"));
for (Gerrf ge : alla)
ge.skriv();
class Gerrf{
private static int tal=0;
private String grej="Stol";
public Gerrf(){
tal++;
public Gerrf(String str){
grej=str+tal++;
public void skriv(){
for (int x=1; x<tal; x++)
System.out.print(getGrej());
System.out.println("Stopp");
public String getGrej(){
return grej;
class Kyyn extends Gerrf{
public Kyyn(String str){
super(str);
public void skriv(){
System.out.println(getGrej());
class Davvi extends Gerrf{
public String annat="Bord";
public String getGrej(){
return annat;
}Why output is
BordBordBordStopp
Soffa1
BordBordBordStopp
Skrivbord3
Edited by: adi117 on Aug 10, 2010 6:06 AM
Edited by: adi117 on Aug 10, 2010 6:07 AM

Similar Messages

  • There were no results for I've downloaded the kindle app to my new iPad4 but when I went to Amazon UK and tried to download a book it said "this mobile app does not currently support digital downloads. I don't understand! I'm in the UK.

    There were no results for I've downloaded the kindle app to my new iPad4 but when I went to Amazon UK and tried to download a book it said "this mobile app does not currently support digital downloads. I don't understand! I was told you could download kindle books from amazon straight to iPad if you download the kindle app first. Do I have to do it onto my computer and then sync it onto iPad? surely not?

    Can you go here:
    http://www.amazon.co.uk/Kindle-eBooks/b/ref=amb_link_173148087_8?ie=UTF8&nav_sdd =aps&node=341689031&pf_rd_m=A3P5ROKL5A1OLE&pf_rd_s=center-1&pf_rd_r=1GDPPW8ZCN9Y 9NQF5VV0&pf_rd_t=101&pf_rd_p=365751407&pf_rd_i=468294
    and not log on. See what you can do.

  • Why does my search results display in Korean despite all my settings saying that my default should be American English? (Yes, I am in Korea, but don't understand Hangul.)

    I am in Korea on Business and do not speak the language. I am an American and all of my settings on my computer and browser reflect this. However whenever I type in www.google.com I am automatically redirected to http://www.google.co.kr/. When I do a search from here it is in Hangul and I don't understand it. How can I get all pages to display in English? Is there an automatic translator that does this?

    Thank you I am now more educated about Google, and the intricacies of being in other parts of the world. This solution proved perfect and I set my homepage to reflect the "/ncr" which works perfectly.

  • HT204088 I don't understand the charges on my account for Itunes.  When I asked for history online, I get no results.  Please help.

    I don't understand the charges on my credit card for itunes.  please help

    Your credit card is only linked to one iTunes account, and you've checked the purchase history on it via your computer's iTunes as per the page that you posted from ? And you don't have iTunes Match or any auto-renewing subscriptions (I'm not sure if they show on the purchase history or not, I don't have any so I can't check) : http://support.apple.com/kb/HT4098
    And you haven't added or changed your credit card details on your iTunes account ? Each time that you do so a small temporary store holding charge may be applied to check that the card details are correct and valid and that it's registered to exactly the same name and address as on your iTunes account - it should disappear off your account within a few days or so. Store holding charge : http://support.apple.com/kb/HT3702
    If you can't find anything on your account's purchase history then you should probably contact your card issuer and get the card cancelled and replaced. You can also contact iTunes Support via this page : http://www.apple.com/support/itunes/contact/ - click on Contact iTunes Store Support on the right-hand side of the page, then Purchases, Billing & Redemption
    I don't know what your second post means.

  • Wrong codes? or maybe I don't understand the instructions

    The instructions said "Write a procedure that will retrieve an
    existing record in Enrollment usiing the student and section Ids
    and set the grade to a specified value. (use update instead of
    insert) and write another procedure that will assign a given
    student a given advisor" I tried but cause I got a lot of
    errors!!! any help would be appreciated just email me at
    [email protected]. thanks!
    create sequence room_seq increment by 1;
    create sequence faculty_seq increment by 1;
    create sequence student_seq increment by 1;
    create sequence section_seq increment by 1;
    create sequence enrollment_seq increment by 1;
    create sequence room_section_seq increment by 1;
    create table course(
    courseNo varchar2(10),
    name varchar2(30),
    credits number,
    constraint course_pk primary key (courseNo));
    insert into course (courseNo, name, credits) values
    ('CIS405','ADVANCED DATABASE', 5);
    insert into course (courseNo, name, credits) values
    ('CIS349','INTRO TO DATABASE', 5);
    COMMIT;
    create table room(
    roomID number,
    bldg char(1) check (bldg IN ('A','B')),
    roomNo varchar2(10),
    maxCapacity number,
    style varchar2(15) check(style IN
    ('LECTURE','LECTURE/LAB','LAB','OFFICE')),
    constraint room_pk primary key (roomID));
    insert into room (roomID, bldg, roomNo, maxCapacity, style)
    values (room_seq.nextval, 'B', '151A', 50, 'LAB');
    insert into room (roomID, bldg, roomNo, maxCapacity, style)
    values (room_seq.nextval, 'B', '151B', 50, 'LAB');
    commit;
    create table faculty(
    facultyID number,
    lname varchar2(30) not null,
    fname varchar2(20) not null,
    dept varchar2(5),
    officeID number,
    phone varchar2(15),
    email varchar2(75),
    rank char(4) check(rank IN ('INST','ASOC','ASST','FULL','SENR')),
    constraint faculty_pk primary key (facultyID),
    constraint faculty_fk foreign key (officeID) references room
    (roomID));
    insert into faculty(facultyID, lname, fname, dept, officeID,
    phone, email, rank) values
    (faculty_seq.nextval, 'CANNON', 'AMY', 'CIS',
    6, '77052149003252', '[email protected]','FULL');
    commit;
    create table equipment(
    equipmentID varchar2(30),
    roomID number,
    type varchar2(20) check(type IN('OVERHEAD PROJECTOR','PORTABLE
    PROJECTOR','LAPTOP CONNECTION','DESKTOP COMPUTER','INTERNET
    CONNECTION')),
    constraint equipment_pk primary key (equipmentID),
    constraint equipment_fk foreign key (roomID) references room
    (roomID));
    INSERT INTO EQUIPMENT (EQUIPMENTID, ROOMID, TYPE) VALUES ('111',
    5, 'DESKTOP COMPUTER');
    INSERT INTO EQUIPMENT (EQUIPMENTID, ROOMID, TYPE) VALUES ('222',
    5, 'OVERHEAD PROJECTOR');
    commit;
    create table student(
    stuID number,
    lname varchar2(30),
    fname varchar2(20),
    street varchar2(100),
    city varchar2(60),
    state char(2),
    zip varchar2(9),
    major varchar2(5) check(major IN
    ('ACCT','ECT','EET','BIS','BSIT','CIS','TCOM')),
    standing varchar2(10) check(standing IN
    ('FRESHMAN','SOPHOMORE','JUNIOR','SENIOR')),
    gpa number(3,2),
    advisor number,
    constraint student_pk primary key (stuID),
    constraint student_FK foreign key (advisor) references faculty
    (facultyID));
    INSERT INTO STUDENT (STUID, LNAME, FNAME, MAJOR, STANDING, GPA,
    ADVISOR) VALUES
    (STUDENT_SEQ.NEXTVAL, 'SMITH', 'HEATHER', 'CIS', 'JUNIOR', 3.8,
    2);
    INSERT INTO STUDENT (STUID, LNAME, FNAME, MAJOR, STANDING, GPA,
    ADVISOR) VALUES
    (STUDENT_SEQ.NEXTVAL, 'ELLIOTT', 'DAVE', 'CIS', 'JUNIOR', 3.65,
    2);
    commit;
    create table section(
    sectionID number,
    sectionNo char(1),
    courseNo varchar2(10),
    facultyID number,
    term char(4),
    curSize number,
    maxSize number,
    constraint section_pk primary key (sectionID),
    constraint section_course_fk foreign key (courseNo) references
    course(courseNo),
    constraint section_faculty_fk foreign key (facultyID) references
    faculty(facultyID));
    INSERT INTO SECTION (SECTIONID, SECTIONNO, COURSENO, FACULTYID,
    TERM, CURSIZE, MAXSIZE)
    VALUES (SECTION_SEQ.NEXTVAL, 'T', 'CIS405', 1, '1001', 17, 30);
    INSERT INTO SECTION (SECTIONID, SECTIONNO, COURSENO, FACULTYID,
    TERM, CURSIZE, MAXSIZE)
    VALUES (SECTION_SEQ.NEXTVAL, 'G', 'CIS405', 2, '1001', 24, 30);
    commit;
    create table enrollment(
    stuSectionID number,
    stuID number,
    sectionID number,
    grade char(1) check(grade IN('A','B','C','D','F','I','W')),
    constraint enrollment_pk primary key (stuSectionID),
    constraint enrollment_stu_fk foreign key (stuID) references
    student(stuID),
    constraint enrollment_section_fk foreign key (sectionID)
    references section(sectionID));
    INSERT INTO ENROLLMENT (STUSECTIONID, STUID, SECTIONID) VALUES
    (ENROLLMENT_SEQ.NEXTVAL, 3, 1);
    INSERT INTO ENROLLMENT (STUSECTIONID, STUID, SECTIONID) VALUES
    (ENROLLMENT_SEQ.NEXTVAL, 3, 8);
    commit;
    create table room_section(
    roomSectionID number,
    sectionID number,
    roomID number,
    day char(3) check(day IN
    ('MON','TUE','WED','THU','FRI','SAT','SUN')),
    hour date,
    term char(4),
    constraint room_section_pk primary key (roomSectionID),
    constraint room_section_section_fk foreign key (sectionID)
    references section(sectionID),
    constraint room_section_room_fk foreign key (roomID) references
    room(roomID));
    INSERT INTO ROOM_SECTION (ROOMSECTIONID, SECTIONID, ROOMID, DAY,
    HOUR, TERM)
    VALUES (ROOM_SECTION_SEQ.NEXTVAL, 1, 3, 'MON', TO_DATE('9:30
    AM', 'HH:MI AM'), '1001');
    INSERT INTO ROOM_SECTION (ROOMSECTIONID, SECTIONID, ROOMID, DAY,
    HOUR, TERM)
    VALUES (ROOM_SECTION_SEQ.NEXTVAL, 1, 3, 'MON', TO_DATE('10:30
    AM', 'HH:MI AM'), '1001');
    commit;
    SQL> DESC ENROLLMENT
    Name Null? Type
    STUSECTIONID NOT NULL NUMBER
    STUID NUMBER
    SECTIONID NUMBER
    GRADE CHAR(1)
    SQL> CREATE OR REPLACE PROCEDURE Enrollment(
    2 p_grade IN CHAR(1),
    3 IS
    4 v_stuid NUMBER,
    5 v_sectionid NUMBER;
    6 BEGIN
    7 SELECT student_seq.NEXTVAL
    8 INTO v_stuid
    9 FROM DUAL;
    10 UPDATE student
    11 (stuid,
    12 sectionid,
    13 grade,
    14 SET (v_stuid,
    15 v_sectionid,
    16 UPPER (p_grade),
    17 COMMIT;
    18 DBMS_OUTPUT.PUT_LINE ('Student added');
    19 EXCEPTION
    20 WHEN OTHERS THEN
    21 DBMS_OUTPUT.PUT_LINE ('An error occurred');
    22 END AddStudent;
    23 /
    I got those errors like above!!! I don't understand what the
    instructions said. any assistance would be appreciated!

    David,
    I am afraid that the
    EXCEPTION
    WHEN OTHERS THEN
    DBMS_OUTPUT.PUT_LINE ('An error occurred');
    was my fault. I had intended it as an example to provide only
    minimal syntax where no exception handling whatsoever previously
    existed. Beau is a student and I am trying to guide him in the
    right direction without just writing all of it for him. In
    fact, I am afraid I may have already provided too much code
    without sufficient explanation. For you and others who may wish
    to help, here are the e-mails that provide the background on how
    we got to this point, with the most recent on top, starting with
    the last resonse I sent to him:
    Things that are wrong:
    The instructions say to be sure to use the sequence number for
    the student's ID, so you should not have p_stuID as an input
    parameter. Instead you should create a variable and select the
    student_seq.nextval into the variable from the dual table and
    use that value to populate the stuid column.
    Your input parameters should only have the variable type, not
    the size, so just use varchar2 and number.
    The check constraints only belong in the script that is used to
    create the table, not in your procedure with your input
    parameters, so remove them from the procedure.
    The order and number of your columns you are inserting into and
    values you are inserting must match, so if you insert into fname
    then lname, you need to insert the values p_fname then p_lname.
    You must either have first name then last name in both or last
    name then first name in both, not one way in one and the other
    way in the other.
    The idea is that when you execute the procedure you specify the
    values of the input parameter variable, then use those input
    parameter variables to insert the values into the table. You
    should not be specifying any specific values anywhere in your
    procedure. In other words don't insert 'HEATHER', instead
    insert fname, and so on.
    You should only have one insert statement. Each time the
    procedure is executed, a different set of values will be
    provided, and the same insert statement will be used.
    Additional suggestions:
    Although it is not required, since IN is the default, it is
    generally considered to be a good programming practice to use IN
    with your input parameters. It just makes the code easier to
    read and understand. As you write other code, you will learn to
    use OUT for output parameters and IN OUT for parameters that are
    both input and output parameters.
    It is generally recommended to store all data in upper case,
    that is capital letters, so that it is easier to index and
    search and avoid duplicates and so on. In order to ensure that
    your data is input in upper case, it is a good idea to use the
    UPPER function.
    Different programmers and companies have different standards
    that they use for capitalization, indentation, spacing,
    alignment, and so forth to make their code uniform and easier to
    read. You may want to look at some various styles and see what
    you like or ask what your instructor recommends.
    You should add some sort of exception handling section. For
    example, if someone attempts to insert a value for standing that
    isn't acceptable, then the procedure will fail due to the
    constraints and the student will not be added. You probably
    want to display some sort of message to the user. You might
    also want to display a message if the input is successful.
    When you attempt to compile your program and you receive a
    message that says "Warning: Procedure created with compilation
    errors." or some such thing, then from the SQL> prompt, type
    SHOW ERRORS and it will list the error message number, a brief
    description of the problem, and the line of code that the
    problem occurred on. You can then type LIST and it will list
    the code with line numbers, so that you can tell what line
    number the error message is referring to.
    In the following example, I have fixed the things that were
    wrong, formatted it the way I usually do, and added minimal
    exception handling and messages. There is a lot more that you
    could do. I have also demonstrated how the program can be
    tested and the results of proper input and improper input. In
    the example below, two students are added correctly, then an
    attempt to add another fails because the standing is not valid
    and violates a check constraint, because graduate is not
    acceptable. After each execution of the procedure, I have
    queried the table, so that you can see what was added and what
    was not.
    SQL> CREATE OR REPLACE PROCEDURE AddStudent
    2 (p_fname IN VARCHAR2,
    3 p_lname IN VARCHAR2,
    4 p_major IN VARCHAR2,
    5 p_standing IN VARCHAR2,
    6 p_gpa IN NUMBER)
    7 IS
    8 v_stuid NUMBER;
    9 BEGIN
    10 SELECT student_seq.NEXTVAL
    11 INTO v_stuid
    12 FROM DUAL;
    13
    14 INSERT INTO student
    15 (stuid,
    16 fname,
    17 lname,
    18 major,
    19 standing,
    20 gpa)
    21 VALUES (v_stuid,
    22 UPPER (p_fname),
    23 UPPER (p_lname),
    24 UPPER (p_major),
    25 UPPER (p_standing),
    26 p_gpa);
    27
    28 COMMIT;
    29 DBMS_OUTPUT.PUT_LINE ('Student added');
    30 EXCEPTION
    31 WHEN OTHERS THEN
    32 DBMS_OUTPUT.PUT_LINE ('An error occurred');
    33 END AddStudent;
    34 /
    Procedure created.
    SQL> COLUMN fname FORMAT A15
    SQL> COLUMN lname FORMAT A15
    SQL> SELECT stuid, fname, lname, major, standing, gpa
    2 FROM student
    3 /
    no rows selected
    SQL> SET SERVEROUTPUT ON
    SQL> EXEC AddStudent ('HEATHER', 'SMITH', 'CIS', 'JUNIOR', 3.8)
    Student added
    PL/SQL procedure successfully completed.
    SQL> SELECT stuid, fname, lname, major, standing, gpa
    2 FROM student
    3 /
    STUID FNAME LNAME MAJOR
    STANDING GPA
    1 HEATHER SMITH CIS
    JUNIOR 3.8
    SQL> EXEC AddStudent ('Dave', 'Elliott', 'CIS', 'junior', 3.65)
    Student added
    PL/SQL procedure successfully completed.
    SQL> SELECT stuid, fname, lname, major, standing, gpa
    2 FROM student
    3 /
    STUID FNAME LNAME MAJOR
    STANDING GPA
    1 HEATHER SMITH CIS
    JUNIOR 3.8
    2 DAVE ELLIOTT CIS
    JUNIOR 3.65
    SQL> EXEC AddStudent ('KARL', 'WEBSTER', 'CIS', 'GRADUATE', 3.2)
    An error occurred
    PL/SQL procedure successfully completed.
    SQL> SELECT stuid, fname, lname, major, standing, gpa
    2 FROM student
    3 /
    STUID FNAME LNAME MAJOR
    STANDING GPA
    1 HEATHER SMITH CIS
    JUNIOR 3.8
    2 DAVE ELLIOTT CIS
    JUNIOR 3.65
    SQL>
    I am going home now. Sometimes I get a chance to respond to my
    e-mail daily and sometimes I may not get to it for a week. It
    is better if you post your questions on one of the forums where
    you may get more rapid responses from many people. I have
    provided links to some forums that I browse below. If you have
    internet access, you should be able to just click on them. Some
    may require you to register, but they are all free.
    The following is a link to the Oracle Technology Network forums,
    hosted by Oracle Corporation, where I recommend the SQL and
    PL/SQL discussions.
    http://forums.oracle.com/forums/homepage.jsp
    The following is a link to the PL/SQL forums of the REVEALNET
    site, where noted author Steven Feuerstein is one of the SYSOPS,
    where, for you, I recommend the "Beginner PL/SQL Developer
    Questions" discussions.
    http://PIPETALK.REVEALNET.COM/~PLSQL/LOGIN
    The following is a link to another forum, where I recommend the
    RDBMS, SQL, PL/SQL discussions.
    http://www.orafans.com/cgi-bin/orafans/ubb/Ultimate.cgi?
    action=intro
    I would still like to know where you got my e-mail address, what
    class you are taking, who your instructor is, and so forth.
    Please do let me know.
    Good luck,
    Barbara
    -----Original Message-----
    From:     bseo.ga [SMTP:[email protected]]
    Sent:     Wednesday, December 19, 2001 12:19 AM
    To:     Boehmer, Barbara A.
    Subject:     Re: PL/SQL
    Importance:     High
    what is wrong with the compilation errors?
    CREATE or REPLACE PROCEDURE AddStudent(
    p_stuID number,
    p_lname varchar2(30),
    p_fname varchar2(20),
    p_major varchar2(5) check(major IN
    ('ACCT','ECT','EET','BIS','BSIT','CIS','TCOM')),
    P_standing varchar2(10) check(standing IN
    ('FRESHMAN','SOPHOMORE','JUNIOR','SENIOR')),
    P_gpa number(3,2) IS
    BEGIN
    INSERT INTO STUDENT (STUID, LNAME, FNAME, MAJOR, STANDING, GPA,
    ADVISOR) VALUES
    (STUDENT_SEQ.NEXTVAL, 'SMITH', 'HEATHER', 'CIS', 'JUNIOR', 3.8,
    2);
    INSERT INTO STUDENT (STUID, LNAME, FNAME, MAJOR, STANDING, GPA,
    ADVISOR) VALUES
    (STUDENT_SEQ.NEXTVAL, 'ELLIOTT', 'DAVE', 'CIS', 'JUNIOR', 3.65,
    2);
    INSERT INTO STUDENT (STUID, LNAME, FNAME, MAJOR, STANDING, GPA,
    ADVISOR) VALUES
    (STUDENT_SEQ.NEXTVAL, 'WEBSTER', 'KARL', 'CIS', 'SENIOR', 3.2,
    2);
    INSERT INTO STUDENT (STUID, LNAME, FNAME, MAJOR, STANDING, GPA,
    ADVISOR) VALUES
    (STUDENT_SEQ.NEXTVAL, 'COX', 'STACEY', 'CIS', 'SENIOR', 2.7, 1);
    INSERT INTO STUDENT (STUID, LNAME, FNAME, MAJOR, STANDING, GPA,
    ADVISOR) VALUES
    (STUDENT_SEQ.NEXTVAL, 'HOWARD', 'BRIAN', 'CIS', 'JUNIOR', 3.18,
    1);
    INSERT INTO STUDENT (STUID, LNAME, FNAME, MAJOR, STANDING, GPA,
    ADVISOR) VALUES
    (STUDENT_SEQ.NEXTVAL, 'DENNIS', 'KELLY', 'CIS', 'SENIOR', 4.0,
    1);
    COMMIT;
    END;
    SQL> /
    Warning: Procedure created with compilation errors.
    ----- Original Message -----
    From: Boehmer, Barbara A. <mailto:[email protected]>
    To: 'bseo.ga' <mailto:[email protected]>
    Sent: Tuesday, December 18, 2001 5:17 PM
    Subject: RE: PL/SQL
    I am not sure what part of it you don't understand.
    The first section that you included is a script that you need to
    copy and run, in order to create the sequences, tables, and data
    that you will need to complete your assignment. You will need
    to edit an empty .sql file, copy the script into the file, save
    the file, then start the file. For example:
    SQL> EDIT test
    Type or copy the script and save the file.
    SQL> START test
    You should see various messages as the items are created. Then
    you can use the following commands to see the tables and
    sequences that you have created:
    SQL> SELECT table_name FROM user_tables;
    SQL> SELECT sequence_name FROM user_sequences;
    To show the structure of an individual table, for example the
    course table:
    SQL> DESC course
    To show the data in an individual table, like the course table:
    SQL> SELECT * FROM course;
    In the second section that you have provided, your instructor is
    asking you to create three different procedures to do three
    different things. To create a procedure, you edit a .sql file,
    type the code to create the procedure, save the file, then start
    the file. I usually make the .sql file name the same as the
    procedure name. So, for example, in number 1, you are asked to
    create a procedure named AddStudent, so you would:
    SQL> EDIT AddStudent
    Type your code.
    Save the file.
    SQL> START AddStudent
    You should receive a message that says:
    Procedure created.
    Then, to execute your procedure:
    SQL> EXEC AddStudent (put your parameter values here)
    The basic syntax for creating a pl/sql procedure is:
    CREATE OR REPLACE PROCEDURE procedure_name
    (put your parameters here)
    AS
    put your variable declarations here;
    BEGIN
    put your code that you want to execute here,
    like insert statements and update statements;
    END procedure_name;
    So, if you are trying to create a procedure to add a new student
    (which means inserting a row into the student table), you will
    need to accept the values (parameters) that you are going to
    insert, then insert them:
    CREATE OR REPLACE PROCEDURE AddStudent
    (p_first .....
    p_last .....
    p_major .....
    p_standing .....
    p_GPA .....)
    AS
    BEGIN
    INSERT INTO student .....;
    END AddStudent;
    I have just given you a starting format and deliberately left
    out a lot, because you will learn more by doing it yourself. I
    hope that makes things a little clearer.
    I would like to know a little more about the class you are
    taking. Please let me know where you are going to school, who
    your instructor is, what is the name of the class you are
    taking, and what book are you using. Also, please let me know
    where you got my e-mail address (from one of the forums?)
    Good luck,
    Barbara
    -----Original Message-----
    From: bseo.ga [mailto:[email protected]]
    Sent: Tuesday, December 18, 2001 5:57 PM
    To: [email protected]
    Subject: PL/SQL
    Importance: High
    I don't understand reading the following instructions from my
    professor and the books. help would be apppreciated.
    -------------create the sequence numbers needed to generate
    primary key values
    create sequence room_seq increment by 1;
    create sequence faculty_seq increment by 1;
    create sequence student_seq increment by 1;
    create sequence section_seq increment by 1;
    create sequence enrollment_seq increment by 1;
    create sequence room_section_seq increment by 1;
    create table course(
    courseNo varchar2(10),
    name varchar2(30),
    credits number,
    constraint course_pk primary key (courseNo));
    insert into course (courseNo, name, credits) values
    ('CIS405','ADVANCED DATABASE', 5);
    insert into course (courseNo, name, credits) values
    ('CIS349','INTRO TO DATABASE', 5);
    COMMIT;
    create table room(
    roomID number,
    bldg char(1) check (bldg IN ('A','B')),
    roomNo varchar2(10),
    maxCapacity number,
    style varchar2(15) check(style IN
    ('LECTURE','LECTURE/LAB','LAB','OFFICE')),
    constraint room_pk primary key (roomID));
    insert into room (roomID, bldg, roomNo, maxCapacity, style)
    values (room_seq.nextval, 'B', '151A', 50, 'LAB');
    insert into room (roomID, bldg, roomNo, maxCapacity, style)
    values (room_seq.nextval, 'B', '151B', 50, 'LAB');
    commit;
    create table faculty(
    facultyID number,
    lname varchar2(30) not null,
    fname varchar2(20) not null,
    dept varchar2(5),
    officeID number,
    phone varchar2(15),
    email varchar2(75),
    rank char(4) check(rank IN
    ('INST','ASOC','ASST','FULL','SENR')),
    constraint faculty_pk primary key (facultyID),
    constraint faculty_fk foreign key (officeID) references room
    (roomID));
    insert into faculty(facultyID, lname, fname, dept, officeID,
    phone, email, rank) values
    (faculty_seq.nextval, 'CANNON', 'AMY', 'CIS',
    6, '77052149003252', '[email protected]','FULL'
    <mailto:'[email protected]','FULL'>);
    commit;
    create table equipment(
    equipmentID varchar2(30),
    roomID number,
    type varchar2(20) check(type IN('OVERHEAD PROJECTOR','PORTABLE
    PROJECTOR','LAPTOP CONNECTION','DESKTOP COMPUTER','INTERNET
    CONNECTION')),
    constraint equipment_pk primary key (equipmentID),
    constraint equipment_fk foreign key (roomID) references room
    (roomID));
    INSERT INTO EQUIPMENT (EQUIPMENTID, ROOMID, TYPE) VALUES ('111',
    5, 'DESKTOP COMPUTER');
    INSERT INTO EQUIPMENT (EQUIPMENTID, ROOMID, TYPE) VALUES ('222',
    5, 'OVERHEAD PROJECTOR');
    commit;
    create table student(
    stuID number,
    lname varchar2(30),
    fname varchar2(20),
    street varchar2(100),
    city varchar2(60),
    state char(2),
    zip varchar2(9),
    major varchar2(5) check(major IN
    ('ACCT','ECT','EET','BIS','BSIT','CIS','TCOM')),
    standing varchar2(10) check(standing IN
    ('FRESHMAN','SOPHOMORE','JUNIOR','SENIOR')),
    gpa number(3,2),
    advisor number,
    constraint student_pk primary key (stuID),
    constraint student_FK foreign key (advisor) references faculty
    (facultyID));
    INSERT INTO STUDENT (STUID, LNAME, FNAME, MAJOR, STANDING, GPA,
    ADVISOR) VALUES
    (STUDENT_SEQ.NEXTVAL, 'SMITH', 'HEATHER', 'CIS', 'JUNIOR', 3.8,
    2);
    INSERT INTO STUDENT (STUID, LNAME, FNAME, MAJOR, STANDING, GPA,
    ADVISOR) VALUES
    (STUDENT_SEQ.NEXTVAL, 'ELLIOTT', 'DAVE', 'CIS', 'JUNIOR', 3.65,
    2);
    commit;
    create table section(
    sectionID number,
    sectionNo char(1),
    courseNo varchar2(10),
    facultyID number,
    term char(4),
    curSize number,
    maxSize number,
    constraint section_pk primary key (sectionID),
    constraint section_course_fk foreign key (courseNo) references
    course(courseNo),
    constraint section_faculty_fk foreign key (facultyID)
    references faculty(facultyID));
    INSERT INTO SECTION (SECTIONID, SECTIONNO, COURSENO, FACULTYID,
    TERM, CURSIZE, MAXSIZE)
    VALUES (SECTION_SEQ.NEXTVAL, 'T', 'CIS405', 1, '1001', 17, 30);
    INSERT INTO SECTION (SECTIONID, SECTIONNO, COURSENO, FACULTYID,
    TERM, CURSIZE, MAXSIZE)
    VALUES (SECTION_SEQ.NEXTVAL, 'G', 'CIS405', 2, '1001', 24, 30);
    commit;
    create table enrollment(
    stuSectionID number,
    stuID number,
    sectionID number,
    grade char(1) check(grade IN('A','B','C','D','F','I','W')),
    constraint enrollment_pk primary key (stuSectionID),
    constraint enrollment_stu_fk foreign key (stuID) references
    student(stuID),
    constraint enrollment_section_fk foreign key (sectionID)
    references section(sectionID));
    INSERT INTO ENROLLMENT (STUSECTIONID, STUID, SECTIONID) VALUES
    (ENROLLMENT_SEQ.NEXTVAL, 3, 1);
    INSERT INTO ENROLLMENT (STUSECTIONID, STUID, SECTIONID) VALUES
    (ENROLLMENT_SEQ.NEXTVAL, 3, 8);
    commit;
    create table room_section(
    roomSectionID number,
    sectionID number,
    roomID number,
    day char(3) check(day IN
    ('MON','TUE','WED','THU','FRI','SAT','SUN')),
    hour date,
    term char(4),
    constraint room_section_pk primary key (roomSectionID),
    constraint room_section_section_fk foreign key (sectionID)
    references section(sectionID),
    constraint room_section_room_fk foreign key (roomID)
    references room(roomID));
    INSERT INTO ROOM_SECTION (ROOMSECTIONID, SECTIONID, ROOMID, DAY,
    HOUR, TERM)
    VALUES (ROOM_SECTION_SEQ.NEXTVAL, 1, 3, 'MON', TO_DATE('9:30
    AM', 'HH:MI AM'), '1001');
    INSERT INTO ROOM_SECTION (ROOMSECTIONID, SECTIONID, ROOMID, DAY,
    HOUR, TERM)
    VALUES (ROOM_SECTION_SEQ.NEXTVAL, 1, 3, 'MON', TO_DATE('10:30
    AM', 'HH:MI AM'), '1001');
    commit;
    The lab notes from my professor said
    1. your system will often need to create a new student. Write
    PL/SQL code for an object named AddStudent that will take values
    for first and last name, major, standing and GPA and add a new
    record in the Student table. Since advisors aren't assigned at
    registration time, we'll add their advisor at a later date.
    Don't worry about the student's address. Be sure to use the
    sequence number for the student's ID.
    2. Write a procedure that will retrieve an existing record in
    Enrollment usiing the student and section Ids and set the grade
    to a specified value. (use update instead of insert)
    3. Write another procedure that will assign a given student a
    given advisor.

  • Why is this an error???  I don't understand why it is... Help Please

    Hi,
    Ok, I'll preface this by saying there's a lotta code pasted in here but it really quite an easy question, I just need to post all the code so you understand where what came from.
    Now.............the question I'm trying to do is to create an applet that has 2 buttons -- each button when clicked opens an application (one is a simple calculator, the other a Mortgage calculation app). When you click one of the buttons (calc or mortgage), that app opens infront of the 2 button menu so its in "focus". The button on the 2 button menu then switches to a "hide app X" button (ie: "Mortgage", changes to "Hide Mortgage"). Thus if you click the hide button, the app that was opened is hidden, and then that "hide" button switches back to the original "app X" button. Pretty simple.
    Now, I have from my text book an example that does exactly this, with the simple calculator already in it, and with another app (a traffic light thing) where the Mortgage should be in my final product. I also already have the Mortgage applet I need to insert from another book example in place of that Traffic Light portion.
    Now, common sense would dictate that I should be able to just copy my code for the Mortgage applet into the example that has the 2 button menu structure, and overwrite the code I want to get rid of (the traffic light) with the mortgage code & rename the menu buttons. Right?? A simple switch of one thing for another... but therein lies my problem.
    I copied all the Mortgage code in correctly over the traffic lights, switched the button names, tried to compile it but I get one error....
    Exercise12_17.java:52: cannot resolve symbol
    symbol  : method pack ()
    location: class MortgageApplet
            mortgageAppletFrame.pack();I don't understand why..... mortgageAppletFrame.pack(); was a simple rewrite from lightsFrame.pack(); like every other line...... it should work. I've gone over it for 2 days......... Anyone know why it comes up as an error???
    Below, in order going down is (1)my code with the 1 error I can't solve, (2)the original menu example I tried to edit, and (3)the Mortgage app code...........
    Does anyone know what my error is?? Help or a hint would be greatly appreciated........ Thanks.
    My erroring app.......
    // Exercise12_17.java: Create multiple windows
    import java.awt.*;
    import java.awt.event.*;
    import javax.swing.*;
    import javax.swing.border.TitledBorder;
    public class Exercise12_17 extends JFrame implements ActionListener {
      // Declare and create a frame: an instance of MenuDemo
      MenuDemo calcFrame = new MenuDemo();
      // Declare and create a frame: an instance of RadioButtonDemo
      MortgageApplet mortgageAppletFrame = new MortgageApplet();
      // Declare two buttons for displaying frames
      private JButton jbtCalc;
      private JButton jbtMortgage;
      public static void main(String[] args) {
        Exercise12_17 frame = new Exercise12_17();
        frame.setSize( 400, 70 );
        frame.setTitle("Exercise 11.8: Multiple Windows Demo");
        frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
        frame.setVisible(true);
      public Exercise12_17() {
        // Add buttons to the main frame
        getContentPane().setLayout(new FlowLayout());
        getContentPane().add(jbtCalc = new JButton("Simple Calculator"));
         getContentPane().add(jbtMortgage = new JButton("Mortgage"));
        // Register the main frame as listener for the buttons
        jbtCalc.addActionListener(this);
         jbtMortgage.addActionListener(this);
      public void actionPerformed(ActionEvent e) {
        String arg = e.getActionCommand();
        if (e.getSource() instanceof JButton)
          if ("Simple Calculator".equals(arg)) {
            //show the MenuDemo frame
            jbtCalc.setText("Hide Simple Calculator");
            calcFrame.pack();
            calcFrame.setVisible(true);
          else if ("Hide Simple Calculator".equals(arg)) {
            calcFrame.setVisible(false);
            jbtCalc.setText("Simple Calculator");
          else if ("Mortgage".equals(arg)) {
            //show the CheckboxGroup frame
            mortgageAppletFrame.pack();
            jbtMortgage.setText("Hide Mortgage");
            mortgageAppletFrame.setVisible(true);
          else if ("Hide Mortgage".equals(arg)) {
            mortgageAppletFrame.setVisible(false);
            jbtMortgage.setText("Mortgage");
      class MortgageApplet extends JApplet
      implements ActionListener {
      // Declare and create text fields for interest rate
      // year, loan amount, monthly payment, and total payment
      private JTextField jtfAnnualInterestRate = new JTextField();
      private JTextField jtfNumOfYears = new JTextField();
      private JTextField jtfLoanAmount = new JTextField();
      private JTextField jtfMonthlyPayment = new JTextField();
      private JTextField jtfTotalPayment = new JTextField();
      // Declare and create a Compute Mortgage button
      private JButton jbtComputeMortgage = new JButton("Compute Mortgage");
      /** Initialize user interface */
      public void init() {
        // Set properties on the text fields
        jtfMonthlyPayment.setEditable(false);
        jtfTotalPayment.setEditable(false);
        // Right align text fields
        jtfAnnualInterestRate.setHorizontalAlignment(JTextField.RIGHT);
        jtfNumOfYears.setHorizontalAlignment(JTextField.RIGHT);
        jtfLoanAmount.setHorizontalAlignment(JTextField.RIGHT);
        jtfMonthlyPayment.setHorizontalAlignment(JTextField.RIGHT);
        jtfTotalPayment.setHorizontalAlignment(JTextField.RIGHT);
        // Panel p1 to hold labels and text fields
        JPanel p1 = new JPanel();
        p1.setLayout(new GridLayout(5, 2));
        p1.add(new Label("Annual Interest Rate"));
        p1.add(jtfAnnualInterestRate);
        p1.add(new Label("Number of Years"));
        p1.add(jtfNumOfYears);
        p1.add(new Label("Loan Amount"));
        p1.add(jtfLoanAmount);
        p1.add(new Label("Monthly Payment"));
        p1.add(jtfMonthlyPayment);
        p1.add(new Label("Total Payment"));
        p1.add(jtfTotalPayment);
        p1.setBorder(new
          TitledBorder("Enter interest rate, year and loan amount"));
        // Panel p2 to hold the button
        JPanel p2 = new JPanel();
        p2.setLayout(new FlowLayout(FlowLayout.RIGHT));
        p2.add(jbtComputeMortgage);
        // Add the components to the applet
        getContentPane().add(p1, BorderLayout.CENTER);
        getContentPane().add(p2, BorderLayout.SOUTH);
        // Register listener
        jbtComputeMortgage.addActionListener(this);
      /** Handle the "Compute Mortgage" button */
      public void actionPerformed(ActionEvent e) {
        if (e.getSource() == jbtComputeMortgage) {
          // Get values from text fields
          double interest = (Double.valueOf(
            jtfAnnualInterestRate.getText())).doubleValue();
          int year =
            (Integer.valueOf(jtfNumOfYears.getText())).intValue();
          double loan =
            (Double.valueOf(jtfLoanAmount.getText())).doubleValue();
          // Create a mortgage object
          Mortgage m = new Mortgage(interest, year, loan);
          // Display monthly payment and total payment
          jtfMonthlyPayment.setText(String.valueOf(m.monthlyPayment()));
          jtfTotalPayment.setText(String.valueOf(m.totalPayment()));
    class MenuDemo extends JFrame implements ActionListener {
      // Text fields for Number 1, Number 2, and Result
      private JTextField jtfNum1, jtfNum2, jtfResult;
      // Buttons "Add", "Subtract", "Multiply" and "Divide"
      private JButton jbtAdd, jbtSub, jbtMul, jbtDiv;
      // Menu items "Add", "Subtract", "Multiply","Divide" and "Close"
      private JMenuItem jmiAdd, jmiSub, jmiMul, jmiDiv, jmiClose;
      /** Main method */
      public static void main(String[] args) {
        MenuDemo frame = new MenuDemo();
        frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
        frame.pack();
        frame.setVisible(true);
      /** Default constructor */
      public MenuDemo() {
        setTitle("Menu Demo");
        // Create menu bar
        JMenuBar jmb = new JMenuBar();
        // Set menu bar to the frame
        setJMenuBar(jmb);
        // Add menu "Operation" to menu bar
        JMenu operationMenu = new JMenu("Operation");
        operationMenu.setMnemonic('O');
        jmb.add(operationMenu);
        // Add menu "Exit" in menu bar
        JMenu exitMenu = new JMenu("Exit");
        exitMenu.setMnemonic('E');
        jmb.add(exitMenu);
        // Add menu items with mnemonics to menu "Operation"
        operationMenu.add(jmiAdd= new JMenuItem("Add", 'A'));
        operationMenu.add(jmiSub = new JMenuItem("Subtract", 'S'));
        operationMenu.add(jmiMul = new JMenuItem("Multiply", 'M'));
        operationMenu.add(jmiDiv = new JMenuItem("Divide", 'D'));
        exitMenu.add(jmiClose = new JMenuItem("Close", 'C'));
        // Set keyboard accelerators
        jmiAdd.setAccelerator(
          KeyStroke.getKeyStroke(KeyEvent.VK_A, ActionEvent.CTRL_MASK));
        jmiSub.setAccelerator(
          KeyStroke.getKeyStroke(KeyEvent.VK_S, ActionEvent.CTRL_MASK));
        jmiMul.setAccelerator(
          KeyStroke.getKeyStroke(KeyEvent.VK_M, ActionEvent.CTRL_MASK));
        jmiDiv.setAccelerator(
          KeyStroke.getKeyStroke(KeyEvent.VK_D, ActionEvent.CTRL_MASK));
        // Panel p1 to hold text fields and labels
        JPanel p1 = new JPanel();
        p1.setLayout(new FlowLayout());
        p1.add(new JLabel("Number 1"));
        p1.add(jtfNum1 = new JTextField(3));
        p1.add(new JLabel("Number 2"));
        p1.add(jtfNum2 = new JTextField(3));
        p1.add(new JLabel("Result"));
        p1.add(jtfResult = new JTextField(4));
        jtfResult.setEditable(false);
        // Panel p2 to hold buttons
        JPanel p2 = new JPanel();
        p2.setLayout(new FlowLayout());
        p2.add(jbtAdd = new JButton("Add"));
        p2.add(jbtSub = new JButton("Subtract"));
        p2.add(jbtMul = new JButton("Multiply"));
        p2.add(jbtDiv = new JButton("Divide"));
        // Add panels to the frame
        getContentPane().setLayout(new BorderLayout());
        getContentPane().add(p1, BorderLayout.CENTER);
        getContentPane().add(p2, BorderLayout.SOUTH);
        // Register listeners
        jbtAdd.addActionListener(this);
        jbtSub.addActionListener(this);
        jbtMul.addActionListener(this);
        jbtDiv.addActionListener(this);
        jmiAdd.addActionListener(this);
        jmiSub.addActionListener(this);
        jmiMul.addActionListener(this);
        jmiDiv.addActionListener(this);
        jmiClose.addActionListener(this);
      /** Handle ActionEvent from buttons and menu items */
      public void actionPerformed(ActionEvent e) {
        String actionCommand = e.getActionCommand();
        // Handle button events
        if (e.getSource() instanceof JButton) {
          if ("Add".equals(actionCommand))
            calculate('+');
          else if ("Subtract".equals(actionCommand))
            calculate('-');
          else if ("Multiply".equals(actionCommand))
            calculate('*');
          else if ("Divide".equals(actionCommand))
            calculate('/');
        else if (e.getSource() instanceof JMenuItem) {
          // Handle menu item events
          if ("Add".equals(actionCommand))
            calculate('+');
          else if ("Subtract".equals(actionCommand))
            calculate('-');
          else if ("Multiply".equals(actionCommand))
            calculate('*');
          else if ("Divide".equals(actionCommand))
            calculate('/');
          else if ("Close".equals(actionCommand))
            System.exit(0);
      /** Calculate and show the result in jtfResult */
      private void calculate(char operator) {
        // Obtain Number 1 and Number 2
        int num1 = (Integer.parseInt(jtfNum1.getText().trim()));
        int num2 = (Integer.parseInt(jtfNum2.getText().trim()));
        int result = 0;
        // Perform selected operation
        switch (operator) {
          case '+': result = num1 + num2;
                    break;
          case '-': result = num1 - num2;
                    break;
          case '*': result = num1 * num2;
                    break;
          case '/': result = num1 / num2;
        // Set result in jtfResult
        jtfResult.setText(String.valueOf(result));
    Original 2 button menu example....
    // Exercise11_8.java: Create multiple windows
    import java.awt.*;
    import java.awt.event.*;
    import javax.swing.*;
    public class Exercise11_8 extends JFrame implements ActionListener {
      // Declare and create a frame: an instance of MenuDemo
      MenuDemo calcFrame = new MenuDemo();
      // Declare and create a frame: an instance of RadioButtonDemo
      RadioButtonDemo lightsFrame = new RadioButtonDemo();
      // Declare two buttons for displaying frames
      private JButton jbtCalc;
      private JButton jbtLights;
      public static void main(String[] args) {
        Exercise11_8 frame = new Exercise11_8();
        frame.setSize( 400, 70 );
        frame.setTitle("Exercise 11.8: Multiple Windows Demo");
        frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
        frame.setVisible(true);
      public Exercise11_8() {
        // Add buttons to the main frame
        getContentPane().setLayout(new FlowLayout());
        getContentPane().add(jbtCalc = new JButton("Simple Calculator"));
        getContentPane().add(jbtLights = new JButton("Traffic Lights"));
        // Register the main frame as listener for the buttons
        jbtCalc.addActionListener(this);
        jbtLights.addActionListener(this);
      public void actionPerformed(ActionEvent e) {
        String arg = e.getActionCommand();
        if (e.getSource() instanceof JButton)
          if ("Simple Calculator".equals(arg)) {
            //show the MenuDemo frame
            jbtCalc.setText("Hide Simple Calculator");
            calcFrame.pack();
            calcFrame.setVisible(true);
          else if ("Hide Simple Calculator".equals(arg)) {
            calcFrame.setVisible(false);
            jbtCalc.setText("Simple Calculator");
          else if ("Traffic Lights".equals(arg)) {
            //show the CheckboxGroup frame
            lightsFrame.pack();
            jbtLights.setText("Hide Traffic Lights");
            lightsFrame.setVisible(true);
          else if ("Hide Traffic Lights".equals(arg)) {
            lightsFrame.setVisible(false);
            jbtLights.setText("Traffic Lights");
         class RadioButtonDemo extends JFrame
      implements ItemListener {
      // Declare radio buttons
      private JRadioButton jrbRed, jrbYellow, jrbGreen;
      // Declare a radio button group
      private ButtonGroup btg = new ButtonGroup();
      // Declare a traffic light display panel
      private Light light;
      /** Main method */
      public static void main(String[] args) {
        RadioButtonDemo frame = new RadioButtonDemo();
        frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
        frame.setSize(250, 170);
        frame.setVisible(true);
      /** Default constructor */
      public RadioButtonDemo() {
        setTitle("RadioButton Demo");
        // Add traffic light panel to panel p1
        JPanel p1 = new JPanel();
        p1.setSize(200, 200);
        p1.setLayout(new FlowLayout(FlowLayout.CENTER));
        light = new Light();
        light.setSize(40, 90);
        p1.add(light);
        // Put the radio button in Panel p2
        JPanel p2 = new JPanel();
        p2.setLayout(new FlowLayout());
        p2.add(jrbRed = new JRadioButton("Red", true));
        p2.add(jrbYellow = new JRadioButton("Yellow", false));
        p2.add(jrbGreen = new JRadioButton("Green", false));
        // Set keyboard mnemonics
        jrbRed.setMnemonic('R');
        jrbYellow.setMnemonic('Y');
        jrbGreen.setMnemonic('G');
        // Group radio buttons
        btg.add(jrbRed);
        btg.add(jrbYellow);
        btg.add(jrbGreen);
        // Place p1 and p2 in the frame
        getContentPane().setLayout(new BorderLayout());
        getContentPane().add(p1, BorderLayout.CENTER);
        getContentPane().add(p2, BorderLayout.SOUTH);
        // Register listeners for check boxes
        jrbRed.addItemListener(this);
        jrbYellow.addItemListener(this);
        jrbGreen.addItemListener(this);
      /** Handle checkbox events */
      public void itemStateChanged(ItemEvent e) {
        if (jrbRed.isSelected())
          light.turnOnRed(); // Set red light
        if (jrbYellow.isSelected())
          light.turnOnYellow(); // Set yellow light
        if (jrbGreen.isSelected())
          light.turnOnGreen(); // Set green light
    // Three traffic lights shown in a panel
    class Light extends JPanel {
      private boolean red;
      private boolean yellow;
      private boolean green;
      /** Default constructor */
      public Light() {
        turnOnGreen();
      /** Set red light on */
      public void turnOnRed() {
        red = true;
        yellow = false;
        green = false;
        repaint();
      /** Set yellow light on */
      public void turnOnYellow() {
        red = false;
        yellow = true;
        green = false;
        repaint();
      /** Set green light on */
      public void turnOnGreen() {
        red = false;
        yellow = false;
        green = true;
        repaint();
      /** Display lights */
      public void paintComponent(Graphics g) {
        super.paintComponent(g);
        if (red) {
          g.setColor(Color.red);
          g.fillOval(10, 10, 20, 20);
          g.setColor(Color.black);
          g.drawOval(10, 35, 20, 20);
          g.drawOval(10, 60, 20, 20);
          g.drawRect(5, 5, 30, 80);
        else if (yellow) {
          g.setColor(Color.yellow);
          g.fillOval(10, 35, 20, 20);
          g.setColor(Color.black);
          g.drawRect(5, 5, 30, 80);
          g.drawOval(10, 10, 20, 20);
          g.drawOval(10, 60, 20, 20);
        else if (green) {
          g.setColor(Color.green);
          g.fillOval(10, 60, 20, 20);
          g.setColor(Color.black);
          g.drawRect(5, 5, 30, 80);
          g.drawOval(10, 10, 20, 20);
          g.drawOval(10, 35, 20, 20);
        else {
          g.setColor(Color.black);
          g.drawRect(5, 5, 30, 80);
          g.drawOval(10, 10, 20, 20);
          g.drawOval(10, 35, 20, 20);
          g.drawOval(10, 60, 20, 20);
      /** Set preferred size */
      public Dimension getPreferredSize() {
        return new Dimension(40, 90);
    class MenuDemo extends JFrame implements ActionListener {
      // Text fields for Number 1, Number 2, and Result
      private JTextField jtfNum1, jtfNum2, jtfResult;
      // Buttons "Add", "Subtract", "Multiply" and "Divide"
      private JButton jbtAdd, jbtSub, jbtMul, jbtDiv;
      // Menu items "Add", "Subtract", "Multiply","Divide" and "Close"
      private JMenuItem jmiAdd, jmiSub, jmiMul, jmiDiv, jmiClose;
      /** Main method */
      public static void main(String[] args) {
        MenuDemo frame = new MenuDemo();
        frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
        frame.pack();
        frame.setVisible(true);
      /** Default constructor */
      public MenuDemo() {
        setTitle("Menu Demo");
        // Create menu bar
        JMenuBar jmb = new JMenuBar();
        // Set menu bar to the frame
        setJMenuBar(jmb);
        // Add menu "Operation" to menu bar
        JMenu operationMenu = new JMenu("Operation");
        operationMenu.setMnemonic('O');
        jmb.add(operationMenu);
        // Add menu "Exit" in menu bar
        JMenu exitMenu = new JMenu("Exit");
        exitMenu.setMnemonic('E');
        jmb.add(exitMenu);
        // Add menu items with mnemonics to menu "Operation"
        operationMenu.add(jmiAdd= new JMenuItem("Add", 'A'));
        operationMenu.add(jmiSub = new JMenuItem("Subtract", 'S'));
        operationMenu.add(jmiMul = new JMenuItem("Multiply", 'M'));
        operationMenu.add(jmiDiv = new JMenuItem("Divide", 'D'));
        exitMenu.add(jmiClose = new JMenuItem("Close", 'C'));
        // Set keyboard accelerators
        jmiAdd.setAccelerator(
          KeyStroke.getKeyStroke(KeyEvent.VK_A, ActionEvent.CTRL_MASK));
        jmiSub.setAccelerator(
          KeyStroke.getKeyStroke(KeyEvent.VK_S, ActionEvent.CTRL_MASK));
        jmiMul.setAccelerator(
          KeyStroke.getKeyStroke(KeyEvent.VK_M, ActionEvent.CTRL_MASK));
        jmiDiv.setAccelerator(
          KeyStroke.getKeyStroke(KeyEvent.VK_D, ActionEvent.CTRL_MASK));
        // Panel p1 to hold text fields and labels
        JPanel p1 = new JPanel();
        p1.setLayout(new FlowLayout());
        p1.add(new JLabel("Number 1"));
        p1.add(jtfNum1 = new JTextField(3));
        p1.add(new JLabel("Number 2"));
        p1.add(jtfNum2 = new JTextField(3));
        p1.add(new JLabel("Result"));
        p1.add(jtfResult = new JTextField(4));
        jtfResult.setEditable(false);
        // Panel p2 to hold buttons
        JPanel p2 = new JPanel();
        p2.setLayout(new FlowLayout());
        p2.add(jbtAdd = new JButton("Add"));
        p2.add(jbtSub = new JButton("Subtract"));
        p2.add(jbtMul = new JButton("Multiply"));
        p2.add(jbtDiv = new JButton("Divide"));
        // Add panels to the frame
        getContentPane().setLayout(new BorderLayout());
        getContentPane().add(p1, BorderLayout.CENTER);
        getContentPane().add(p2, BorderLayout.SOUTH);
        // Register listeners
        jbtAdd.addActionListener(this);
        jbtSub.addActionListener(this);
        jbtMul.addActionListener(this);
        jbtDiv.addActionListener(this);
        jmiAdd.addActionListener(this);
        jmiSub.addActionListener(this);
        jmiMul.addActionListener(this);
        jmiDiv.addActionListener(this);
        jmiClose.addActionListener(this);
      /** Handle ActionEvent from buttons and menu items */
      public void actionPerformed(ActionEvent e) {
        String actionCommand = e.getActionCommand();
        // Handle button events
        if (e.getSource() instanceof JButton) {
          if ("Add".equals(actionCommand))
            calculate('+');
          else if ("Subtract".equals(actionCommand))
            calculate('-');
          else if ("Multiply".equals(actionCommand))
            calculate('*');
          else if ("Divide".equals(actionCommand))
            calculate('/');
        else if (e.getSource() instanceof JMenuItem) {
          // Handle menu item events
          if ("Add".equals(actionCommand))
            calculate('+');
          else if ("Subtract".equals(actionCommand))
            calculate('-');
          else if ("Multiply".equals(actionCommand))
            calculate('*');
          else if ("Divide".equals(actionCommand))
            calculate('/');
          else if ("Close".equals(actionCommand))
            System.exit(0);
      /** Calculate and show the result in jtfResult */
      private void calculate(char operator) {
        // Obtain Number 1 and Number 2
        int num1 = (Integer.parseInt(jtfNum1.getText().trim()));
        int num2 = (Integer.parseInt(jtfNum2.getText().trim()));
        int result = 0;
        // Perform selected operation
        switch (operator) {
          case '+': result = num1 + num2;
                    break;
          case '-': result = num1 - num2;
                    break;
          case '*': result = num1 * num2;
                    break;
          case '/': result = num1 / num2;
        // Set result in jtfResult
        jtfResult.setText(String.valueOf(result));
    Mortgage applet code....
    // MortgageApplet.java: Applet for computing mortgage payments
    import java.awt.*;
    import java.awt.event.*;
    import javax.swing.*;
    import javax.swing.border.TitledBorder;
    public class MortgageApplet extends JApplet
      implements ActionListener {
      // Declare and create text fields for interest rate
      // year, loan amount, monthly payment, and total payment
      private JTextField jtfAnnualInterestRate = new JTextField();
      private JTextField jtfNumOfYears = new JTextField();
      private JTextField jtfLoanAmount = new JTextField();
      private JTextField jtfMonthlyPayment = new JTextField();
      private JTextField jtfTotalPayment = new JTextField();
      // Declare and create a Compute Mortgage button
      private JButton jbtComputeMortgage = new JButton("Compute Mortgage");
      /** Initialize user interface */
      public void init() {
        // Set properties on the text fields
        jtfMonthlyPayment.setEditable(false);
        jtfTotalPayment.setEditable(false);
        // Right align text fields
        jtfAnnualInterestRate.setHorizontalAlignment(JTextField.RIGHT);
        jtfNumOfYears.setHorizontalAlignment(JTextField.RIGHT);
        jtfLoanAmount.setHorizontalAlignment(JTextField.RIGHT);
        jtfMonthlyPayment.setHorizontalAlignment(JTextField.RIGHT);
        jtfTotalPayment.setHorizontalAlignment(JTextField.RIGHT);
        // Panel p1 to hold labels and text fields
        JPanel p1 = new JPanel();
        p1.setLayout(new GridLayout(5, 2));
        p1.add(new Label("Annual Interest Rate"));
        p1.add(jtfAnnualInterestRate);
        p1.add(new Label("Number of Years"));
        p1.add(jtfNumOfYears);
        p1.add(new Label("Loan Amount"));
        p1.add(jtfLoanAmount);
        p1.add(new Label("Monthly Payment"));
        p1.add(jtfMonthlyPayment);
        p1.add(new Label("Total Payment"));
        p1.add(jtfTotalPayment);
        p1.setBorder(new
          TitledBorder("Enter interest rate, year and loan amount"));
        // Panel p2 to hold the button
        JPanel p2 = new JPanel();
        p2.setLayout(new FlowLayout(FlowLayout.RIGHT));
        p2.add(jbtComputeMortgage);
        // Add the components to the applet
        getContentPane().add(p1, BorderLayout.CENTER);
        getContentPane().add(p2, BorderLayout.SOUTH);
        // Register listener
        jbtComputeMortgage.addActionListener(this);
      /** Handle the "Compute Mortgage" button */
      public void actionPerformed(ActionEvent e) {
        if (e.getSource() == jbtComputeMortgage) {
          // Get values from text fields
          double interest = (Double.valueOf(
            jtfAnnualInterestRate.getText())).doubleValue();
          int year =
            (Integer.valueOf(jtfNumOfYears.getText())).intValue();
          double loan =
            (Double.valueOf(jtfLoanAmount.getText())).doubleValue();
          // Create a mortgage object
          Mortgage m = new Mortgage(interest, year, loan);
          // Display monthly payment and total payment
          jtfMonthlyPayment.setText(String.valueOf(m.monthlyPayment()));
          jtfTotalPayment.setText(String.valueOf(m.totalPayment()));
    }

    Does it have to be an applet?
    If you want the same behaviour as in the code with traffic lights, change
    class MortgageApplet extends JApplet implements ActionListener {
    to
    class MortgageApplet extends JFrame implements ActionListener {
    and change
    public void init() {
    to
    public MortgageApplet() {                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           

  • Slow Macbook Pro- please help, I don't understand previous advice.

    Hello all,
    I have a very slow Macbook Pro running on Lion 10.7.3.
    I looked up this problem on the forums before I sent this message but I didn't quite understand the advice. I have been on something called Disk Utility and Activity Monitor but don't really understand what I'm looking for. It seems a large percentage of my mac is 'idle' if that makes sense. Someone said to look at Page Out but I really don't understand what that means and what sort of numbers are normal.
    I do have some storage left so I don't think it could be that. A lot of my gigabytes seem to be taken up by movies and 'other'. I've tried deleted a load of videos but it hardly made a difference. I have Mac Mail and it seems very slow on my Macbook compared to on my Ipad and iphone. iCal is also very slow on here and it always takes a while to load internet pages. It isnt the wifi connection.
    Please help and bear in mind I am by no means a Mac whizz so you might have to talk in layman's terms!
    Thanks,
    Amy

    If you have more than ten or so files or folders on your Desktop, move them, temporarily at least, somewhere else in your home folder.
    If iCloud is enabled, disable it.
    Disconnect all wired peripherals. Launch the usual set of applications you use when you notice the problem.
    Step 1
    Launch the Activity Monitor application in any of the following ways:
    ☞ Enter the first few letters of its name into a Spotlight search. Select it in the results (it should be at the top.)
    ☞ In the Finder, select Go ▹ Utilities from the menu bar, or press the key combination shift-command-U. The application is in the folder that opens.
    ☞ If you’re running Mac OS X 10.7 or later, open LaunchPad. Click Utilities, then Activity Monitor in the page that opens.
    Select the CPU tab.
    Select All Processes from the menu in the toolbar, if not already selected.
    Click the heading of the % CPU column in the process table to sort the entries by CPU usage. You may have to click it twice to get the highest value at the top. What is it, and what is the process? Also post the values for % User, % System, and % Idle at the bottom of the window.
    Select the System Memory tab. What values are shown in the bottom part of the window for Page outs and Swap used?
    Step 2
    Launch the Console application in the same way as above, and select “kernel.log” from the file list. Post the dozen or so most recent messages in the log — the text, please, not a screenshot.
    If there are runs of repeated messages, post only one example of each. Do not post many repetitions of the same message.

  • Don't understand the cc cleaner tool

    Good morning and happy new year.
    I must be the dumbest people here but I tried to follow the cc cleaner tool process explained here and I'm at a loss and stopped before making a fool of myself.
    I went through the process 1 and 2 ie. I have a disk repair and an external disk backup of my system driver. (I use Win 7 Ultimate fully updated). My projects are NOT on the system drive as well as all the clips I use .
    question : Will CC cleaner delete on the system drive any information related to my projects? I need a precise answer: No or Yes. The "perhaps", "maybe" etc evavive answers are not acceptable in such situations.
    In  the step 2 of the help file I uninstalled with Win 7 uninstall manager different elements from CC and CS 6 that either I have no use of or that I wont use anymore as I want to stick to the latest version of CC which are PPro, AE  and Mediaencoder for the moment.
    We arrive to step 3 and there I just don't understand why I should have to uninstall programs I uninstalled in the previous step. Will that step totally erase the whole programs of CC for example, or will it just clean remaining items or directories specifically related to for instance Prelude CC 2014 ? Can't people who write these messages in their scripts be once and for all precise in their wording saying what will be done?!
    In this present instance I need to make a clean re-install of Mediaencoder CC as there has been most probably a problem during the recent update although it was completed without any error messages; I can't anymore re encode a project although I have not changed a line of it! The program stops suddenly and reboots my computer. I have not changed anything in the computer as well and the hardware is not the cause of the problem as it is only Media encoder which provokes the crash when it did not before the update.
    This will be probably considered an ill mannered way of presenting my problem by I'm sorry to say that one cannot work cautiously enough and I don't want to see weeks of work erased and not usable even with backups because a user manual is not clear and precise in its wording. This infuriates me and I wish to know where I set foot!
    Again sorry for my bad temper but really this is stressing.
    Thanks in advance for your help
    Claude

    Hi David,
    First happy new year. Secondly thanks for a reply which shows I was read...
    Let's review your remarks and questions.
    A/ it can be useful for you to know my pc configuration, I should have put it in my question:
    More details about my computer
    Component
    Details
    Subscore
    Base score
    Processor
    Intel(R) Core(TM) i5 CPU 760 @ 2.80GHz
    7.3
    5.9
      Determined by lowest subscore
    Memory (RAM)
    8.00 GB
    7.5
    Graphics
    ASUS HD7950 Series
    7.9
    Gaming graphics
    6559 MB Total available graphics memory
    7.9
    Primary hard disk
    49GB Free (286GB Total)
    5.9
    Windows 7 Ultimate
    System 
    Manufacturer
    System manufacturer
    Model
    System Product Name
    Total amount of system memory
    8.00 GB RAM
    System type
    64-bit operating system
    Number of processor cores
    4
    Storage 
    Total size of hard disk(s)
    5123 GB
    Disk partition (C:)
    49 GB Free (286 GB Total)
    Disk partition (D:)
    185 GB Free (488 GB Total)
    Disk partition (E:)
    233 GB Free (2795 GB Total)
    Disk partition (F:)
    646 GB Free (646 GB Total)
    Disk partition (G:)
    40 GB Free (244 GB Total)
    Disk partition (H:)
    40 GB Free (199 GB Total)
    Media drive (I:)
    CD/DVD
    Disk partition (M:)
    33 GB Free (466 GB Total)
    Graphics 
    Display adapter type
    ASUS HD7950 Series
    Total available graphics memory
    6559 MB
          Dedicated graphics memory
    3072 MB
          Dedicated system memory
    0 MB
          Shared system memory
    3487 MB
    Display adapter driver version
    13.152.0.0
    Primary monitor resolution
    1920x1080
    Secondary monitor resolution
    1360x768
    DirectX version
    DirectX 10
    Network 
    Network Adapter
    Realtek PCIe GBE Family Controller
    Notes 
    The gaming graphics score is based on the primary graphics adapter. If this system has linked or multiple graphics adapters, some software applications may see additional performance benefits.
    My project is on driver G, my clips are on D, E and G, with a majority of them on G; Cloud CC 2014 is on Driver C with Windows 7
    B/What version of Premiere Pro are you running currently? Do you have any third party plug-ins or hardware you using in conjunction with Premiere Pro? Do you know what version of Media Encoder you were using successfully before the recent update and you started having problems?
    I use exclusively since I took the subscription to Cloud CC, the latest versions, I check updates or upgrades every week and of course get notification also by the automatic Cloud manager of any new version. My last update was done on the 30th of December 2014. So yes I run with the most recent programs; the problems occurred just after! And got aggravated yesterday for no reason when Media encoder and Premiere Pro did not recognized MP4 format clips with an error message that the format was not supported!!! I hope Adobe did not decide to abandon this format, because it would put my 2 projects in full jeopardy!
    Before the last update I had no problems. I have uploaded on Vimeo a provisional encoded file (see
    with password rja404177 .
    I decided  to separate my project in two master projects concerning each of them the 2 parts of the video, with different names as to make the projects less heavy to manage by the computer and also easier to correct or change some of the effects controls especially the use of the curves RGB effect. I have a problem of getting an even colorimetric view between three different sources of files and cameras, one source is analog, the others HD and one of the latest has been more or less over exposed, so I check every clips with the YCscope and RGB parade and Vectorscope ( there could be a problem of color broadcast due to the red of the cliffs). Just imagine what would happen If I had to do it again! The full video is 1h10 minutes long! The video here corresponds to the first master project before the division in two parts. As I use nested sequences I have transferred in the master sequence here the 3 first sequences of the film (Titles, Las Vegas to Lee's Ferry, 1st day on the river).
    Yes I have Video Copilot addons but which are not used in the project as well as Red Giant Universe Premium also not used here. In fact I seldom use special effects in these projects as they are kind of documentary on my raft trip down the Colorado in 1995 updated with films of two friends done 2011 and 2013. The only effects used are Cross dissolve and the Slide push one twice in the project for the last one. I use otherwise the default controls of scale and opacity if necessary. Soundwise, my tracks are declared 5.1 and used in conjunction with Audition CC (I've been a user of this last program for many years since it's creation by Syntrillium under the name CoolEdit Pro before Adobe acquired it!)
    May I add that I'm not a novice with computers although an old froggy of 73!LOL! I began using computers in 1972 besides my job of Financial Analyst. I developed software in APL+ for stocks buy and sell decision making and created in France the first financial database in 1978 I was considered at that time like a perfect crazy guy in my business, good to be put in an asylum!!!. Since then I must say I had a good laugh! Try to prevent a trader to use a computer and databases nowadays and you'll see the speed at which he will throw you out of the window!
    C/I would probably have focused on just Media Encoder if possible but whats done is done. Maybe you did?
    Yes you're right I sort of thought of Media encoder first, but revised my way of dealing with the problem thinking that may be the installation had not been done correctly although no problem occurred during the update. I always update one program at a time waiting it to be fully completed before clicking on the install button of the next one.
    D/ about the two methods of uninstall.
    You say "The cleaner tool removes the same directories as the standard uninstaller. However the uninstaller is definitely the preferred method as it is done in conjunction with OS and the registry versus scripts which don't. The cleaner tool is generally used when the standard uninstall method fails "
    May I say I'm not sure this is the right way to do from the user viewpoint. It is misleading. I'm again neither a professional in development although I mentioned what I did when I was not retired, and not a professional in Video editing etc.. I just address the problem from the user's point of view. If Adobe thinks that the Management panel solution is the best solution to have all the files eliminated let's stick to it. In fact one can see by using the CCleaner program that it does not eliminate all the register's problems after having uninstalled a program. So perhaps then it is justified to use also the Adobe CC Cleaner device. Then may I suggest that the phrasing of the step 3 be changed to make the user understand its real purpose. From what you say one induces that they are complementary. This should be perfectly clear in the user's brain.  When I tried to find answers to my problems on the forums it showed many times that people did not really understand what would happen, how the device was going to work. That's why I insisted in my question on the "precise, yes or no " etc.. answers required. I can dedicate time to such questioning, I doubt a professional having to deliver a final product under contract has time to make hypothesis on this matter if it occurs to him such mishaps....
    E/ miscellaneous questions:
    Yes I use the default format proposed by Media encoder H.264  preset : Match source high bitrate which matches my project's settings. It worked three times before the update without an hitch. Why should not it go on like that?
    The encoded files are saved either on the driver of the project file, or on the E external driver to make sure I do not erase the final encoded file by mistake. Poirot's little grey cells are a little bit rusty nowadays!
    I had no problems before the update by working like that.
    I did not try a different codec before the last event which is the impossibility of using my MP4 clips. By the way the projects contain also AVI uncompressed (codec UYVY) files (My quicktime version is also updated) and the native files of my Canon Legria AVCHD camera (AVC format) and  I used the AVI uncompressed format because I wanted to derush my analog files to eliminate any shots which were of poor quality. I use for this a small software: AVI Cutty which works only with AVI uncompressed files. So I used Media Encoder to pre encode my analog files in this format first; It separate automatically my videos in clips more or less corresponding to scenes. Again I had no problem since I began to use Adobe software more than a year ago with CS5.5 and then with CC 2014 since last September as a yearly subscriber.
    Both projects have the same problem.
    I checked the Windows task manager while encoding and I observed this:
    a/ the crash occurs randomly in time.
    b/ it seems that each time the encoding passes on a cross dissolve section (I'm not certain of that it can be also the changes in the curves RGB effects settings from one clip to the other.) the CPU usage curve reaches a peak around 95 to nearly 100%. I suppose the crash occurs when the 100%+ is reached.
    c/I've checked my system driver's integrity, there is no problem here. I did the same for the memory which is ok too.
    d/ No I did put the question on other forums because I did not find the right place to put it.
    I do my best not to pollute other forums with non related questions.
    e/ As for the recognition of the MP4 files, other programs like the Windows mediaplayer recognize them so it's not a question of corrupted files.
    f/ I've just checked with the reinstalled media encoder. I did not re-encode but I do not get any more messages that the MP4 format is not recognized! Thank god! Remains to test the re-encoding itself and PP when the installation is over.
    Well I hope this long answer gives you a better idea of what is going on. I'm finishing right now the re installation of PP AE Media encoder and Audition and will come back to you with the results.
    Thanks again
    Best
    Claude

  • Don't understand private access error message.

    I am calling createAndShowGui from another file and am getting an error message from the compiler that says:
    createAndShowGUI has private access in masterfilemaint.MasterFileMaint.
    I don't understand because the method is public. Here is the call.
    thanks.
        public void actionPerformed(ActionEvent e) {
            if ("Fil".equals(e.getActionCommand())) {   ///  The Call......
                   callItemMaint.createAndShowGUI();
                if ("Tab".equals(e.getActionCommand()))  {
                   callSimpleTableDemo.createAndShowGUI();   
                if ("Quit".equals(e.getActionCommand())) {
                   quit();
                /*else {
                  quit();
        }       ..............And here is the method.
           public void createAndShowGUI() {// was static
            // set decor
            JFrame.setDefaultLookAndFeelDecorated(true);
            // create/set-up window
            JFrame frame = new JFrame("Guide");
            frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
            // set up content pane.
            addComponentsToPane(frame.getContentPane());
            // Display window
            frame.pack();
            frame.setVisible(true);
    }

    Is the createAndShowGUI in a public class?
    Yes here is the first few lines of the class:
    package masterfilemaint;
    import java.awt.*;
    import javax.swing.JButton;
    import javax.swing.JFrame;
    import javax.swing.JTextArea;
    import javax.swing.JTextField;
    import javax.swing.JLabel;
    import javax.swing.*;
    import java.awt.event.ActionEvent;
    import java.awt.event.ActionListener;
    import java.awt.event.ActionEvent;
    import java.awt.event.ActionListener;
    public class MasterFileMaint {                //   Class is public .........
        final static boolean shouldFill = true;
        final static boolean shouldWeightX = true;
        final static boolean RIGHT_TO_LEFT = false;
        final static boolean DEBUG = false;
        public JTextField textFieldOne, textFieldTwo,
                             textFieldThree, textFieldFour, textFieldFive;
        public JLabel label;
        public JButton button;
        public String one, two, three, four, five, six;
        Is callItemMaint an instance of that class or an instance of a base class or interface?
    callitemMaint is an instance of MasterFileMaint instantiated in the calling class. Here is the first few lines of MaterFileMaint.
    package probuyermain;
    import CalculatorOne.*;
    import simpletabledemo.*;
    import masterfilemaint.*;
    import java.awt.*;
    import java.awt.event.*;
    import javax.swing.JMenu;
    import javax.swing.JMenuItem;
    import javax.swing.JCheckBoxMenuItem;
    import javax.swing.JRadioButtonMenuItem;
    import javax.swing.ButtonGroup;
    import javax.swing.JMenuBar;
    import javax.swing.KeyStroke;
    import javax.swing.ImageIcon;
    import javax.swing.JPanel;
    import javax.swing.JTextArea;
    import javax.swing.JScrollPane;
    import javax.swing.JFrame;
    public class ProBuyerMain implements ActionListener {
        JTextArea output;
        JScrollPane scrollPane;
        MasterFileMaint callItemMaint = new MasterFileMaint();        // The instance
        CalculatorOne callCalculator = new CalculatorOne();
        SimpleTableDemo callSimpleTableDemo = new SimpleTableDemo();
        public JMenuBar createMenuBar() {
            JMenuBar menuBar;
            JMenu fileMenu, submenu;
            JMenuItem menuItemOne, menuItemTwo,
                        menuItemThree, menuItemFour, menuItemFive;
            //Create the menu bar.
            menuBar = new JMenuBar();

  • Create SP that returns value and at the same time displays query result in output window

    I would like create an SP which will return the records from the table and also return value to my c# client application.
    For Example:
    Select * from employee returns all the query results in output window.
    Now I want to create an SP
    Create procedure Test
    As
    Declare @ret int,
    Select * from employee
    set @ret = Select count(*) from employee
    if @ret > 0
    return 1
    else
    return 0
    The above algo should return 1 0r 0 to c# client application and at the same time display all employees in sql query output window.
    Can u pls help in this regard.

    The above algo should return 1 0r 0 to c# client application and at the same time display all employees in sql query output window.
    Why?  and No!
    Why?  Your procedure generates a resultset of some number of rows.  You check the resultset for the presence of rows to determine if "anything is there".  You don't need a separate value to tell you this.  Note that it helps
    to post tsql that is syntactically correct.   While we're at it, if you just need to know that rows exist there is no need to count them since that does more work than required.  Simply test for existence using the appropriately-named function
    "exists".  E.g., if exists (select * from dbo.employee). 
    No!  A stored procedure does not display anything anywhere.  The application which executes the procedures is responsible for the consumption of the resultset; it chooses what to do and what to display. 
    Lastly, do not get into the lazy habit of using the asterisk in your tsql code.  That is not best practice.  Along with that, you should also get into the following best practice habits:
    schema-qualify your objects (i.e., dbo.employee)
    terminate every statement - it will eventually be required.

  • I don't understand why appear new decimals.

     

    Hi Jorge,
    Instead of using
    Data.SetValue(FormatDouble.DecodeDouble(self.PKg));
    use
    Data.SetValue(FormatDouble.DecodeDecimal(self.PKg,Data.Scale)); //
    This will take the second parameter of scale
    You will see the desired results.
    Thks,
    Sanjay
    -----Original Message-----
    From: Dave Ortman [SMTP:dortmanyahoo.com]
    Sent: Monday, March 05, 2001 12:32
    To: Jorge Bellido; forte-userslists.xpedior.com
    Subject: Re: (forte-users) I don't understand why appear new
    decimals.
    Simply put, the problem stems from the fact that
    floating-point arithmetic is inherently imprecise.
    Rounding errors are common.
    With doubles, you get 16 digits of accuracy. Beyond
    that there is no guarantee.
    If you want more information:
    http://docs.sun.com/htmlcoll/coll.648.2/iso-8859-1/NUMCOMPGD/ncg_goldberg.ht
    ml
    -Dave Ortman
    --- Jorge Bellido <jorge.bellidoeam.es> wrote:
    > I have another problem with numbers. So,
    >
    > Data: DecimalNullable = new;
    > Data.Scale = 20;
    > FormatDouble.Template = TextData(value='#');
    >
    > Dato.SetValue(FormatDouble.DecodeDouble(self.PKg));
    >
    > PKg is a widget DataField, whose mapped type is
    > TextData with input mask float. When I write 1.12
    > into the widget the variable Data is
    > 1.1200000000000001, and I can't understand it. I
    > would like that variable Data was 1.12.
    >
    > Could anybody to explain it?
    >
    > Thank you very much.
    >
    For the archives, go to: http://lists.xpedior.com/forte-users and
    use
    the login: forte and the password: archive. To unsubscribe, send in
    a new
    email the word: 'Unsubscribe' to:
    forte-users-requestlists.xpedior.com

  • Don't understand IMAQ image behavior

    Hi there,
         I have several image controls in my application.  When I assign image A to image B (in my wiring diagram), and then close image B, image A is no longer valid!  When I try to crop image A after closing image B, I get a "not an image" error.  If I do not assign image A to image B, I don't get the error.  If I do not close image B after assigning image A, I don't get the error.
         I am new to IMAQ and don't understand this behavior at all.  It looks like when I try to give the value of image A to image B, it somehow links the two rather than just copying the information over.  Is this a pointer and reference vs. value assignment issue? 
         Regardless, these IMAQ image controls behave differently than any other control in the labview palette.  I hope someone can explain what I am seeing to me so that I that I can learn when I can assign one image to another, and when I can close, and how I can avoid extremely confusing and difficult to debug results.
    Thanks,
    Eric

    Hi,
    You must create each of Image A and Image B separately using IMAQ Create and then copy content of image A to image B using IMAQ Copy.
    Image Display control in Labview does not create an image and does not reserve memory for it. It just displays content of the image it is wired to. I suspect that when you "assign" image A to image B in your program,  you just wire the same image to 2 Image Display controls. No wonder they show identical image. When you "close image B", you actually closing the only image you have, memory space allocated fot that image is released and reference is no longer valid. After that any attempt to modify/change that image will return "not an image" error.
    I recommend you to look into Vision examples shipped with Labview - see for example "Extract Example.vi" in "C:\Program Files\National Instruments\LabVIEW 7.1\examples\Vision\2. Functions\Image Management". In the path above you should change LabVIEW 7.1 to your version of LabVIEW.

  • I don't understand how to bind a node

    Hi guys
    I don't understand how to bind a node
    I want to bind a mandatory parameter for my model (ex: Bapi_Delete_Travel_Expense_Input)
    if  the parameter is a node ,not a attribute,how to bind it I don't understand yet.
    Please give me some suggest
    Thanks
    Best Regards
    Yan

    Context--
    Z_Hr_Ess_Delete_Travel_Expense_Input (node)
    Framedata (node)  
    Outpute   (node)
    Employeenumber (attribute)
    Tripno (attribute)
    The Framedata's structure is Bapitrmian
    The mandatory parameter is " Framedata" ,  "Employeenumber "  , "Tripno"
    The  Framedata  need  through other  RFC "Z_Hr_Ess_Read_Travel_Details_Input"   to get  
    Context--
    Z_Hr_Ess_Read_Travel_Details_Input
    Output  (node) 
    Framedata (node) 
    Employeenumber (attribute)

  • Don't understand why WSDL isn't valid

    In Workshop 9.2, I'm developing an annotation-based web service. I imported my schemas and generated the xmlbeans, and after setting my input and output parameters in the service class, I tried to generate the WSDL from the service. For some reason, the WSDL is not valid, and I don't understand why. I'm sure it's a namespace issue, but I don't see it.
    The enclosed WSDL is somewhat paraphrased from the generated WSDL.
    On line 76 (marked with a comment), there is the first of several errors. It says:
    "The input element is referencing an undefined message 'overrideRequest'. Check that the message name and namespace are correct and that the message has been defined."
    Here is the WSDL:
    <?xml version='1.0' encoding='UTF-8'?>
    <s0:definitions name="SampleServiceDefinitions"
    targetNamespace="http://schemas.wamu.com/Sample.wsdl"
    xmlns=""
    xmlns:s0="http://schemas.xmlsoap.org/wsdl/"
    xmlns:tns="http://schemas.wamu.com/Sample.wsdl"
    xmlns:ratings="http://schemas.wamu.com/2006/07/LoanSampleRequest"
    xmlns:questions="http://schemas.wamu.com/2006/07/QuestionsRequest"
    xmlns:s2="http://schemas.xmlsoap.org/wsdl/soap/">
    <s0:types>
    <xs:schema targetNamespace="http://schemas.wamu.com/2006/07/LoanSampleRequest"
    xmlns:ratings="http://schemas.wamu.com/2006/07/LoanSampleRequest"
    xmlns:xs="http://www.w3.org/2001/XMLSchema">
    <xs:element name="loanSampleRequest">
    <xs:complexType>
    <xs:sequence>
    <xs:element ref="ratings:loanProperties"/>
    </xs:sequence>
    <xs:attribute name="modelVersion" type="xs:integer" use="optional"/>
    </xs:complexType>
    </xs:element>
    <xs:element name="loanSampleResponse">
    <xs:complexType>
    <xs:sequence>
    <xs:element ref="ratings:loanProperties"/>
    <xs:element ref="ratings:messages"/>
    </xs:sequence>
    </xs:complexType>
    </xs:element>
    <xs:element name="loanProperties">
    <xs:complexType>
    <xs:sequence>
    <xs:element maxOccurs="unbounded" ref="ratings:property"/>
    </xs:sequence>
    </xs:complexType>
    </xs:element>
    <xs:element name="property">
    <xs:complexType>
    <xs:sequence>
    <xs:element ref="ratings:key"/>
    <xs:element ref="ratings:value"/>
    </xs:sequence>
    </xs:complexType>
    </xs:element>
    <xs:element name="key" type="xs:string"/>
    <xs:element name="value" type="xs:string"/>
    <xs:element name="messages">
    <xs:complexType>
    <xs:sequence>
    <xs:element maxOccurs="unbounded" minOccurs="0" ref="ratings:message"/>
    </xs:sequence>
    </xs:complexType>
    </xs:element>
    <xs:element name="message">
    <xs:complexType mixed="true">
    <xs:attribute name="level" type="xs:string"/>
    <xs:attribute name="fieldName" type="xs:string"/>
    </xs:complexType>
    </xs:element>
    </xs:schema>
    </s0:types>
    <s0:message name="overrideRequest">
    <s0:part element="ratings:loanSampleRequest" name="parameters"/>
    </s0:message>
    <s0:message name="overrideRequestResponse">
    <s0:part element="ratings:loanSampleResponse" name="parameters"/>
    </s0:message>
    <s0:message name="ratingsRequest">
    <s0:part element="ratings:loanSampleRequest" name="parameters"/>
    </s0:message>
    <s0:message name="ratingsRequestResponse">
    <s0:part element="ratings:loanSampleRequest" name="parameters"/>
    </s0:message>
    <s0:portType name="Sample">
    <s0:operation name="overrideRequest">
    <s0:input message="tns:overrideRequest"/> <!-- 76 -->
    <s0:output message="overrideRequestResponse"/>
    </s0:operation>
    <s0:operation name="ratingsRequest" parameterOrder="parameters">
    <s0:input message="ratingsRequest"/>
    <s0:output message="ratingsRequestResponse"/>
    </s0:operation>
    </s0:portType>
    <s0:binding name="SampleServiceSoapBinding" type="tns:Sample">
    <s2:binding style="document" transport="http://schemas.xmlsoap.org/soap/http"/>
    <s0:operation name="overrideRequest">
    <s2:operation soapAction="" style="document"/>
    <s0:input>
    <s2:body parts="parameters" use="literal"/>
    </s0:input>
    <s0:output>
    <s2:body parts="parameters" use="literal"/>
    </s0:output>
    </s0:operation>
    <s0:operation name="ratingsRequest">
    <s2:operation soapAction="" style="document"/>
    <s0:input>
    <s2:body parts="parameters" use="literal"/>
    </s0:input>
    <s0:output>
    <s2:body parts="parameters" use="literal"/>
    </s0:output>
    </s0:operation>
    </s0:binding>
    <s0:service name="SampleService">
    <s0:port binding="tns:SampleServiceSoapBinding" name="SampleSoapPort">
    <s2:address location="http://localhost:7001/Sample/Sample"/>
    </s0:port>
    </s0:service>
    </s0:definitions>
    --------------------

    After I made these changes and re-validated, I get a dialog that says "The WSDL file is valid however warnings have been issued. See the Problems view for a list of the validation warnings", and I see the following in the Problems list:
    IWAE0053E An internal error has occurred running validation on project:RiskRatingContainer]:RiskRatingContainer, check the log file for details
    In in my WSDL editor, the lines in question still have a red circle with a white "x" in the left margin, and the tooltip still reports the same errors as before.
    In the "Error Log" view, I see the following:
    *** ERROR ***: Thu Feb 22 12:10:09 PST 2007 org.eclipse.wst.validation.internal.core.ValidationException: IWAE0053E An internal error has occurred running validation on project:RiskRatingContainer]:RiskRatingContainer, check the log file for details
    Just in case, I'll include my current WSDL again here.
    <?xml version='1.0' encoding='UTF-8'?>
    <s0:definitions name="SampleServiceDefinitions"
    targetNamespace="http://schemas.wamu.com/Sample.wsdl"
    xmlns=""
    xmlns:s0="http://schemas.xmlsoap.org/wsdl/"
    xmlns:tns="http://schemas.wamu.com/Sample.wsdl"
    xmlns:ratings="http://schemas.wamu.com/2006/07/LoanSampleRequest"
    xmlns:questions="http://schemas.wamu.com/2006/07/QuestionsRequest"
    xmlns:s2="http://schemas.xmlsoap.org/wsdl/soap/">
    <s0:types>
    <xs:schema targetNamespace="http://schemas.wamu.com/2006/07/LoanSampleRequest"
    xmlns:ratings="http://schemas.wamu.com/2006/07/LoanSampleRequest"
    xmlns:xs="http://www.w3.org/2001/XMLSchema">
    <xs:element name="loanSampleRequest">
    <xs:complexType>
    <xs:sequence>
    <xs:element ref="ratings:loanProperties"/>
    </xs:sequence>
    <xs:attribute name="modelVersion" type="xs:integer" use="optional"/>
    </xs:complexType>
    </xs:element>
    <xs:element name="loanSampleResponse">
    <xs:complexType>
    <xs:sequence>
    <xs:element ref="ratings:loanProperties"/>
    <xs:element ref="ratings:messages"/>
    </xs:sequence>
    </xs:complexType>
    </xs:element>
    <xs:element name="loanProperties">
    <xs:complexType>
    <xs:sequence>
    <xs:element maxOccurs="unbounded" ref="ratings:property"/>
    </xs:sequence>
    </xs:complexType>
    </xs:element>
    <xs:element name="property">
    <xs:complexType>
    <xs:sequence>
    <xs:element ref="ratings:key"/>
    <xs:element ref="ratings:value"/>
    </xs:sequence>
    </xs:complexType>
    </xs:element>
    <xs:element name="key" type="xs:string"/>
    <xs:element name="value" type="xs:string"/>
    <xs:element name="messages">
    <xs:complexType>
    <xs:sequence>
    <xs:element maxOccurs="unbounded" minOccurs="0" ref="ratings:message"/>
    </xs:sequence>
    </xs:complexType>
    </xs:element>
    <xs:element name="message">
    <xs:complexType mixed="true">
    <xs:attribute name="level" type="xs:string"/>
    <xs:attribute name="fieldName" type="xs:string"/>
    </xs:complexType>
    </xs:element>
    </xs:schema>
    </s0:types>
    <s0:message name="overrideRequest">
    <s0:part element="ratings:loanSampleRequest" name="parameters"/>
    </s0:message>
    <s0:message name="overrideRequestResponse">
    <s0:part element="ratings:loanSampleResponse" name="parameters"/>
    </s0:message>
    <s0:message name="ratingsRequest">
    <s0:part element="ratings:loanSampleRequest" name="parameters"/>
    </s0:message>
    <s0:message name="ratingsRequestResponse">
    <s0:part element="ratings:loanSampleRequest" name="parameters"/>
    </s0:message>
    <s0:portType name="Sample">
    <s0:operation name="overrideRequest">
    <s0:input message="tns:overrideRequest"/> <!-- 76 -->
    <s0:output message="tns:overrideRequestResponse"/>
    </s0:operation>
    <s0:operation name="ratingsRequest" parameterOrder="parameters">
    <s0:input message="tns:ratingsRequest"/>
    <s0:output message="tns:ratingsRequestResponse"/>
    </s0:operation>
    </s0:portType>
    <s0:binding name="SampleServiceSoapBinding" type="tns:Sample">
    <s2:binding style="document" transport="http://schemas.xmlsoap.org/soap/http"/>
    <s0:operation name="overrideRequest">
    <s2:operation soapAction="" style="document"/>
    <s0:input>
    <s2:body parts="parameters" use="literal"/>
    </s0:input>
    <s0:output>
    <s2:body parts="parameters" use="literal"/>
    </s0:output>
    </s0:operation>
    <s0:operation name="ratingsRequest">
    <s2:operation soapAction="" style="document"/>
    <s0:input>
    <s2:body parts="parameters" use="literal"/>
    </s0:input>
    <s0:output>
    <s2:body parts="parameters" use="literal"/>
    </s0:output>
    </s0:operation>
    </s0:binding>
    <s0:service name="SampleService">
    <s0:port binding="tns:SampleServiceSoapBinding" name="SampleSoapPort">
    <s2:address location="http://localhost:7001/Sample/Sample"/>
    </s0:port>
    </s0:service>
    </s0:definitions>
    ---------------------------

  • CREATIVE CENTRALE, PLEASE, I REALLY DON'T UNDERSTAND

    HELP!!!! I really don't understand. I always buy creative, they sound awesome, I hate ipod, I have several players, I tell people about the hardware, but, WHY, WHY, WHY? such unimaginably amazingly good hardware and abso-lutely appalling and useless softwafre?? It really spoils the whole experience.
    TAKE NOTE CREATIVE. PLEASE, PLEASE, PLEASE CAN YOU DO SOMETHING ABOUT YOUR ATROCIOUS, RUBBISH, UNSTABLE AND UNFATHOMABLY HARD TO USE AND UNINTUITIVE SOFTWARE AS IT IS TOTALLY RUINING MY OTHERWISE EXCELLENT CREATIVE EXPERIENCE!!!!!
    Creative Centrale is appallingly bad, creating a new playlist is like torture, now it wont work at all and I have reinstalled it many times. I am going to (reluctantly) have to buy a new player to replace my lovely little Zen Mosaic JUST so I can get some decent software to create playlists.
    Really this is beyond belief guys, best hardware out there, worst software. Want to know how Apple became no ? No, it wasnt the flashy looks, all that kudos came later, how they really became no is simple, despite continuing?
    concerns over their hardware it was their fantastic, easy to use intuiti've software for ALL their products that did it.
    Hell-ooooo!!! Wake up. Such a shame. Rant over.
    If anyone knows of another program I can download to help me use my little Mosaic (its my friend, I listen to it every day, for hours) then please let me know. T

    I have this piece of code:
    private static String[] getArgs(String command){
    System.out.println(System.currentTimeMillis()-startlog+
    : "+"In getArgs.");
    command = command.substring(3, command.length());
    System.out.println(System.currentTimeMillis()-startlog+
    : "+"The command: "+command);
    String[] args = new String[0];
    int last = 0;
    System.out.println(System.currentTimeMillis()-startlog+
    : "+"Command length: "+command.length());
    boolean exit = false;
    int end = command.length();
    int count = 0;
    while(count<=end){//Why don't this cicle ends!?
    System.out.println(System.currentTimeMillis()-startlog+
    : "+"(count="+count+").");
    if(command.charAt(count)==',' ||
    command.charAt(count)==';'){
    System.out.println(System.currentTimeMillis()-startlog+
    : "+"Found ',' or ';'.");
    args = addColum(args);
    args[args.length-1] = command.substring(last, count);
    System.out.println(System.currentTimeMillis()-startlog+
    : "+"Found arg: "+args[args.length-1]);
    last = count+1;
    count++;
    System.out.println(System.currentTimeMillis()-startlog+
    : "+"Returning args.");
    return args;
    }And the output is this:
    14148: In getArgs.
    14148: The command: TextIO.java;
    14149: Command length: 12
    14149: (count=0).
    14149: (count=1).
    14149: (count=2).
    14149: (count=3).
    14161: (count=4).
    14161: (count=5).
    14161: (count=6).
    14161: (count=7).
    14162: (count=8).
    14162: (count=9).
    14162: (count=10).
    14162: (count=11).
    14162: Found ',' or ';'.
    14162: In addColum.
    14162: Found arg: TextIO.java
    14166: (count=12).
    Why don't the cicle ends?whats printed out after
    14162: Found arg: TextIO.java
    14166: (count=12).

Maybe you are looking for

  • How to get the total no of delivery quantity in PO

    Hello, This is shehryar. my previous account got locked(dunno why  ) , so i have created a new acc. I want to display the total no of delivery quantity of a line item in PO. can it be done ? Thanks.. Shehryar

  • Inventory account is not defined [Goods Receipt PO - Rows - Warehouse Code

    Hai All, When I copied from PO to GR PO the below said error accord. G/L are set by  Item level. General Setting > Inventory Tab > Set G/L Accounts as : *by item level* Error: Inventory account is not defined [Goods Receipt PO - Rows - Warehouse Code

  • SELECT-OPTION IN SCREEN (SCREEN-PAINTER)

    I want to put a select option in a screen type screen painter Using this the user could enter a ranger of personal numbers. Can any one give me a clue on how to do that ?

  • How to make vendor payment thru RTGS

    Hi, Will someone pl let me know as to how to make vendor payment thru electronic fund transfer? Our vendors are paid thru RTGS. Can some pl let me know the complete business process procedure. And also the configuration required for the same. Thanks

  • Audio on keynote exported quicktime videos cuts out at 50 seconds?

    It just started!  When I export my keynote into a Quicktime file, the audio cuts out at 50 seconds.  I have been creating videos a long time with this method and never had problems before.