How to write this assignment in oom way(long)

i try to write a new class, but i am not very sure if there is only one new class, I shall write a Movie class or a Ticket class?
this is my Movie class, if I also want to write a new Ticket class. and still i don't know how to write
because the Ticket class uses some of the attributes of the Movie class such as start time, Movie.name, as in this situation the relation
between Ticket and Movie is still aggregation, or become a generalization?
and how to represent that a Movie can have many Tickets? I shall write a buy-ticket method inside the Ticket class or Movie class.
(are there any thing not right with this movie class? thanks)
============================
class Movie
     String name;
     String startTime;
     String [] coupleChair=new String[11];//start from 1 to 10
     String [] singleChair=new String[11];//start from 1 to 10     
     public Movie(String str1st)
          this.name=str1st;
     public Movie(String str1st, String str2nd)
          this.name=str1st;
          this.startTime=str2nd;
     public String buyA_Single_Ticket()
          int i=1;
          do
               if(this.singleChair!="sold")
                    this.singleChair[i]="sold";
                    return "You seat is Single Seat No."+i+"\n Enjoy the movie :)";
               else i++;
          while(i<=10);//when i==11 jump out
          return "Sorry, all Single seats have been sold Out";
     public String buyA_Couple_Ticket()
          int i=1;
          do
               if(this.coupleChair[i]!="sold")
                    this.coupleChair[i]="sold";
                    return "You seat is Couple Seat No."+i+"\n Enjoy the time ;)";
               else i++;
          while(i<=10);//when i==11 jump out
          return "Sorry, all Couple seats have been sold Out";
}//end class
============================
this is the question
A small ABC cinema has just purchased a computer for its new automated reservations system. You have been asked to program the new system. You are to write a Java application to assign seats on each movie show on the day (capacity: 20 seats for 1 movie).
Your program should display the following alternatives: ��Please type 1 for couple seat section�� and ��Please type 2 for normal seat section��. If the user types 1, your program should assign one seat in the couple seat section (seats 1 �C 10). If the person types 2, your program should assign a seat in the normal seat (seats 11 �C 20). Your program should also prompt for the movie time and movie name.
Your program should then display:
I.     The person��s seat number
II.     Whether it is a couple seat or normal seat of the cinema
III.     Time, date, movie name
Your program should never assign a seat that has already been assigned. When the normal seat section is full, your program should ask the person if it is acceptable to be placed in the couple seat section (and vice versa). If yes, make the appropriate seat assignment. If no, print the message ��Next show is in 3 hours time.��
(it is just a small test on my OOM learning, I know it is not necessary to make it so complex.)

Break down your problem into discrete chunks. The more you practice this, the more your initial thoughts will resemble the eventual objects that you will create.
Let's take address a few of your issues:
What has the start time? Is it the ticket or the movie? (Hint: Would someone ever print you out a ticket with a different start time than the movie's?)
If ticket and movie share some attributes, then you can either use inheritance or composition/delegation. In this instance, what makes more sense to you? Is a ticket a movie or vice versa? Or is a ticket simply related to a movie?
If a given object can contain several instances of another object, you will want to use either an array or a collection, probably List in this instance.
Why is there no Theater object? A movie may play at multiple theaters. Each theater has a capacity (in terms of total seats and number already booked). This does not really have anything to do with the movie. It is the Theater that you are booking. It may also have which movies are showing at which time.
Your notion of 'couple' booking seems strange. Why not have a concept like 'consecutive seats required'? That way, your design is more flexible and you can still accomodate couples.That should get you started. Best of luck.
- Saish

Similar Messages

  • How to write this query to filter combination of few values

    Hi,
    I have a table CHIMM which is a transaction table and contains information of the vaccines given to a child.
    columns are: child_id, vacc_id, vacc_given_dt. I have to query for remaining vaccines.
    HEXA is a vaccine_id which is composite vaccine of DPT1,POL1,HBV1 & HIB1 (vaccine ids).
    I want to write to query if any of DPT1,POL1,HBV1 & HIB1 given then HEXA should not be displayed in the result.
    OR
    if HEXA is given then of course any of DPT1,POL1,HBV1 & HIB1 should not be displayed in the result.
    How to write this query?
    Regards

    Hi,
    I'm still not sure what the output you want from that sample data is. Do you just want the child_ids, like this
    CHILD_ID
           3
           4? If so, here's one way to get them:
    WITH     all_vacc_ids     AS
         SELECT     c.child_id
         ,     c.vacc_id          AS child_vacc_id
         ,     v.vacc_id
         ,     COUNT ( CASE
                             WHEN  c.vacc_id = 'HEXA'
                       THEN  1
                         END
                    )       OVER ( PARTITION BY  c.child_id
                                       )    AS hexa_itself
         FROM          vacc   v
         LEFT OUTER JOIN     chimm  c     PARTITION BY (c.child_id)
                          ON     c.vacc_id     = v.vacc_id
         WHERE   v.vacc_desc       = 'HEXA'     -- See note below
    SELECT       child_id
    FROM       all_vacc_ids
    WHERE       child_vacc_id     IS NULL
      AND       vacc_id     != 'HEXA'
      AND       hexa_itself     = 0
    GROUP BY  child_id
    rha2 wrote:there are alot of vaccines, i just put 3 for example. this query gives error: invalid relational operatorAre you saying that the vacc table contains other rows, but those other rows are not needed for this problem? It would be good if you included an example in the sample data. The query above considers only the rows in vacc where vacc_desc='HEXA'. You can have other rows in the vacc table, but they won't affect the output of this query. The query above makes no assumptions about the number of rows that have vacc_desc='HEXA'; it will report all child_ids who are missing any of them, regardless of the number (assuming the child does not have the 'HEXA' vacc_id itself, like child_id=1).
    You still haven't said which version of Oracle you're using. The query above will work in Oracle 10 (and higher).

  • How to write this query ?

    how to write this query ?
    list the emp name who is working for the highest avg sal department.
    I can use row_number over to get correct result. If we don't use this row_number function, just plain sql, how to do it ?
    the row_number version is like this
    select emp.* from emp ,
    select deptno, row_number() over (order by avg(sal) desc) r from emp
    group by deptno
    )e
    where e.r = 1
    and emp.deptno = e.deptno

    Hi,
    806540 wrote:
    how to write this query ?
    list the emp name who is working for the highest avg sal department.
    I can use row_number over to get correct result. If we don't use this row_number function, just plain sql, how to do it ?ROW_NUMBER is just plain SQL, and has been since Oracle 8.1.
    ROW_NUMBER (or its close relative, RANK) is the simplest and most efficient way to solve this problem. Why not do this the right way?
    the row_number version is like this
    select emp.* from emp ,
    select deptno, row_number() over (order by avg(sal) desc) r from emp
    group by deptno
    )e
    where e.r = 1
    and emp.deptno = e.deptno
    If there happens to be a tie (that is, two or more departments have the same average sal, and it is the highest), then the query above will only arbitrarily treat one of them (no telling which one) as the highest. Change ROW_NUMBER to RANK to get all departments with a claim to having the highest average sal.
    You could use the ROWNUM pseudo-column instead of ROW_NUMBER, if all you want to do is avoid ROW_NUMBER.
    Without using ROW_NUMBER or RANK, there are lots of ways involving other analytic functions, such as AVG and MAX.
    If you really, really don't want to use analytic functions at all, you can do this:
    SELECT     *
    FROM     scott.emp
    WHERE     deptno     IN  (
                      SELECT       deptno
                      FROM       scott.emp
                      GROUP BY  deptno
                      HAVING       AVG (sal) =  (
                                                       SELECT    MAX (AVG (sal))
                                               FROM          scott.emp
                                               GROUP BY  deptno
    ;

  • How to write this sql query in php code ?

    for example:
    insert into temp
    select *
    from testtable;
    after this, i will query data from sql below:
    select *
    from temp;
    how to write this php code ?
    who can help me ?
    thanks!

    Have a look at the manual to find out how to issue queries.
    http://us3.php.net/oci8

  • Which planning function i have to use and how to write this planning fucnti

    Hi Bi Guru's,
    I have rolled out  BW SEM-BPS Planning Layout's for the Annual Budget in my organistaion.
    There are two levels of layout given for the each sales person.
    1)  Sales quantity to be entered Material and  country wise for all 12 months ( April 2009 to March 2010)
    2)  Rate per unit and to entered in second sheet, Material and country wise for the total qty entered in the first layout.
    Now i need to calculate the sales vlaue for each period and for the each material.
    Which planning function i have to use and how to write this planning fucntion.
    Please suggest me some solution ASAP.
    Thanks in Advance,
    Nilesh

    Hi Deepti,
    Sorry to trouble you...
    I require your help for the following scenario for caluclating Sales Value.
    I have Plan data in the following format.
    Country   Material    Customer    Currency    Fiscyear    Fiscper           Qty         Rate        Sales Value
    AZ          M0001      CU001          #             2009          001.2009        100.00                        
    AZ          M0001      CU002          #             2009          001.2009        200.00                        
    BZ          M0001      CU003          #             2009          001.2009        300.00
    BZ          M0001      CU003          #             2009          002.2009        400.00
    BZ          M0002      CU003          #             2009          002.2009        300.00
    AZ          M0001       #               USD          2009             #                                 10.00
    BZ          M0001       #               USD          2009             #                                 15.50
    BZ          M0002       #               USD          2009             #                                 20.00
    In the Above data the Rate lines are entered in the Second Layout, Where the user enters on the Country Material Level with 2009 value for FISCYEAR.
    I am facing problem with this type of data. 
    I want to store the sales value for each Material Qty.
    Please suggest some solution.
    Re
    Nilesh

  • Hi, I've checked how to use kannada keyboard in Yosemite. But, there are some 'vattu forms' and other grammar in Kannada language that I don't know how to use it. For eg, Preetiya taatanige nimma muddu mommagalu maduva namaskara? How to write this?

    Hi, I've checked how to use Kannada keyboard in Yosemite. But, there are some 'vattu forms' and other grammar in Kannada language that I don't know how to use it. I know how to change between the keyboards and can also view keyboard. However, For eg, 'Preetiya taatanige nimma muddu mommagalu maduva namaskara' How to write this? If anybody can answer this, very much appreciated.
    Thanks in advance for your reply.

    In general, you need to use the "f" (kannada qwerty keyboard) or "d" key (kannada) between letters to make special forms.  Also you may need to adjust the typography settings of the font, which is done by doing Format > Font > Show Fonts > Gear Wheel > Typography as shown below.  If you can provide screenshots or more detailed info on things you cannot make, I can perhaps help.
    It is important to note that MS Word for Mac does not support Indic scripts -- any other app should work OK.

  • Really need help on how to write this program some 1 plz help me out here.

    i am new to java and i confused on how to be writing this program.
    i have completed the Part 1 but i am stuck on Part 2 & 3 so it would would be really great if any 1 could help me out on how to write the program.
    Part I
    An algorithm describes how a problem is solved in terms of the actions to be executed, and it specifies the order in which the actions should be executed. An algorithm must be detailed enough so that you can "walk" through the algorithm with test data. This means the algorithm must include all the necessary calculations.
    Here is an algorithm that calculates the cost of a rectangular window. The
    total cost of a window is based on two prices; the cost of the glass plus the cost of the metal frame around the glass. The glass is 50 cents per
    square inch (area) and the metal frame is 75 cents per inch (perimeter).
    The length and width of the window will be entered by the user. The
    output of the program should be the length and width (entered by the user)
    and the total cost of the window.
    FORMULAS:
    area = length times width perimeter = 2 times (length plus width)
    Here is the corresponding algorithm:
    read in the length of the window in inches
    read in the width of the window in inches
    compute the area
    compute the cost of the glass (area times 50 cents)
    compute the perimeter
    compute the cost of the frame (perimeter times 75 cents)
    compute the total cost of the window (cost of glass plus cost of frame)
    display the length, width and total cost
    The next step would be to "desk check" the algorithm. First you would need to make up the "test data". For this algorithm, the test data would involve making up a length and a width, and then calculating the cost of the window based on those values. The results are computing by hand or using a calculator. The results of your test data are always calculated before translating your algorithm into a programming language. Here is an example of the test data for the problem given:
    length = 10
    width = 20
    area = 200, glass cost= 100.00 (area times 50 cents)
    perimeter = 60, frame cost = 45.00 (perimeter times 75 cents)
    total cost =145.00
    Once the test data is chosen, you should "walk" through the algorithm using the test data to see if the algorithm produces the same answers that you obtained from your calculations.
    If the results are the same, then you would begin translating your algorithm into a programming language. If the results are not the same, then you would attempt to find out what part of the algorithm is incorrect and correct it. It is also
    necessary to re-check your hand calculations.
    Each time you revise your algorithm, you should walk through it with your test data again. You keep revising your algorithm until it produces the same answers as your test data.
    ?Now write and submit a Java program that will calculate the cost of a rectangular window according to the algorithm explained. Be sure to prompt for input and label your output.?
    Part II
    Write, compile and execute a Java program that displays the following prompts:
    Enter an integer.
    Enter a second integer
    Enter a third integer.
    Enter a fourth integer.
    After each prompt is displayed, your program should use the nextint method of the Scanner class to accept a number from the keyboard for the displayed
    prompt. After the fourth integer has been entered, your program should calculate and display the average of the four integers and the value of the first integer entered raised to the power of the second integer entered. The average and result of raising to a power should be included in an appropriate messages
    (labels).
    Sample Test Data:
    Set 1: 100 100 100 100
    Set 2: 100 0 100 0
    Be sure to write an algorithm first before attempting to write the Java code. Walk through your algorithm with test data to be sure it works as anticipated.
    Part III
    Repeat Part lI but only calculate the average, not the power. This time, make sure to use the same variable name, number, for each of the four numbers input. Also use the variable sum for the sum of the numbers. (Hint: To do this, you may use the statement sum = sum + number after each number is read.)
    For Part 1 this is what i got
    import java.util.Scanner;
    public class Window
         public static void main(String[] args)
              double length, width, glass_cost, perimeter, frame_cost, area, total;
              Scanner keyboard = new Scanner (System.in);
              System.out.println("Enter the length of the window in inches");
              length = keyboard.nextInt();
              System.out.println("Enter the width of the window in inches");
              width = keyboard.nextInt();
              area = length * width;
              glass_cost = area * .5;
              perimeter = 2 * (length + width);
              frame_cost = perimeter * .75;
              total = glass_cost + frame_cost;
                   System.out.println("The Length of the window is " + length + "inches");
                   System.out.println("The Width of the window is " + length + "inches");
                   System.out.println("The total cost of the window is $ " + total);
         Enter the length of the window in inches
         5
         Enter the width of the window in inches
         8
         The Length of the window is 5.0inches
         The Width of the window is 5.0inches
         The total cost of the window is $ 39.5
    Press any key to continue . . .
    Edited by: Adhi on Feb 24, 2008 10:33 AM

    Adhi wrote:
    i am new to java and i confused on how to be writing this program.
    i have completed the Part 1 but i am stuck on Part 2 & 3 so it would would be really great if any 1 could help me out on how to write the program.Looks like homework to me.
    What have you written so far? Post it.
    Part I
    An algorithm describes how a problem is solved in terms of the actions to be executed, and it specifies the order in which the actions should be executed. An algorithm must be detailed enough so that you can "walk" through the algorithm with test data. This means the algorithm must include all the necessary calculations.
    Here is an algorithm that calculates the cost of a rectangular window. The
    total cost of a window is based on two prices; the cost of the glass plus the cost of the metal frame around the glass. The glass is 50 cents per
    square inch (area) and the metal frame is 75 cents per inch (perimeter).
    The length and width of the window will be entered by the user. The
    output of the program should be the length and width (entered by the user)
    and the total cost of the window.
    FORMULAS:
    area = length times width perimeter = 2 times (length plus width)
    Here is the corresponding algorithm:
    read in the length of the window in inches
    read in the width of the window in inches
    compute the area
    compute the cost of the glass (area times 50 cents)
    compute the perimeter
    compute the cost of the frame (perimeter times 75 cents)
    compute the total cost of the window (cost of glass plus cost of frame)
    display the length, width and total cost
    The next step would be to "desk check" the algorithm. First you would need to make up the "test data". For this algorithm, the test data would involve making up a length and a width, and then calculating the cost of the window based on those values. The results are computing by hand or using a calculator. The results of your test data are always calculated before translating your algorithm into a programming language. Here is an example of the test data for the problem given:
    length = 10
    width = 20
    area = 200, glass cost= 100.00 (area times 50 cents)
    perimeter = 60, frame cost = 45.00 (perimeter times 75 cents)
    total cost =145.00
    Once the test data is chosen, you should "walk" through the algorithm using the test data to see if the algorithm produces the same answers that you obtained from your calculations.
    If the results are the same, then you would begin translating your algorithm into a programming language. If the results are not the same, then you would attempt to find out what part of the algorithm is incorrect and correct it. It is also
    necessary to re-check your hand calculations.
    Each time you revise your algorithm, you should walk through it with your test data again. You keep revising your algorithm until it produces the same answers as your test data.
    &#147;Now write and submit a Java program that will calculate the cost of a rectangular window according to the algorithm explained. Be sure to prompt for input and label your output.&#148;
    Part II
    Write, compile and execute a Java program that displays the following prompts:
    Enter an integer.
    Enter a second integer
    Enter a third integer.
    Enter a fourth integer.
    After each prompt is displayed, your program should use the nextint method of the Scanner class to accept a number from the keyboard for the displayed
    prompt. After the fourth integer has been entered, your program should calculate and display the average of the four integers and the value of the first integer entered raised to the power of the second integer entered. The average and result of raising to a power should be included in an appropriate messages
    (labels).
    Sample Test Data:
    Set 1: 100 100 100 100
    Set 2: 100 0 100 0
    Be sure to write an algorithm first before attempting to write the Java code. Walk through your algorithm with test data to be sure it works as anticipated.So this is where you actually have to do something. My guess is that you've done nothing so far.
    Part III
    Repeat Part lI but only calculate the average, not the power. This time, make sure to use the same variable name, number, for each of the four numbers input. Also use the variable sum for the sum of the numbers. (Hint: To do this, you may use the statement sum = sum + number after each number is read.)Man, this specification writes itself. Sit down and start coding.
    One bit of advice: Nobody here takes kindly to lazy, stupid students who are just trying to con somebody into doing their homework for them. If that's you, better have your asbestos underpants on.
    %

  • How to write this java code in jsp using jstl  tags?

    Can anybody help me on this?
    I dont know how to check the containsKey using jstl tags?
    <%
         LinkedHashMap yearMap     =     (LinkedHashMap)request.getAttribute("yearMap");
         TreeSet nocSet               =     (TreeSet)request.getAttribute("nocSet");
         Iterator     yearMapIt     =     yearMap.keySet().iterator();
         while(yearMapIt.hasNext())
              int yearValue               =     (Integer)yearMapIt.next();
    %>
    <tr>
              <td><%=yearValue%></td>
    <%
              LinkedHashMap monthMap     =     (LinkedHashMap)yearMap.get(yearValue);
              Iterator     nocSetIt     =     nocSet.iterator();
              while(nocSetIt.hasNext())
                   String nCase=(String)nocSetIt.next();
                   if(monthMap.containsKey(nCase))
                        String count     =     (String)monthMap.get(nCase);
    %>
                        <td> <%= count %> </td>
    <%            }
                   else
    %>          
                        <td> 0 </td>     
    <%          
    %>
    </tr>
    <% } %>Edited by: avn_venki on Feb 18, 2008 11:54 PM

    <c:forEach var="yearMap" items="${requestScope.yearMap}">
         <th> <c:out value="${yearMap.key}"/> </th>
    <bean:define id="monthMap" value="${yearMap.value}"/>
    <c:forEach var="nocSet" items="${nocSet}">
    then how to write containsKey using tags??

  • How to write this sql code ?

    for example below shows:
    create table temp
    order_type varchar2(30),
    order_num number);
    insert into temp values('apple',000001);
    insert into temp values('banana',000002);
    insert into temp values('chair',000003);
    select *
    from temp
    where instr(order_type,decode(x,1,'a',2,'b',2,'c',order_type)) >0
    if i let x equals 2 and i want to get b and c from above querying .
    why above query could not get 'c' and only get 'b' if i give 2 to x ?
    how to write above select clause ?
    who can help me ?
    thanks!

    Decode will return the first match;
    SQL> select decode(2,1,'a',2,'b',2,'c')
    from dual
    D
    b
    1 row selected.This may help;
    old: select *
    from temp
    where regexp_like(order_type, case to_number(&x)
                                     when 1 then 'a'
                                     when 2 then 'b|c'
                                  end)
    new: select *
    from temp
    where regexp_like(order_type, case to_number(2)
                                     when 1 then 'a'
                                     when 2 then 'b|c'
                                  end)
    ORDER_TYPE                      ORDER_NUM
    banana                                  2
    chair                                   3
    2 rows selected.

  • How to write this code ?

    I need to write 3 classes that each one can get to the other with the same instance of the class , so how do i write this code ?
    thanks a lot

    try out singleton pattern with all the three classes. following link may help...
    http://www.javareference.com/jrexamples/viewexample.jsp?id=25

  • How to write this formulas without error in Business Objects..

    1:  '=substr([D Bank File Warrant Status];2;1)
    2: '= If [Chk Recon Check/EFT Amt] = '0' and ([Chk Recon Status Detail] = "Paid" and [Bank File Warrant Status Displayed]= 'V') then "No" else "Yes"
    what is this 'v', here it gvn as void, bt i dont know how to write it in formula....
    3: '=IF [Bank File Status Detail] inlist ('0V'; '0S') and [Chk Recon Check/EFT Amt] does not exist (is null) then 'Yes' else 'No'
    4: '= IF [Chk Recon Status Detail] inlist ("Cancelled" or "Void" and [Bank File Warrant Amount] does not exist (is null) then 'Yes' else 'No'
    plz let me know how to write them in formula asap... Thank u in advance..

    Plese post your query to the [WEBI|SAP BusinessObjects Web Intelligence; forum then.
    And don't forget to close this thread.
    - Ludek

  • HT1420 My laptop crashed and I have authorized another laptop. I want to deauthorize the "crashed" computer but it is no longer working. All I can find is how to deauthorize "this" computer. Any way I can do that?

    I need to deauthorize a crashed laptop that is no longer usable. I can only find how to deauthorize "this" computer. Can anyone help?

    You need to use the Deauthorize All function. Remote individual deauthorization of a crashed computer isn't possible, and remote deauthorization of a working computer requires VNC access to it.
    (66408)

  • How To Write This Complex Query

    hi all
    i have following tables
    1. employees
    2. departments
    3. vaccination_type
    4. vaccination_subtype
    5. vaccination_given
    a vaccination suppose 'FLU' is to be given to an employee or an department(all employees of this department)
    EXAMPLE:
    vaccination type is "FLU", vaccination subtypes are "FLU1" and "FLU2"
    vaccination type is "CHIC", vaccination subtypes are "CHIC1" and "CHIC2"
    employee # 4444 dept# 40 assigned "FLU"
    dept 50 assigned "CHIC"
    employee 4444 has given only one dose means "FLU1" >>> it means defaulters
    employee 5555 of dept 50 have given all 2 doses >>>>>> it means 9 emps are defaulters (total emps are 10 in dept 50)
    i need to write a query to identify those employees who are defaulters
    means not a single vaccination given or 1 of 3, or 2 of 3 etc
    query should return 9 employees of dept 50 and employee 4444
    hope you understand my problem.
    Regards,

    How about this one :
    select empno,a.vactype,count(vacstype) From vaccination_given a
    group by empno,a.vactype
    having count(vacstype) < (select count(*) from vaccination_subtype where vactype = a.vactype)
    EMPNO     VACTYPE     COUNT(VACSTYPE)
    5553     CHIC     1
    5554     CHIC     1
    5560     CHIC     1
    5551     CHIC     1
    5559     CHIC     1
    5558     CHIC     1
    4444     FLU     1
    5552     CHIC     1
    5556     CHIC     1
    5557     CHIC     1

  • How to write this SQL query

    We have a table, the structure as below: (I put a blank row in the middle to make it clear)
    Product_ID     Retailer     Retail_Price
    1001          A          1.2
    1001          B          1.5
    1001          C          1.4
    1002          B          2.0
    1002          C          2.1
    1002          E          1.8
    1002          F          2.0
    1003          A          1.7
    1003          C          1.5
    Basically we use the table to compare the retail price for different retailers in terms of different products. My customer asked me to give a report based on above table but only shows the retail prices which contain retailer A.
    For example, on above table I need to give a report like below:
    Product_ID     Retailer     Retail_Price
    1001          A          1.2
    1001          B          1.5
    1001          C          1.4
    1003          A          1.7
    1003          C          1.5
    Can anybody give some ideas on how I should write a SQL to achieve this.
    Many thanks!

    SQL> create table product(
    2 Product_ID varchar2(10),
    3 Retailer varchar2(10),
    4 Retail_Price number(7,2)
    5 )
    6 /
    Table created.
    SQL> insert into product values('1001','A',1.2)
    2 /
    1 row created.
    SQL> insert into product values('1001','B',1.5)
    2 /
    1 row created.
    SQL> insert into product values('1001','C',1.4)
    2 /
    1 row created.
    SQL> insert into product values('1002','B',2.0)
    2 /
    1 row created.
    SQL> insert into product values('1002','C',2.1)
    2 /
    1 row created.
    SQL> insert into product values('1002','E',1.8)
    2 /
    1 row created.
    SQL> insert into product values('1002','F',2.0)
    2 /
    1 row created.
    SQL> insert into product values('1003','A',1.7)
    2 /
    1 row created.
    SQL> insert into product values('1003','C',1.5)
    2 /
    1 row created.
    SQL> select * from product
    2 /
    PRODUCT_ID RETAILER RETAIL_PRICE
    1001 A 1.2
    1001 B 1.5
    1001 C 1.4
    1002 B 2
    1002 C 2.1
    1002 E 1.8
    1002 F 2
    1003 A 1.7
    1003 C 1.5
    9 rows selected.
    SQL> select * from product where PRODUCT_ID in (
    2 select distinct PRODUCT_ID from product where RETAILER='A')
    3 /
    PRODUCT_ID RETAILER RETAIL_PRICE
    1001 A 1.2
    1001 B 1.5
    1001 C 1.4
    1003 A 1.7
    1003 C 1.5

  • How to write this logic  in EL expression ? (new line characters in string

    iam using JSTL EL expression in my JSP.
    iam printing a string in JSP as ${vobject.rmessage} where rmessage is a string .
    problem is i want to identify the newline characters in the above rmessage string and print the line break <br> in html where ever the new lines character is present in the string.
    How should i write an EL expression for the above.
    Can anyone please guide me on writing EL expression for the above problem?

    Several ways. You can wrap the output with <pre> tags. You can apply CSS property white-space: pre; to the element. You can use String#replaceAll() in the Java code to replace each occurence of "\r\n" by "<br>".

Maybe you are looking for