Problem with totaling amounts in a loop

Hello, I am having trouble with some code I am writing in that I cannot get my totals to continuously add inside my loop and print out to the screen. I have gotten this far, and I am attempting to use JOptionPane which is something I am unfamiliar with as I have never had the need to use it. I have pasted the code below, so if any of you can help me it would be greatly appreciated. Thank you
import javax.swing.*;
public class SalesPay
     public static void main(String args[])
          // Declare variables.
          String inputName;
          String inputSales;
int base = 200;
int again;
          double weeklySales, pay;
          inputName = JOptionPane.showInputDialog("Enter your last name ");
          // Input the value for weekly sales.
          do
          inputSales = JOptionPane.showInputDialog("Enter your sales ");
          again = JOptionPane.showConfirmDialog (null, "more sales amounts? ");
          while (again == JOptionPane.YES_OPTION);
          weeklySales = Integer.parseInt(inputSales + inputSales);
          // Calculate pay: commission for sales > $1000 is 10%,
          // commission for sales <= $1000 is 5%.
          if (weeklySales > 1000)
               pay = (base + (weeklySales * 0.10));
          else
               pay = (base + (weeklySales * 0.05));
          // Display pay.
          JOptionPane.showMessageDialog(null, inputName + " your total sales for the week are: " + weeklySales +
"\nYour pay for the week is $" + pay + ".", "Pay for $" + weeklySales,JOptionPane.INFORMATION_MESSAGE);
          // Close application.
          System.exit(0);
}

First of all, use the [code ] formatting tags when you post code so the code is formatted correctly. Click on the "Formatting Help" link the next time you ask a question.
You keep reseting the value of 'inputSales' every time you show the input dialog. Your code should be something like:
do
inputSales = JOptionPane.showInputDialog("Enter your sales ");
weeklySales += Integer.parseInt(inputSales);
again = JOptionPane.showConfirmDialog (null, "more sales amounts? ");
while (again == JOptionPane.YES_OPTION);

Similar Messages

  • Problem with java swing button and loop

    Problem with java swing button and loop
    I�m using VAJ 4.0. and I�m doing normal GUI application. I have next problem.
    I have in the same class two jswing buttons named start (ivjGStart) and stop (ivjGStop) and private static int field named Status where initial value is 0. This buttons should work something like this:
    When I click on start button it must do next:
    Start button must set disenabled and Stop button must set enabled and selected. Field status is set to 1, because this is a condition in next procedure in some loop. And then procedure named IzvajajNeprekinjeno() is invoked.
    And when I click on stop button it must do next:
    Start button must set enabled and selected and Stop button must set disenabled.
    Field status is set to 0.
    This works everything fine without loop �do .. while� inside the procedure IzvajajNeprekinjeno(). But when used this loop the start button all the time stay (like) pressed. And this means that a can�t stop my loop.
    There is java code, so you can get better picture:
    /** start button */
    public void gStart_ActionEvents() {
    try {
    ivjGStart.setEnabled(false);
    ivjGStop.setEnabled(true);
    ivjGStop.setSelected(true);
    getJTextPane1().setText("Program is running ...");
    Status = 1;
    } catch (Exception e) {}
    /** stop button */
    public void gStop_ActionEvents() {
    try {
    ivjGStart.setEnabled(true);
    ivjGStart.setSelected(true);
    ivjGStop.setEnabled(false);
    getJTextPane1().setText("Program is NOT running ...");
    Status = 0;
    } catch (Exception e) {
    /** procedure IzvajajNeprekinjeno() */
    public void IzvajajNeprekinjeno() {  //RunLoop
    try {
    int zamik = 2000; //delay
    do {
    Thread.sleep(zamik);
    PreberiDat(); //procedure
    } while (Status == 1);
    } catch (Exception e) {
    So, I'm asking what I have to do, that start button will not all the time stay pressed? Or some other aspect of solving this problem.
    Any help will be appreciated.
    Best regards,
    Tomi

    This is a multi thread problem. When you start the gui, it is running in one thread. Lets call that GUI_Thread so we know what we are talking about.
    Since java is task-based this will happen if you do like this:
    1. Button "Start" is pressed. Thread running: GUI_Thread
    2. Event gStart_ActionEvents() called. Thread running: GUI_Thread
    3. Method IzvajajNeprekinjeno() called. Thread running: GUI_Thread
    4. Sleep in method IzvajajNeprekinjeno() on thread GUI_Thread
    5. Call PreberiDat(). Thread running: GUI_Thread
    6. Check status. If == 1, go tho 4. Thread running: GUI_Thread.
    Since the method IzvajajNeprekinjeno() (what does that mean?) and the GUI is running in the same thread and the event that the Start button has thrown isn't done yet, the program will go on in the IzvajajNeprekinjeno() method forever and never let you press the Stop-button.
    What you have to do is do put either the GUI in a thread of its own or start a new thread that will do the task of the IzvajajNeprekinjeno() method.
    http://java.sun.com/docs/books/tutorial/uiswing/index.html
    This tutorial explains how to build a multi threaded gui.
    /Lime

  • Problem with total page numbers in Scripts

    Hi,
    I have a problem with total number of pages in the Script.
    I have a script of 15 pages.
    On every page, I am using &PAGE& of &SAPSCRIPT-FORMPAGES(C)&.
    Problem is : I am getting only single digit for SAPSCRIPT-FORMPAGES as long as the page number remains in single digit - like -
    1 of 1
    2 of 1
    3 of 1... till 9 of 1.
    But from 10th page, it is printing :
    10 of 15
    11 of 15
    12 of 15... till 15 of 15.
    So, i think the symbol SAPSCRIPT-FORMPAGES(C) is filled with value 15 , but it is prinitng only the first digit '1' for pages 1 to 9 and then printing both the digits '15' for pages from 10 onwards.
    So, please help me out in this problem.
    Thank you.

    Hi Ven,
    The CONDENSE option cannot be used on the program icon SAPSCRIPT-FORMPAGES
    (C) without an explicit length specification: This symbol is
    only replaced with a value after the form has been completely edited, as the
    total number of pages of a form is first known in the program function
    END_FORM or CLOSE_FORM. However, the size of the symbol (number of
    characters) is reserved correctly when the symbol first occurs, with the
    current page number. Therefore, only one character is reserved for option C
    (CONDENSE) on pages 1-9, two characters on pages 10-99, and so on.
    If you are sure that the total number of pages doesn't cross 99(i.e 2-digit number), then use the FORM pages as SAPSCRIPT-FORMPAGES(2CZ).
    Here Z will suppress the leading zeros, for the total number of pages.
    Hope this information would be useful for you.
    Reward points if this is useful.
    Pavan.

  • Problem with the amount appearing in LC in MIGO

    Dear Guys,
    I have made a dealer PO , this PO has 4 line items , I have done Migo for each item sepeartely,& while doing the migo ,I bifurcate the amount in the excise tab as per the info given by the vendor.
    Now in the Migo of the first three line items the amount appearing in LC (qty Tab in MIGO) is matching with total amount (Base price +Excise Duty (10.3%) +CST)   , but in the fourth item the amount in LC is equal to Base price + CST.
    What might be the reason for this difference , & which is right( does dealer PO has anything to do with this difference)
    Regards,
    DGN

    Hi ! Jeyakanthan,
    I am already maintaining the zero tax code for all dealers PO , what I would like to know know what should be the amount appearing in LC (In Migo) , should it be Base Price + Taxes + CST or only Base Price +CST (since you get set off on Taxes ).
    Regards,
    DGN

  • Problem with total button in alv..?

    Hi abapers,
                      i am facing a problem with standard alv total button
    all the others button r working fine
    but when i am trying to add any column total by using standard total button
    its throwing dump..
    Can anyone tell me wat to do

    Hi Aarif Baig,
    Paste your dump analysis...
    what dump you are geting and source code for your field catelog...  ??
    as well as which field you are removing from your fieldcatelog so that dump is not coming... ??
    and code for that field in fieldcatelog  ??
    and is the type of that filed in fileld catelog and internal table is same or not... ??
    if i am not wrong you will be getting dump for message  x000..
    Please give complete details what you did with little source code and dump analysis....
    Hope it will solve your problem..
    Thanks & Regards
    ilesh 24x7
    ilesh Nandaniya

  • Out.println() problems with large amount of data in jsp page

    I have this kind of code in my jsp page:
    out.clearBuffer();
    out.println(myText); // size of myText is about 300 kbThe problem is that I manage to print the whole text only sometimes. Very often happens such that the receiving page gets only the first 40 kb and then the printing stops.
    I have made such tests that I split the myText to smaller parts and out.print() them one by one:
    Vector texts = splitTextToSmallerParts(myText);
    for(int i = 0; i < texts.size(); i++) {
      out.print(text.get(i));
      out.flush();
    }This produces the same kind of result. Sometimes all parts are printed but mostly only the first parts.
    I have tried to increase the buffer size but neither that makes the printing reliable. Also I have tried with autoFlush="false" so that I flush before the buffer size gets overflowed; again same result, sometimes works sometimes don't.
    Originally I use such a system where Visual Basic in Excel calls a jsp page. However, I don't think that this matters since the same problems occur if I use a browser.
    If anyone knows something about problems with large jsp pages, I would appreciate that.

    Well, there are many ways you could do this, but it depends on what you are looking for.
    For instance, generating an Excel Spreadsheet could be quite easy:
    import javax.servlet.*;
    import javax.servlet.http.*;
    import java.io.*;
    public class TableTest extends HttpServlet{
         public void doGet(HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException {
              response.setContentType("application/xls");
              PrintWriter out = new PrintWriter(response.getOutputStream());
                    out.println("Col1\tCol2\tCol3\tCol4");
                    out.println("1\t2\t3\t4");
                    out.println("3\t1\t5\t7");
                    out.println("2\t9\t3\t3");
              out.flush();
              out.close();
    }Just try this simple code, it works just fine... I used the same approach to generate a report of 30000 rows and 40 cols (more or less 5MB), so it should do the job for you.
    Regards

  • Problem with SWF export and audio looping

    When I export from Keynote into SWF, I get an odd audio looping problem when playing the SWF files. Here's the workflow:
    Create Keynote presentation (includes transitions typically, but also happens with presentations that don't).
    Record audio using Audacity, convert using iTunes to MP3 in order to be able to export from Keynote to Flash (Keynote can't export WAV files).
    Drop in MP3s onto slides. Sync up my transitions with audio.
    Export Keynote file to SWF, including the audio.
    Play SWF file either directly using Safari or when posted using Firefox. Audio plays, but a certain length into the audio the audio file seems to re-initiate and play over itself.
    Anybody seen this? Anyone know how to solve it?
    This is pretty critical for us (work related). We are using Keynote to create educational content SWF files, and we only discovered this problem after release.
    Thanks for your help!
    Michael

    The helper class using IText:
    import java.io.ByteArrayInputStream;
    import java.io.ByteArrayOutputStream;
    import java.io.IOException;
    import java.io.InputStream;
    import com.lowagie.text.Document;
    import com.lowagie.text.DocumentException;
    import com.lowagie.text.pdf.PdfContentByte;
    import com.lowagie.text.pdf.PdfImportedPage;
    import com.lowagie.text.pdf.PdfReader;
    import com.lowagie.text.pdf.PdfWriter;
    public class PDFHealer
       public static InputStream heal(InputStream in) throws DocumentException, IOException
          try
             ByteArrayOutputStream out = new ByteArrayOutputStream();
             PdfReader reader = new PdfReader(in);
             // we retrieve the total number of pages
             int n = reader.getNumberOfPages();
             // step 1: creation of a document-object
             Document document = new Document();
             // step 2: we create a writer that listens to the document
             PdfWriter writer = PdfWriter.getInstance(document, out);
             // step 3: we open the document
             document.open();
             // step 4: we add content
             PdfContentByte cb = writer.getDirectContent();
             int i = 0;
             while( i < n )
                document.newPage();
                i++;
                PdfImportedPage page1 = writer.getImportedPage(reader, i);
                cb.addTemplate(page1, 0, 0);
             // step 5: we close the document
             document.close();
             ByteArrayInputStream ret = new ByteArrayInputStream(out.toByteArray());
             out.close();
             return ret;
          finally
             in.close();

  • Problem with continue in a for loop

    Hi all
    I have a variable of type Node[] which contains nodes like Text,ImageView and SVGPath etc...
    now i want to filter that group which means i want to separate the Text nodes for that i used a for loop as
    var abc:Node[];
    var abcsize=sizeof abc;
    var textarray:Text[]=for(i in abc){
    if(i.toString()=="Text"){
       i as Text;  //casting Node to Text
                     }//if
               else{
                      continue;     //if the node is not of type Text then i am skipping that one
                     }//else
          }//forwhen i am trying to compile this i am getting the compilation error as
    Note: An internal error has occurred in the OpenJFX compiler. Please file a bug at the
    Openjfx-compiler issues home (https://openjfx-compiler.dev.java.net/Issues)
    after checking for duplicates.  Include in your report:
    - the following diagnostics
    - file 1.2.3_b36
    - and if possible, the source file which triggered this problem.
    Thank you.
        else{
    An exception has occurred in the OpenJavafx compiler. Please file a bug at the Openjfx-compiler issues home (https://openjfx-compiler.dev.java.net/Issues) after checking for duplicates. Include the following diagnostic in your report and, if possible, the source code which triggered this problem.  Thank you.
    java.lang.ClassCastException: com.sun.tools.javac.tree.JCTree$JCContinue cannot be cast to com.sun.tools.javac.tree.JCTree$JCExpression
            at com.sun.tools.javafx.comp.JavafxToJava.translateToExpression(JavafxToJava.java:568)
            at com.sun.tools.javafx.comp.JavafxToJava.visitBlockExpression(JavafxToJava.java:2320)
            at com.sun.tools.javafx.tree.JFXBlock.accept(JFXBlock.java:83)
            at com.sun.tools.javafx.comp.JavafxToJava.translateToExpression(JavafxToJava.java:565)
            at com.sun.tools.javafx.comp.JavafxToJava.translateAsValue(JavafxToJava.java:575)
            at com.sun.tools.javafx.comp.JavafxToJava.visitIfExpression(JavafxToJava.java:3595)
            at com.sun.tools.javafx.tree.JFXIfExpression.accept(JFXIfExpression.java:48)
            at com.sun.tools.javafx.comp.JavafxToJava.translateToExpression(JavafxToJava.java:565)
            at com.sun.tools.javafx.comp.JavafxToJava.visitBlockExpression(JavafxToJava.java:2320)
            at com.sun.tools.javafx.tree.JFXBlock.accept(JFXBlock.java:83)
            at com.sun.tools.javafx.comp.JavafxToJava.translateToExpression(JavafxToJava.java:565)
            at com.sun.tools.javafx.comp.JavafxToJava.translateAsValue(JavafxToJava.java:575)
            at com.sun.tools.javafx.comp.JavafxToJava$5.addElement(JavafxToJava.java:3007)
            at com.sun.tools.javafx.comp.JavafxToJava.visitForExpression(JavafxToJava.java:3212)
            at com.sun.tools.javafx.tree.JFXForExpression.accept(JFXForExpression.java:50)
            at com.sun.tools.javafx.comp.JavafxToJava.translateToExpression(JavafxToJava.java:565)
            at com.sun.tools.javafx.comp.JavafxToJava.translateAsValue(JavafxToJava.java:575)
            at com.sun.tools.javafx.comp.JavafxToJava.translateNonBoundInit(JavafxToJava.java:1861)
            at com.sun.tools.javafx.comp.JavafxToJava.translateDefinitionalAssignmentToValueArg(JavafxToJava.java:1876)
            at com.sun.tools.javafx.comp.JavafxToJava.translateDefinitionalAssignmentToSetExpression(JavafxToJava.java:1917)
            at com.sun.tools.javafx.comp.JavafxToJava.visitVarScriptInit(JavafxToJava.java:1976)
            at com.sun.tools.javafx.tree.JFXVarScriptInit.accept(JFXVarScriptInit.java:67)
            at com.sun.tools.javafx.comp.JavafxToJava.translateToStatement(JavafxToJava.java:598)
            at com.sun.tools.javafx.comp.JavafxToJava.translateToStatement(JavafxToJava.java:628)
            at com.sun.tools.javafx.comp.JavafxToJava.visitBlockExpression(JavafxToJava.java:2306)
            at com.sun.tools.javafx.tree.JFXBlock.accept(JFXBlock.java:83)
            at com.sun.tools.javafx.comp.JavafxToJava.translateToStatement(JavafxToJava.java:598)
            at com.sun.tools.javafx.comp.JavafxToJava.access$700(JavafxToJava.java:89)
            at com.sun.tools.javafx.comp.JavafxToJava$FunctionTranslator.makeRunMethodBody(JavafxToJava.java:2164)
            at com.sun.tools.javafx.comp.JavafxToJava$FunctionTranslator.methodBody(JavafxToJava.java:2224)
            at com.sun.tools.javafx.comp.JavafxToJava$FunctionTranslator.doit(JavafxToJava.java:2279)
            at com.sun.tools.javafx.comp.JavafxToJava.visitFunctionDefinition(JavafxToJava.java:2292)
            at com.sun.tools.javafx.tree.JFXFunctionDefinition.accept(JFXFunctionDefinition.java:93)
            at com.sun.tools.javafx.comp.JavafxToJava.translateGeneric(JavafxToJava.java:500)
            at com.sun.tools.javafx.comp.JavafxToJava.translate(JavafxToJava.java:509)
            at com.sun.tools.javafx.comp.JavafxToJava.visitClassDeclaration(JavafxToJava.java:1261)
            at com.sun.tools.javafx.tree.JFXClassDeclaration.accept(JFXClassDeclaration.java:141)
            at com.sun.tools.javafx.comp.JavafxToJava.translateGeneric(JavafxToJava.java:500)
            at com.sun.tools.javafx.comp.JavafxToJava.translate(JavafxToJava.java:521)
            at com.sun.tools.javafx.comp.JavafxToJava.visitScript(JavafxToJava.java:1147)
            at com.sun.tools.javafx.tree.JFXScript.accept(JFXScript.java:89)
            at com.sun.tools.javafx.comp.JavafxToJava.translateGeneric(JavafxToJava.java:500)
            at com.sun.tools.javafx.comp.JavafxToJava.translate(JavafxToJava.java:517)
            at com.sun.tools.javafx.comp.JavafxToJava.toJava(JavafxToJava.java:691)
            at com.sun.tools.javafx.main.JavafxCompiler.jfxToJava(JavafxCompiler.java:728)
            at com.sun.tools.javafx.main.JavafxCompiler.jfxToJava(JavafxCompiler.java:699)
            at com.sun.tools.javafx.main.JavafxCompiler.compile2(JavafxCompiler.java:785)
            at com.sun.tools.javafx.main.JavafxCompiler.compile(JavafxCompiler.java:685)
            at com.sun.tools.javafx.main.Main.compile(Main.java:624)
            at com.sun.tools.javafx.main.Main.compile(Main.java:312)
            at com.sun.tools.javafx.Main.compile(Main.java:84)
            at com.sun.tools.javafx.Main.main(Main.java:69)
    ERROR: javafxc execution failed, exit code: 4
    D:\work\javaFX\javaFX_workspace\Book_fix\nbproject\build-impl.xml:143: exec returned: -1Any one please help

    - This is a real bug in the compiler, obviously. I wonder if I haven't meet it already, or something similar. Maybe you should report it.
    - The problem is that your code is incorrect anyway: the branch with continue doesn't return a value, so cannot be used in the list building. Well, at least that's what I suppose which confuses the compiler. You can try and return null (which will be discarded) instead of using continue.
    - But your code can be much more efficient, compact and perhaps even more readable, using the powerful JavaFX sequence comprehension:
    var seqMixed = [ 1, "one", Text { content: "Ichi" }, Circle {}, 2, "two", Text { content: "Ni" } ];
    println(seqMixed);
    var seqFiltered = seqMixed[ obj | obj instanceof Text ];
    println(seqFiltered);
    seqFiltered = seqMixed[ obj | not (obj instanceof Text) ];
    println(seqFiltered);

  • Problem with printing amounts in SAP Script

    Hello All,
    I have multiple line items to be printed in which one of the column contains amount value. I have a problem printing amount value aligning it to the right of the column.
    The amount is printed as below
    1.202,00
    18.202,00
    19.202,00
    I want to print 1.202,00 right justified so that it would be aligned to the other amount values.
    Pls help me out.

    Sorry:-)
    if you define the line format with the name RJ(right justified) you must use this like follow.
    RJ|     &12334,11&
    and not
    <br>&12345,11& </>
    now is that clear?? is hard to explain
    Marco

  • HELP PLEASE!! Boot problems with Snow Leopard (Blue Screen Loop)

    Hi guys!
    My MacBook (the model before the current one) wont boot up. It started stuttering and acting strange and then froze so I did a force restart. It then loaded all the way up until a blue screen when the mouse appears and can be moved. This flickers off after a few moments (the screen dims) and then comes back. The process repeats as if in some infinite loop.
    The main problem is that I've lost my snow leopard disc so I'm pretty limited to what I can do until I can borrow / buy another one and I need to get my laptop back up right away for work.
    I've tried booting in safe mode, no joy
    I then tried to repair the drive in fsck, which repaired something. I did it again and it said all was ok but then booting stuck at the same place.
    Finally I read on another forum that removing /Library/Preferences/com.apple.security.plist fixed login loop issues. I attempted this in single user mode but it said the file didnt exist?
    Can anyone help me out here? I'm pretty stressed out as all my work stuff is on there for my new job...
    Thanks!!

    I had this same problem -- machine would boot, but loop at two blue screens before the login window. I sshed into the machine and checked /private/var/log/system.log and /var/log/secure.log which showed a unexpected character in /etc/authorization. Basically, the authorization file was corrupted (most likely by bad RAM.) The solution was to replace this file with one copied from another machine. I didn't match models, but did match OS when copying the file (i don't know if this matters at all), and as soon as the "cp" command was entered, the login window popped up. <-- totes awesome. The machine has been reliable since (all of 15 minutes)

  • Problem with total context score in COMPARISSION VIEW in SSM

    Dear friends,
    We have scorecard  with 4 contexts (region).Every context has 3 level: perspective ,objective KPIs. Every level get score and all the context get total score .We have requirement to compare between  region context scores. For it we use comparison view. BUT AT comparison  view  we can compare the score of perspective ,objective KPIs but not total score of the context .Total score is disappear.  I don’t know if there is bug or it's a problem of implementation. I very glad to get help from us.
    Best regard,
    Benyamin Orit.

    Hi Orit,
    I do not believe its an implementation problem, I have checked our implementation which is currently running SSM 10.1 sp03  and the context score doesn't appear neither in the comparison view.
    Probably this feature is simply not included yet in this sp. Maybe another colleague can confirm if this feature is included in further sps... but I didn't find any release note mentioning it, and according to a screenshot I just saw (posted by Colin Cooper on the ideas place), it doesn't seem to be included in sp06 (see Colin's screenshot of comparison view without context scores showing).
    In the main time try to work around it, maybe creating a new level (perspective) thats called "context xxx score" and put the rest of the scorecard one level under it, even though it doesn't sound very purist, you should be able to compare all context scores on the comparison view tab.
    Regards,

  • Problem with variable in a for loop in a Chessboard project.

    Hi, im having trouble with a chessboard project. I am trying to get the chessboard to be able to increase and decrease in size when the user enters a number. But it seems as if the program is freezing. Here is my code
    import java.awt.*;
    import java.applet.*;
    import java.awt.event.*;
    public class chessboard extends Applet implements ActionListener {
         public  TextField pieces;
         int x;
         int y;
         int n;
         int size = 0;
         public void init() {
              pieces = new TextField(5);
            add(pieces);
            pieces.addActionListener(this);
         public void actionPerformed(ActionEvent e) {
            size = Integer.parseInt(pieces.getText());
            repaint();
         public void paint(Graphics g) {
               x = 40;
               y = 40;
               n = 0;
              ///Problem i think     
              for(y = 40; y < 400; y = y+size  ){                    
                    //y = y + size;
                      n++;
                   for(x = 40; x < 400; x = x+size){
                        //x= x +size;
                        n++;
                   if (n % 2 == 0){
                        g.setColor(Color.BLACK);
                   else {
                        g.setColor(Color.WHITE);
                   g.fillRect(x,y,size,size);     
                   }//end nested for
              }//end for
              g.drawRect(40,40,size*8,size*8);
              g.drawString("Enter size of Squares in Pixels",40,20);
         }//end paint
    }//end class

    import java.awt.*;
    import java.applet.*;
    import java.awt.event.*;
    public class Chessboard extends Applet implements ActionListener {
        private TextField pieces;
        private int size = 0;
        public void init() {
            pieces = new TextField(5);
            add(pieces);
            pieces.addActionListener(this);
        public void actionPerformed(ActionEvent e) {
            size = Integer.parseInt(pieces.getText());
            repaint();
        public void paint(Graphics g) {
            if (size > 0) {
                drawBoard(g);
        private void drawBoard(Graphics g) {
            int n = 0;
            for(int y = 40; y < 400; y += size){
                n++;
                for(int x = 40; x < 400; x += size){
                    n++;
                    g.setColor(n % 2 == 0 ? Color.BLACK : Color.WHITE);
                    g.fillRect(x,y,size,size);
            g.drawRect(40,40,size*8,size*8);
            g.drawString("Enter size of Squares in Pixels",40,20);
    }

  • Problem with totals in Bex

    Hi friends!
    My cube has the char DATE_FIN related to the doc_number.
    My query should show the difference in days between DATE_FIN and the Bex variable DATE_COMPARE  (constant value).
    This works ok when I show data with doc_number detail , ie:
    Oficce    Doc_number          date_fin        date_compare         diff
    A          1000               10/12/2010     12/12/2010           2
    A          1001               09/12/2010     12/12/2010           3
    B          1002               08/12/2010     12/12/2010           4
    But I need suppress the doc_number char, and have total by Office, ie:
    Oficce  date_fin    date_compare         diff
    A     10/12/2010     12/12/2010           5
    B     08/12/2010     12/12/2010           4
    The issue is that when I do it,  the report show me u2018Xu2019 in the diff column
    How can I solve this?
    Thank you in advance!

    Hello;
    Try differents aggregations, all based on infoobject doc_number.
    In your formala, in aggregation tab; set aggregation exception (exemple: Total).
    This should work.
    Feature available in querie designer 7.0
    Regards.

  • Joining Two Tables with Total Amount

    Hi All,
    I'm trying to join to tables P02 and P30 on the invoice no fields but getting duplicates. In table P30 we need to sum the payment column per invoice to get the actual payment amount. This then needs to Join to table P02. I have uploaded  sample
    data on this link and provided an example on how the output should like.
    https://app.box.com/s/pu8oa4f3jhrhm0ylshdz2fuo7541vn4z
    Thanks
    Jag

    I figured out why the duplicates appear. I'm attaching another table supplier to fill in the missing propcode when running the query below
    SELECT P02.P02_UNIQUE, p30.PROP_CODE, P02.SUPP_ALPHA+P02.SUPP_NUMERIC As SupplierCode, P02.INV_ALPHA+P02.INV_NUMERIC AS InvoiceNo,TotalPayment, Year, Month
    FROM P02
    CROSS APPLY (
                    SELECT PROP_CODE, SUM(TOTAL_AMOUNT) AS TotalPayment, P30.INVOICE_NUMB, DATEPART(year,[CREATED_DATE_SQL]) AS [Year], DATEName(Month,[CREATED_DATE_SQL]) AS [Month]
                    FROM dbo.P30
                    WHERE P02.INV_ALPHA+P02.INV_NUMERIC = P30.INVOICE_NUMB
                    GROUP BY PROP_CODE, COST_CENTRE, DATEPART(year,[CREATED_DATE_SQL]), DATEName(Month,[CREATED_DATE_SQL]), P30.INVOICE_NUMB
                    )P30
    Where P02.SUPP_ALPHA+P02.SUPP_NUMERIC = '668'
    Result below and the last row the prop_code is missing
    I have another table supplier which has the suppliercode and propcode so was trying to use the prop_code field from supplier table instead of P30 table to fill in the gap. But when i do that i get duplicates and wrong values.
    I have updated the sample data with supplier table.

  • Problem with ALV amount field display

    hi friend!!
    i have a editable ALv out put and in that i am displaying Amount and quantity field. In O/p if i enter 100 its taking as 100,00 .Please tell me how to correct the same.
    Plz help me

    Try to fill the Ref_fieldname and Ref_tabname in the fieldcatalog.
    also specify decimals = 0 for the column which you are editing.
    fieldcat-ref_fieldname = 'KWMENG'.
    fieldcat-ref_tabname = 'VBAP'.
    fieldcat-decimals_out = 0.
    "if you want decimals then specify the number how many you want

Maybe you are looking for