Homework Question...

I'm having problem with my do while loop in a self constructed method. When I attempt to use a != for the test it just reruns the loop.
Written like this the loop just continues :
public static char displaymenu()
     char y, ch;
     String x;
     Scanner kb = new Scanner(System.in);
do {
     System.out.println("Please select one of the following: ");
     System.out.println("F - to convert Fahrenheit to Celsius ");
     System.out.println("C - to convert Celsisu to Fahrenheit ");
     System.out.println("Q - to Quit. ");
     System.out.print("Choice: ");
x =kb.next();
ch = x.charAt(0);
y = Character.toUpperCase(ch);
} while ( y !='Q'|| y!='F'|| y!='C');
return y;
Written like this the loop works:
public static char displaymenu()
     char y, ch;
     String x;
     Scanner kb = new Scanner(System.in);
do {
     System.out.println("Please select one of the following: ");
     System.out.println("F - to convert Fahrenheit to Celsius ");
     System.out.println("C - to convert Celsisu to Fahrenheit ");
     System.out.println("Q - to Quit. ");
     System.out.print("Choice: ");
x =kb.next();
ch = x.charAt(0);
y = Character.toUpperCase(ch);
} while ( y =='A'|| y=='B'|| =='D'); //etc.
return y;
What is the problem with my code?

What is the problem with my code?Looking at the first code example you give:do {
   /* prompting - looking for Q F or C */
} while ( y !='Q'|| y!='F'|| y!='C');Suppose I enter an 'X'. Then y!='Q' will be true and the loop will continue (good).
Next suppose I enter an 'F'. Then y!='Q' will be true and the loop will still continue (bad).
The problem here is your use of || (or). In fact you mean && (and). That way all parts of the condition have to be true in order for the loop to continue. do {
   /* prompting - looking for Q F or C */
} while ( y !='Q'&& y!='F'&& y!='C');Now when I enter an 'X': y!='Q' is true, y!='F' is true, y!='C' is true. All true so the loop continues.
When I enter an 'F': y!='Q' is true, y!='F' is false, y!='C' is true. They are not all true so the loop does not continue.
[Edit] Slow...

Similar Messages

  • Using custom tags - not a "how to do my homework" question.

    Hi, I havn't done a heap of JSP and I'm experimenting with custom tags. I understand this may be elementary to some. I also expect there is probably some ready-to-go libary out there that would do this for me, I just wanted to do it from scratch, mostly as a learning exercise.
    So I've got a servlet which runs a query, and sends two arrays of objects to a JSP, one is an array of column headings, the other is an array of arrays representing the rows of data.
    The intention of the JSP is simply to display the data in a table.
    I guess one question I have is:
    What is the best way to apply styles to my table? Obviously I don't want to have to recompile the tag code to add/change styles. Is the best way to do it is to have another property of the tag that accepts the name of a style class?
    So when I place the tag in my JSP it will looks like <test:report-table headings="..." rows="..." style="blue"/> and in the tag code it will look something like out.write("<table class=\" + classname + \"");I appreciate any comments on how good/bad my code/theory is. Any recomended additions/omissions?
    The tag in the JSP looks like this.
            <test:report-table
                headings="<%= (Object[])request.getAttribute(\"columns\")%>"
                rows="<%= (Object[])request.getAttribute(\"rows\")%>"
            />The tag class looks like this.
    bar.foo.test;
    import java.io.IOException;
    import javax.servlet.jsp.JspWriter;
    import javax.servlet.jsp.tagext.TagSupport;
    public class ReportTable extends TagSupport
        private Object[] headings;
        public Object[] getHeadings() { return headings; }
        public void setHeadings(Object[] o) { this.headings = o; }
        private Object[] rows;
        public Object[] getRows() { return rows; }
        public void setRows(Object[] o) { this.rows = o; }
        public int doStartTag()
            JspWriter out = pageContext.getOut();
            try
                out.write("<table>");
                out.write("<tr>");
                for (int i = 0; i < headings.length; i++ )
                    out.write("<td>" + headings[i] + "</td>");
                out.write("</tr>");
                for (int i = 0; i < rows.length; i++)
                    out.write("<tr>");
                    Object[] row = (Object[])rows;
    for (int j = 0; j < row.length; j++)
    out.write("<td>" + row[j] + "</td>");
    out.write("</tr>");
    out.write("</table>");
    catch (IOException e)
    e.printStackTrace();
    return 0;
    The tag definition in my tld looks like this
        <tag>
            <name>report-table</name>
            <tagclass>bar.foo.ReportTable</tagclass>
            <bodycontent>empty</bodycontent>
            <info> Report Table </info>
            <attribute>
                <name>headings</name>
                <required>true</required>
                <rtexprvalue>true</rtexprvalue>
                <type>java.util.Object[]</type>
            </attribute>
            <attribute>
                <name>rows</name>
                <required>true</required>
                <rtexprvalue>true</rtexprvalue>
                <type>java.util.Object[]</type>
            </attribute>
        </tag>

    TimSparq wrote:
    Cool, thanks for the input/advice, evanfets.
    Yeah, my plan was now that I have a basic understanding of the mechanics of what's going on in the tags, I'll go and look into what ready-made stuff there is out there (like you suggest, JSTL).
    And thanks for the advice regarding styles, exceptions and the return value. All appreciated.
    I'll be taking a look into the tag files too.
    Thanks again.Just another option on the styles. One thing I have done in similar situations is to generate a lot of class names and automatically apply them to the correct spot. Example:
    <table class="reportTable">
      <thead class="reportTableHead">
        <tr class="rtHeadRow"><th class="rtOddColumn">...</th><th class="rtEvenColumn">...</th></tr>
      <thead>
      <tbody class="reportTableBody">
        <tr class="rtOddRow"><td class="rtOddColumn">...</td><td class="rtEvenColumn">...</td></tr>
        <tr class="rtEvenRow"><td class="rtOddColumn">...</td><td class="rtEvenColumn">...</td></tr>
      </tbody>
    </table>This gives the web developer a large selection of selectors to work on:
    table.reportTable -> Edit the entire table
    table.reportTable tr -> Configure all rows in the table
    table.reportTable tr.rtOddRow -> Configure the odd rows in the table
    table.reportTable tr.rtOddRow td.rtEvenColumn -> Configure just the even columns in an odd row
    etc...
    You just communicate the class names that can be used and then the web designer generates a CSS to fit his needs.

  • PL/ SQL homework question.

    I turn here because I have a bad teacher and I don't want to drop her course but I need help with trying to get a procedure to work. Be patient I will post the assignment first. Then I will post the code I created and the subsequent error that I get. Your help would be greatly appreciated. WARNING: It will be a long post.
    Assignment:
    The company wants to offer an incentive of free shipping to those customers who have not returned for two months. Create a procedure named PROMO_SHIP_SP that determines who these customers are and then updates the BB_PROMOLIST table accordingly. The procedure uses the following information:
    1. Date cutoff = Any customers who have not shopped on the site since this date should be included as incentive participants. use the basket created date to reflect shopper activity dates.
    2.) Month = Three-Character month (Such as APR) that should be added to the promotion table to indicate which month the free shipping is available.
    3.) Year = Four digit year indicating the year the promotion is effective.
    4.) PROMO_FLAG = 1 (representing free shipping).
    The BB_PROMOLIST table also has a USED column, which contains a default value of 'N' and is updated to a 'Y' when the shopper uses the promotion. Test the procedure with a cutoff date of 15-FEB-03. Assign the free shipping for the month of APR and the year 2003.
    Here is what I wrote based on the instructions:
    create or replace procedure promo_ship1_sp
    (--p_day in DATE,
    p_mth in DATE,
    p_yr in DATE)
    IS
    CURSOR cur_ship IS
    SELECT idshopper, MAX(dtcreated) dt
    from bb_basket
    WHERE dtcreated < '15-FEB-03' -- AND
    -- TO_CHAR(dtCreated, 'DD') = p_day
    AND TO_CHAR(dtCreated, 'MON') = p_mth
    AND TO_CHAR(dtcreated, 'YY') = p_yr
    and orderplaced = 1
    group by dtcreated;
    promo_flag number; --(1);
    v_cutoff DATE;
    BEGIN
    FOR rec_ship in cur_ship LOOP
    IF rec_ship.dt < v_cutoff then
    promo_flag := 1;
    --END IF;
    v_cutoff := to_char('15-FEB-03');
    ELSIF rec_ship.dt > v_cutoff then
    DBMS_OUTPUT.PUT_LINE('Dont qualify for shipping.');
    END IF;
    DBMS_OUTPUT.PUT_LINE(rec_ship.idshopper||' cart creation = '|| rec_ship.dt ||'
    flag status = '|| promo_flag);
    /* IF promo_flag IS NOT NULL THEN
    insert into bb_promolist
    VALUES (rec_ship.idshopper, p_mth, p_year, promo_flag, 'Y', 'APR-03');
    -- END IF;
    promo_flag := NULL; */
    END LOOP;
    --commit;
    END;
    ERROR I get from execution:
    Procedure created.
    SQL> execute promo_ship1_sp('FEB', '03');
    BEGIN promo_ship1_sp('FEB', '03'); END;
    ERROR at line 1:
    ORA-01858: a non-numeric character was found where a numeric was expected
    ORA-06512: at line 1
    SQL> execute promo_ship1_sp('03', 'FEB');
    BEGIN promo_ship1_sp('03', 'FEB'); END;
    ERROR at line 1:
    ORA-01840: input value not long enough for date format
    ORA-06512: at line 1
    SQL> execute promo_ship1_sp('2003', 'FEB');
    BEGIN promo_ship1_sp('2003', 'FEB'); END;
    ERROR at line 1:
    ORA-01861: literal does not match format string
    ORA-06512: at line 1

    The best advice we can give you is to do the simplest thing that could work. Quite often that is the best solution. One trap beginners often fall into is overcomplicating things. As it stands, the requirements you have been given can be met by a simple SQL INSERT statement driving off a subquery on the basket table.
    I will post a solution: it's up to you to decide whether you want to look at it or figure it out for yourself ;)
    This code has not been tested as you haven't given us the structure of the underlying tables, so you may need to debug it.
    Cheers, APC
    #    solution -------+
    #                    |                
    #                    |  
    #                    |  
    #                    |  
    #                   \|/  
    create or replace procedure promo_ship_sp
         (p_cutoff in DATE
           , p_mth in varchar2
           , p_yr in varchar2
           , p_promo_flag number: =1)
    is
    begin
         insert into bb_promolist
         select distinct idshopper
              , p_mth
              , p_year
              , p_promo_flag
              , 'N'
         from bb_basket
         where dtcreated <= p_cutoff
         and orderplaced = 1;
    end promo_ship_sp;     
    /

  • Help Please homework question lost :S

    I am very lost on how to do this. ive attempted it for a long time period and i stil cant get it. This is what i have to do.
    This does not require an array! An elastic rope starts out with length 100 meters. The start of the rope is fixed to a pole and a worm is placed on the rope at the start and the worm starts crawling towards the end. Each day the worm crawls 6 meters along the rope. Each day the rope is stretched by 100 meters. After how many days does the worm reach the end of the rope?
    Sample Output
    Day = 0 Million. Distance from end = 0 Million meters.
    Day = 1 Million. Distance from end = 19 Million meters.
    Day = 2 Million. Distance from end = 30 Million meters.
    Day = 3 Million. Distance from end = 39 Million meters.
    Day = 4 Million. Distance from end = 45 Million meters.
    Day = 5 Million. Distance from end = 49 Million meters.
    SO far i have
    import java.util.Scanner;
    public class WormProblem
         public static int DISTANCEPERDAY = 6;
        public static void main(String[] args)
       Scanner keyboard = new Scanner(System.in);
            int countOne = 0;
           int count = 0;
        int ropeLength = 100;
        int distanceFromStart = 0;
        int distanceFromEnd = 0;
        while (distanceFromEnd >= 0)
             distanceFromEnd = ropeLength - distanceFromStart;
             distanceFromStart =+ DISTANCEPERDAY;
             ropeLength = ropeLength + 100;
             count++;
             if(count==1000000)
                  System.out.println("Day ="+countOne+" million"+" Distance from end: "+distanceFromEnd+" Million Meters");
                  countOne++;
    }It just doesnt print properly at all. PLEASE someone help

    Double posting twatface!
    http://forum.java.sun.com/thread.jspa?threadID=783814&tstart=0
    NO HELP FOR YOU!

  • Quick Homework Question (Moving a ball)

    I took a course in C and now im into java. I never created any graphics in C. I need to finish a java applet that makes a red ball appear in the center of a blue background and then move down and up the screen.
    Any information of how to make it move would help...
    This is what I have so far:
    //This applet draws an animated bouncing ball with uniform speed.
    //The ball starts at the center of the graphics page and bounces off
    //the top and bottom
    import java.awt.*;
    import java.applet.Applet;
    public class BouncingBall extends Applet {
        //Dimensions of Applet:
        public final int width = 500;
        public final int height = 500;
        //Size and speed of ball:
        public final int diameter = 20;
        public final int speed = 5;
        //Milliseconds to pause between frames:
        public final int pause = 20;
        public void paint (Graphics page) {
            setBackground(Color.blue);
            page.fillOval(250 - diameter/2, 250 + diameter/2, diameter, diameter);
            page.setColor(Color.red);
            //Loop forever;
            while (true) {
                //if (x_pos > 500- diamter/2)
                //Pause between frames:
                try { Thread.sleep(pause) ; } catch (Exception e) { };
    //End-of-FileThanks

    I just can't get the ball to move now. Can anyone find what I am doing wrong?
    //This applet draws an animated bouncing ball with uniform speed.
    //The ball starts at the center of the graphics page and bounces off
    //the top and bottom
    //Known Problems:
    // - None
    import java.awt.*;
    import java.applet.Applet;
    public class BouncingBall extends Applet {
        //Dimensions of Applet:
        public final int width = 500;
        public final int height = 500;
        //Size and speed of ball:
        public final int diameter = 20;
        public final int speed = 5;
        //Milliseconds to pause between frames:
        public final int pause = 20;
        int y = 250;
        public void paint (Graphics page) {
            page.setColor(Color.blue);
            page.fillRect(0,0,500,500);
            page.setColor(Color.red);
            page.fillOval(250 - 10, y - 10, 20, 20);
            //Loop forever;
        public void run()
            while (true) {
                if (y<=450){
                    y--;
                    repaint();
                    return;
                else if (y>=10){
                    y++;
                    repaint();
                    return;
                //Pause between frames:
                try { Thread.sleep(pause) ; } catch (Exception e) { };
    }Thanks again

  • Quick homework question.....

    If anyone can help me out with this I would greatly appreciate it. Its just a basic program that where I enter an integer and tell whether or not its even or odd.
    import java.io.*;
    class binary
         public static void main(String args []) throws IOException
              int a;
              //Entering Values
              BufferedReader inData = new BufferedReader (new InputStreamReader (System.in));
              System.out.print("Enter a integer: ");
              String temp = inData.readLine ();
              a = Integer.parseInt (temp);
         b = (int a % 2);
         if (b == 0)
              System.out.println("Int is even");
         if (b != 0)
              System.out.println("Int is odd");
         }

    Considering your cookie comment, I have to disagree.Look more closely.
    Warnerja asked for confirmation that the OP wasn't looking for someone to "cut-n-paste it and figure out where all your problems are." That's perfectly reasonable, given the number of posts here that are looking for just that and the fact that the OP doesn't seem to be widely known here.
    He then suggested that if the OP was in fact looking for said spoonfeeding and cheating assistance, he could have a cookie.
    That was a sarcastic comment, but warnerja wasn't a jerk to make it, since it was predicated on the OP being a lazy cheater. He didn't say or imply that the OP was one, merely that if he was one, he could have the cookie.
    So the cookie comment only applies of the OP is a jerk. Being sarcastic to someone who's a jerk doesn't make the sarcastor a jerk, since the sarcasm was well and truly earned. And if the OP wasn't looking to cheat (which it appears he wasn't) then the comment doesn't apply to him, so, again, warnerja isn't being a jerk.
    Then I suggested that "cookie" might be a metaphor for "kick in the nuts." Again, the cookie/kick would only be delivered if the OP was looking to cheat, in which case a kick in the nuts is just desserts, not jerkitude.
    QED

  • Beginner Java questions

    Hello:
    I'm looking for some guidance on a few things I am confused on. Can somebody tell me or point me in the right direction on how you would write and equivalent compound statement for
    x = 2 * x;
    sum = sum + num;
    y = y / (x +5);
    lastly
    What type of input would I use for :
    import java.util.*;
    public class Strange
    static Scanner console = new Scanner (System.in);
    public static void main (String[ ] arg)
    int x;
    int y;
    String name:
    x = console.nextInt ();
    name = console.nextLine ();
    y = console.nextInt ();
    I appreciate any guidance and help provided on this. I'm struggling to wrap my head around some of these things.

    eaolson wrote:
    BigDaddyLoveHandles wrote:
    This is obviously a homework question. Please don't expect anyone here to do your homework for you.Well, if you notice, he's asking for "guidance" and for people to "point him in the right direction". He's not stating a problem and demanding a solution like so many others. If you ask me, he's asking for help with homework in exactly the right way.
    For the first question, I would suggest reviewing this section and the following ones of the Java Tutorials:
    http://java.sun.com/docs/books/tutorial/java/nutsandbolts/operators.html
    http://java.sun.com/docs/books/tutorial/java/nutsandbolts/op1.html
    I don't understand what the second question is asking for.In reply #2 the OP tried to clarify the second question:
    Well, I'm tasked wtith stating "what type of input the progragms requires and in what order the input must be provided" for the program I stated. >Beyond that, I'm not sure either and that's why I'm looking for help. "Looking for help", eh?

  • How about a forum named - please do my homework?

    Chill out u lot, just a suggestion. It does seem that a fair few postings are exactly this, but what harm does it do? if they can't do it because they dont try, then who cares? they will never make it anyway, and if they genuinly have tried and are then given the answer, they will learn from it. So why not? I am sure a lot of ego's are fed by answering these q's.
    Discuss...in no more than 2000 words.

    There are a lot of people who spend a lot of time providing legitimate help to people asking legitimate questions. It's fairly annoying to see "do my homework" posts again and again.
    Please understand, I think most of these are not people who really expect others to do their homework, but rather they are unaccustomed to this kind of forum, and haven't really figured out that they should try it first, then post specific questions when they hit a wall. However, at first glance, it's hard to separate those from the genuinely lazy SOBs, and after a while, the annoyance factor just builds.
    As for the harm it does, if we get in the habit of posting shrink-wrapped solutions to homework problems, it encourages more of that kind of question. This pollutes the forum and takes away from legitimate discussions.
    Also, it sends an inappropriate message to the people asking the questions. These are probably young people for the most part, and if they get in the habit of having others do their work, they will come to expect that, and will not realize their full potential as members of society. I know, I know, that's extrapolating a lot from "How do I count character occurences," but big things are made up of small things--if anybody should know that it's people that provide answers here. We are one of many influences on these people's attitudes. Shouldn't we be a positive influence?
    If they can't do it because they don't try, then who
    cares?I care. If somebody hasn't tried, I feel a responsibility to encourage them to try. If they won't, I'm not going to waste my time "helping" them (which is no help at all), and I would encourage others not to. "Who cares" is not a particularly responsible attitude.
    Having said all that, I think it's worth giving people the benefit of the doubt. When someone posts a "please do my homework" question, rather than flame them, a better approach (and the one that's usually taken, from what I've seen) is to gently point out to them why their question is inappropriate, and suggest that they try it themselves, then ask more specific questions. Assume the person is willing to try if given a little nudge in the right direction. If, after a couple of hints, they persist with, "just do it for me," then ignore them. There are enough other people with better attitudes that we can help that there's no point in wasting time on someone who genuinely doesn't want to learn.
    Oh, and definitely filter out the word URGENT and anything with more than one exclamation point.

  • Fundamental questions in Java, please help to answer.

    I am a beginner of a Java Programming. Although I had few programming experiences on Java. But there are few conceptal questions. Hope every experts can help to explain more to me.
    1. How <b>Encapsulation</b> works in Java? Why is it needed? What benefits can be given from encapsulation? Can give some examples for me to know more?
    2. How <b>Overloading</b> works in Java? Why is it needed? What benefits can be given from it in the extensibility of programs? Can give some examples for me to know more?
    3. How <b>inheritance</b> works in Java? What benefits can be given from inheritance? Can give further explanation, such as class hierarchy for me to know more?
    4. What is <i>object class</i> and <i>object distances</i> ? What is their differences?
    5. What is <b>Reusability</b>? What benefits can it gives? Why it is needed? Can give me further examples?
    Thanks for help very much

    Maybe I'm not getting this, but you want one of us to give you a nice short answer convenient enough for you to copy down, right? Well, there aren't many people here that are willing to do that. There are many people who won't even bother answering homework questions. I don't mind, but you need to show us some work you've done, like the previous poster said. The effort has to come from you, not us. If you are learning Java, you must put some effort into it.
    How can you get an answer out of us?
    Example: I understand that inheritance is ..............., but I'm not sure about this part.............. Can anyone provide some clarification please?
    Anyway, this question has been crossposted on at least 5 forums already, which I'm sure is one of the reasons people aren't bothering with this question. Please DO NOT CROSSPOST, it's considered poor forum etiquette.
    Please don't take anything that I said negatively, but you have to understand that we are taking our time to respond to your queries, and asking us to provide short answers without doing any work on your part, and crossposting is not going to get you answers out of us.
    Cheers

  • About posting homework.

    Unfortunately I see the trend of posting homework to the forum hasnt let up much. Trust us, the professionals here know the difference between a legit question and a homework question. I know that homework can sometimes be difficult but here are my suggestions.
    1) Instead of posting "can anyone tell me how to do ... " try to come up with an idea first. Try something out and then ask "what have I done wrong." In this manner you will actually learn something.
    2) Try to ask specific questions.
    3) Use code tags in your post so we can read it. Simply surround your code like so:
    public class MyCode {
    // ... stuff
    In the end, if you post a homework question, someone who is bored will likely answer the question. However this wont earn you anything. If we do it for you, you are no better off then when you started. Instead, if you have a question on your homework, give it a shot first and then ask us specific questions so we can help you. This is far better for you and for us.

    Yea..but the more crappy programmers out there...the
    better we look. lol...=)Once one of those guys are in a position they just
    stay there--forever, but the tragic part about it is,
    that a good programmer would move out into a better
    postition and then free up the entry level one for
    another to enter the industry with.
    And an even more tragic part is that he might not be able to find that new position thanx to the bush economy and end up losing his entry level job to a more experienced programmer or even worse by the time he comes back the job might well have been exported to Timbak Tu.

  • Help with using 'extend' while creating a class between two other classes

    I have an assignment, basically to take a Date class and make it so it can output the date to a String, so if it was 4/2006, it would do April 2006.
    Now my question is, where and when do I put super? I can post what I have and I can post the two programs that are given to us.
    http://faculty.stcc.edu/silvestri/csci401/CourseArea/supplements/Date.java
    is the Date class
    http://faculty.stcc.edu/silvestri/csci401/CourseArea/solutions/ExtDateDriver.java
    Is the class test used to run we have to create. Thanks for your time.

    Awesome, should have just read a couple of threads to see that all of you guys are ass holes, by the way dip shit, instead of being a lazy fuck you are, why don't you fucking try and read the question I'm asking, the homework question, and try to answer my fucking question,
    I have already started the class for it, and I don't need your fucking retarded statments in MY thread, so just either help, or shut you little 4 year old mouth up.

  • Need Help With Basics of SQL

    Hey I'm trying to get a working understanding of some of the basics behind SQL, I've composed a few questions that I think may help me with this. Anyone that can help me with any of them will greatly help me thanks.
    1. How to create synonym for tables?
    2. How to describe the structure of tables?
    3. How to list the contents of tables?
    4. How to create a table named with the same structure as another table?
    5. How to copy rows with less than a certain criteria in value (e.g. Price<$5.00) into another table?
    6. How to change the data type to e.g. NUMBER(6)?
    7. How to add a new column named with data type e.g. VARCHAR2(10)?
    8. How to change a specific field within a table (e.g. For ORDER_NUMBER 12489, change the C_NUMBER to 315)?
    9. How to delete a specific row from a table?
    10. How to declare a column as the primary key of a table and call it e.g. PK_something?
    11. How to show certain columns when another column is less than a certain criteria in value (e.g. Price<$5.00)?
    12. How to show certain columns with another column having a certain item class e.g. HW or AP?
    13. How to list certain columns when another column e.g. price is between two values?
    14. How to list certain columns when another column e.g. price is negative?
    15. How to use the IN operator to find certain columns (e.g. first and last name of customers who are serviced by a certain ID)
    16. How to find certain columns when one of the columns begins with a particular letter (e.g. A)
    18. How to list the contents of the a table sorted in ascending order of item class and, within each item class, sorted in descending order of e.g. price?
    19. How to do a count of column in a table?
    20. How to sum a column and make rename is something?
    21. How to do a count of a column in a table (without repeats e.g. if a certain number repeats more than once than to only count it once)?
    22. How to use a subquery to find certain fields in columns when the another column’s fields values are greater than e.g. its average price?

    848290 wrote:
    Hey I'm trying to get a working understanding of some of the basics behind SQL, I've composed a few questions that I think may help me with this. Anyone that can help me with any of them will greatly help me thanks.To use the terminology you have in those questions, you must already have a basic understanding of SQL, so you have exposed yourself as not being the author of such questions.
    Please do not ask homework questions without having at least attempted to answer them yourself first and show where you're struggling.

  • Creating the report in answers

    Hi
    I have one requirement that is I need to create one report. For this I am having two tables they are
    1. Area(DIM)
    2. Survey(Fact)
    using these two tables i need a report the report should be like
    in area table I am having
    Area
    PN
    CT
    SN
    FGN
    Survey
    P
    D
    PA
    S
    when I pull the columns from area and survey the report should be
    PN CT SN FGN P D PA S SCORE
    i 10 25 12 47 (P/S)-(D/S)
    a ii 23 12 20 55 (P/S)-(D/S)
    a total (((P/S)-(D/S))S)/S
    1
    b i 12 12 32 56 (P/S)-(D/S)
    ii 22 12 32 66 (P/S)-(D/S)
    b total (((P/S)-(D/S))S)/S
    A 1 total
    a i 11 23 12 46 (P/S)-(D/S)
    2 ii 10 25 12 47 (P/S)-(D/S)
    a total (((P/S)-(D/S))S)/S
    b i 12 12 32 56 (P/S)-(D/S)
    ii 22 12 32 66 (P/S)-(D/S)
    b total (((P/S)-(D/S))S)/S
    c i 12 12 32 56 (P/S)-(D/S)
    ii 22 12 32 66 (P/S)-(D/S)
    c total (((P/S)-(D/S))S)/S
    2 total
    Atotal
    To calculate 1 total = (a total * 25) + (b total * 70)
    2 total = (a total * 25) + (b total * 70) + (c total * 5)
    to find out A total = (a total * 25) + (b total * 70) + (c total * 5)
    Same way PN.B B total = (a total * 20) + (b total * 65) + (c total * 15)
    and PN.C C total = (a total * 30) + (b total * 65) + (c total * 5)
    in survey table S column value is nothing but P+D+PA
    is it possible to create in a single report

    Did you try it? What problem came up? Any? You don't expect us to build this report for you and give you the answer so you don't have to, do you?
    Don't ask homework questions. Try it. Then ask specific questions about a piece that you didn't get. Tell us what error message you got, how you debugged it, etc. so we don't give you suggestions that you already tried. But don't ask us to do it for you.

  • Difference between  exists and in operators in oracle?

    what is difference between exists and in operators in oracle?
    what is faster and why?

    Malli wrote:
    what is difference between exists and in operators in oracle?
    what is faster and why?Is this a homework question?
    Have you done any tests yourself to see which is faster?

  • Where can I find a sample ERD for a University

    Hello.
    I have to develop a program in C# that manages details about the students, taxes, courses, etc and prints some reports.
    It's for my license degree.
    The programming part is not that hard but the task that is killing me is designing the database because I have poor experience with data modeling.
    I don't have access to my university's database so I need to make one myself..and the teachers won't help..
    I tried to make a diagram but I realised that I cannot do it, I got stuck.
    An university database can get extremely complex and it's hard to make .. so I wonder if any of you know where can I find a sample ERD for a University. I need one as complete as possible.
    Any help is appreciated..

    jorjiana wrote:
    I don't have access to my university's database so I need to make one myself..and the teachers won't help..
    Unfortunately due to the quality of most of the homework questions on these forums I believe you when you say the teachers are no help. You should still discuss it with them and make clear you are not learning what they are supposed to be teaching.
    http://www.google.com/search?q=university+database+erd
    The top hit looks like a good start.

Maybe you are looking for

  • How to out from infinite while loop in sub VI

    Dear Sir, how to out from infinite while loop in sub VI from main VI attached photo for solution but I can't understand it and i can't find the function in photo  please help Attachments: stop_subVI_frm_main.JPG ‏36 KB

  • Displaying Icons in ALV Grid

    Hi, I've already searched the forum about this topic and I didn't find any thread that helped me to display the icon.  I'll post my code below, mind you, this code is just a test code so it's kinda trashy... INCLUDE: <icon>. TYPE-POOLS: slis. TYPES:

  • Customizing page size and layouts

    Three topics: CUSTOM PAGE SIZE.  There have been lots of requests for the ability to set custom sizes.  One "easy" way would be to create page margins in the same way that padding allows cell margins.  This way, a user can create (for example) a 10.5

  • Select performance problem

    in the below query,what could be the best method to avoid select * and modify statements.Kindly suggest with the piece of code.thanks! SELECT * FROM febep INTO CORRESPONDING FIELDS OF TABLE it_report           FOR ALL ENTRIES IN it_febko           WH

  • Inspection lot cancel after UD made.

    Hello all,            For one MIGO Inspection lot is created and material was accepted. now it is in FI module for payments. But FI people found that it was wrong Vendor. MIGOwas done for a wrong Vendor. So now i want to reverse the Inspection Lot. P