Output is not aligning

Hi,
Can someone please tell me what I can do to make my output align correctly? I used Titanic and then Mission Impossible for the name of the DVD's and the output is all off. It's correct but not aligned right with the column headings.
Thank you!!!
import java.util.Scanner;
import java.text.*;
public class inventory
  public static void main(String[] args)
    //This will hold the product name
    String name;
    //This will hold the value number of products
    int numberofproducts;
    //Creates a Scanner object to read input
    Scanner input = new Scanner(System.in);
    //Creating a number format instance to make pay print with 2 decimal digits
    NumberFormat nf = NumberFormat.getInstance();
    nf.setMaximumFractionDigits(2);      ; ;
    //prompting user to enter number of products (array size)
    System.out.print("Enter the number of products:  ");
    numberofproducts = input.nextInt();
    //creating an array of products to store information in
    DVD[] productarray = new DVD[numberofproducts];
    //This will loop until the number of products is 0
    for(int j = 0; j < numberofproducts; j++)
        productarray[j] = new DVD();
      //prompting user to enter product name
      System.out.print("Enter the DVD Title:  ");
      input.nextLine();
      //reading user's input
      productarray[j].setName(input.nextLine());
      //prompting user to enter the product number
      System.out.print("Enter the product number for " + productarray[j].getName() + " :  ");
      //reading user's input
      productarray[j].setProductnumber(input.nextInt());
      //prompting user to enter the price per unit
      System.out.print("Enter the price per unit for " + productarray[j].getName() + " :  ");
      //reading user's input
      productarray[j].setPriceperunit(input.nextDouble());
      //prompting user for the number of units
      System.out.print("Enter the number of units " + productarray[j].getName() + " on hand: ");
      //reading user's input
      productarray[j].setNumberofunits(input.nextInt());
       //Calculating the Value of Invetory
      nextProduct.setValueofinventory(nextProduct.getPriceperunit() * nextProduct.getNumberofunits());
      grandTotal += nextProduct.getValueofinventory();
      productarray[i] = nextProduct;
      input.nextLine();
    }//end for loop
    //Displaying the Inventory
    System.out.println("Item #\tName\tProduct #\t# of Units\tUnit Cost\tTotal Cost");
    for(int j = 0; j < numberofproducts; j++)
        System.out.print((j + 1) + "\t" + productarray[j].getName() + "\t" + productarray[j].getProductnumber() + "\t\t");
        System.out.print(productarray[j].getNumberofunits() + "\t\t$" + nf.format(productarray[j].getPriceperunit()) + "\t\t$");
        System.out.println(nf.format(productarray[j].getValueofinventory()));
    }//end for loop
System.out.println("The Value of the entire inventory is:  " + "$" + grandTotal );
  }//end main method
}//end class inventory
class DVD extends product
    private double valueofinventory;
    private double restockingfee;
    public DVD()
    }//end constructor
  //sets the valueofinventory variable plus a 5% restocking fee
  public void setValueofinventory(double valueofinventory)
        restockingfee = valueofinventory * .05;
    this.valueofinventory = valueofinventory * 1.05;
  }//end setValueofinventory
  //returns the valueofinventory value
  public double getValueofinventory()
      return valueofinventory;
  }//end getValueofinventory
  //returns the restockingfee value
  public double getRestockingfee()
      return restockingfee;
  }//end getRestockingfee
}//end class DVD
//This class will hold the information for the product
class product
  //This will hold the product name
  private String name;
  //This will hold the values for product number, price of each unit, and number of units in stock
  private int productnumber, numberofunits;
  //This will hold the price of each unit
  private double priceperunit, valueofinventory;
    public product()
    }//end constructor
    //Sets the name variable
    public void setName(String name)
        this.name = name;
    }//end setName
    //returns the string value for Name
    public String getName()
        return name;
    }//end getName
    //sets the productnumber variable
    public void setProductnumber(int productnumber)
        this.productnumber = productnumber;
    }//end setProductNumber
    //returns the integer assigned to productnumber
    public int getProductnumber()
        return productnumber;
    }//end getProductnumber
    //sets the priceperunit variable
    public void setPriceperunit(double priceperunit)
        this.priceperunit = priceperunit;
    }//end setPriceperunit
    //returns the priceperunit value
    public double getPriceperunit()
        return priceperunit;
    }//end getPriceperunit
    //sets the valueofinventory variable
    public void setValueofinventory(double valueofinventory)
        this.valueofinventory = valueofinventory;
    }//end setValueofinventory
    //returns the valueofinventory value
    public double getValueofinventory()
        return valueofinventory;
    }//end getValueofinventory
    //sets the numberofunits variable
    public void setNumberofunits(int numberofunits)
        this.numberofunits = numberofunits;
    }//end setNumberofunits
    //returns the numberofunits value
    public int getNumberofunits()
        return numberofunits;
    }//end getNumberofunits
}//end class product

Java is not actually designed and developed for stand alone console application. So you cannot expect output in console as you thought. There may be third party utilities for your needs. Just google it. You can use your own logic to do this. It is not difficult. Anyhow I include this code here. This would be helpful I hope.
public static String padAlign(String string, int fieldLength, char padding, boolean alignRight)
int length = fieldLength - string.length();
if (length <= 0)
return string.substring(0,string.length());
StringBuffer buffer = new StringBuffer(fieldLength);
for(int i=0; i<length; i++)
buffer.append(padding);
if (alignRight)
buffer.append(string);
else
buffer.insert(0,string);
return new String(buffer);
public static void main(String[] args)
System.out.println(padAlign("Test",20,' ',true)+" "+padAlign("Test again",20,' ',true));
System.out.println("--------------------|--------------------|");
System.out.println(padAlign("Test",20,' ',false)+" "+padAlign("Test again",20,' ',false));
}

Similar Messages

  • Objects not aligned in output power point as in project xcelsius2008 sp1

    Hi everybody,
    I need help...
    first of all, apologise me for my english...
    my principal problem is to create graphics with a legend that can be interactive with the line of the graphic... is there a function about this?
    The only thing I've found to solve my problem is to create many switches buttons and put them over the legend's label, but, when I try to export to PPT this objects are not aligned with the legend's text so the result is not useful and with a bad look...
    I've tried to use ceck boxes located near to the legend baut happens the same problem.
    If I export in html it works properly... but I net the power point..
    Thanks very much
    I hope someone can help me...
    Maurizio

    Hi Javier Jimenez,
    thanks again for the new suggestion!!
    in effect this could solve my problem cause the trasparency doesn't let to see if the new icon I put over the legend's icon is not perfectly aligned!
    in Italy we say : "It was the Coloumb's egg!" .. it means that if I'd thought enough, may be I'd have solved the problem by myself...
    Thanks again!
    If I can take advantage of you, the big problem for us is the heavyness of our swf inside ppt....
    I'll try to explain..
    excel file inside the project has 837 cells to be used for my graph (13 item in Coloumn x 65 item in Rows)
    this because we need to create a graphic to be able to show a trend of about 2 years, which increase (filling the empty cells) every month...
    so many informations, so many objects (icon, etc) tell me, is too much isn't it?
    because when I've exported the file in ppt, every time it takes 1 minute only to open that chart...
    is possible not to include the excel? could be a solution to take the information from an sql DB ?
    thank you very much!
    Maurizio

  • Output could not be issued - VT03n

    Hi,
    There is an issue with a few shipping documents when trying to print : Transaction VT03n
    When you choose 'Shipment --> Issue output to --> Screen, message number VW086 appears:
    "Output could not be issued"
    For output type ZDG1.
    Can any one suggest what could be the reason for this message as it is not happening for all documents except a few.
    Thanks & Regards,
    MK
    Edited by: MK18774 on Sep 3, 2009 6:06 PM

    i mean, like Condition records, sequences etc. But, i guess, they are fine.
    Some times the reason could be: If the text is over flowing than window size or word wrapping or window size is bigger than the specified page size, over lapping text contained windows, wrong alignment etc..........so, reduce the content of the text in each window, then try. Also pls. wait for replies from other experts, before re-sizing the windows
    thanq
    Edited by: SAP ABAPer on Sep 3, 2009 6:26 PM

  • Datas in Application Server file is not aligned

    Dear all,
               I have created a program in SE38 and transfer the data to the Application server file using Transfer statement.
               The datas are transferd to Application Server file , but datas are not aligned.
               In out Application server file thd datas are displaied one after another..
               But i want to display the datas in single row.
              I have include program for your reference.
    With Regards,
    Baskaran.
    report  zsutest34 message-id ztcpo.
                    DATA AND VARIABLES DECLARATION
    data: begin of leban occurs 0.
            include structure eban.
    data end of leban.
    data new(1).
                    SELECTION-SCREEN
    selection-screen begin of block 001 with frame title text-001.
    selection-screen skip 1.
    parameters filename(128) default '
    192.168.100.33\SAPMNT\IDS\dvebmgs00\data\santhosh.dat'. "\SYS\GLOBAL\testfile1.txt' LOWER CASE.
    select-options ldat for sy-datum.
    parameters lwerks type eban-werks.
    selection-screen skip 1.
    selection-screen end of block 001.
    START-OF-SELECTION
    select * from eban into leban where erdat in ldat and werks = lwerks.
      append leban.
    endselect.
    sort leban by banfn bnfpo.
    clear leban.
                    REGARDING DATASET
    perform value1.
    form value1.
    open dataset filename for output in text mode encoding default. " MESSAGE D_MSG_TEXT.
    data: l_msg(255) type c.
        if sy-subrc ne 0.
          message i001.
          exit.
        endif.
    concatenate 'The following file was opened:'(002) filename into l_msg separated by space.
            write: l_msg.
    uline.
                    TRANSFORMING TO APPLICATION SERVER FILE
    loop at leban.
          transfer leban-banfn to filename.
          transfer leban-bnfpo to filename.
          transfer leban-ekgrp to filename.
          transfer leban-matnr to filename.
          transfer leban-werks to filename.
    AT FIRST.
       WRITE: /10 TEXT-001, 30 TEXT-002, 45 TEXT-003, 50 TEXT-004, 65 TEXT-005.
       '            ITEMNO GRP MATERIAL           PLANT           QTY ' COLOR = 2.
    ENDAT.
      at new banfn.
        uline.
        write:/1 'PRNO-',leban-banfn.
        new = 'x'.
        uline.
        skip.
      endat.
      if new = 'x'.
        WRITE:/ '            ITEMNO GRP MATERIAL           PLANT           QTY ' color = 2.
        write:/14 leban-bnfpo,  leban-ekgrp, leban-matnr, leban-werks, leban-menge.
        clear new.
      else.
        write:/14 leban-bnfpo,  leban-ekgrp, leban-matnr, leban-werks, leban-menge.
      endif.
    endloop.
                    DATASET CLOSING
    close dataset filename.
    endform.

    wa_string type string
    loop at leban.
    concatenate leban-banfn
              leban-bnfpo
              leban-ekgrp
                 leban-matnr
                 leban-werks into wa_string
                 separated by CL_ABAP_CHAR_UTILITIES=>HORIZONTAL_TAB.
    transfer wa_string to filename.
    endloop.

  • ICal Week view, Date is not aligned with the Time(schedule) of each date

    Well, just like it says over there (`` ). I've recently been to China for a business trip, and I suppose the different time zone may have had something to do with the problem. Now I'm back home, changed the time zone back to normal, still the iCal shows in the weekly view that the Date on the above is not aligning with the Time and schedule. Any suggetions would be grateful!!!

    Hi,
    i omit the scheduling maergin key in material master,
    the result of MRP is
    BASIC DATES
    Finish 15.10.2009
    Start 14.10.2009
    PRODUCTION DATES
    15.02.2010 14:33:25
    14.10.2009 07:00:00
    scheduling type i planned order is still "backwards"
    so in MD04 it is say that the goods is available at 15.10.2009 same with requirement dates.
    this seem not right.
    it seems that order finish date is not adjusted by lead time scheduling on "today scheduling".
    Is there a way so order finish date is adjusted by lead time scheduling on "today scheduling" ????
    Best regards,
    Freddy Ha
    Edited by: Freddy Halim on Oct 14, 2009 10:01 AM

  • Error : Output could not be issued

    Dear Expert,
    I am not able to take print out of one of my invoice. While looking for print preview i am getting error message as below :
    Output could not be issued
    Message no. VF 304
    Diagnosis
    An error occurred while output was being issued. It is possible, for example, that the form to be issued has not been activated or has an error. An error may also have arisen while the data to be issued was being edited.
    I did some changes in smartform but all is activated and other invoices are showing proper output except one.
    can you please tell me possible causes to trace this error.
    Thanks.

    Hello,
    Please check the OSS : Note 451568 - Document printing:Message VF304 - Output could not be issued for more informtaion.
    https://websmp130.sap-ag.de/sap(bD1lbiZjPTAwMQ==)/bc/bsp/spn/sapnotes/index2.htm?numm=451568
    The OSS will be helpful.
    BR,
    Tushar

  • Output can not be issued.

    I want to see output of outbound delivery when I clicked print preview, i get message Output can not be issued.
    What is issue, if any body know plz do reply. Thnx in adv.

    Hi
    Check with your functinal Consultant he can help out , u need to Click on MESSAGEs and then choose a communication Method and Medium etc etc and SAVE , this ur Functional Consultant can help out and then u can see the OUTPUT when u click on PRINT PREVIEW.
    surya

  • Output can not be issued in SapScript..

    I want to see output of outbound delivery of Packing List when I clicked print preview, i got message Output can not be issued.
    In output there is showing red incorrectly processed No handling units exit.
    For that delivery no handling units exit. I want to print delivery with out handling units.
    Plz ket me know any suggestion.

    Hi
    Check with your functinal Consultant he can help out , u need to Click on MESSAGEs and then choose a communication Method and Medium etc etc and SAVE , this ur Functional Consultant can help out and then u can see the OUTPUT when u click on PRINT PREVIEW.
    surya

  • Audio output will not work on external speakers.  Internal speakers will work.  What do i do to replace audio output slot

    audio output will not work on external speakers.  Internal speakers will work.  What do i do to replace audio output slot

    Right click your volume icon in the notification area and select "volume control options". From there, you should be able to select the external speakers.
    I hope that helps!
    Best of luck,
    Kyle
    -------------How do I give Kudos? | How do I mark a post as Solved? --------------------------------------------------------

  • Text alignment "Justify" is not aligned in Crystal Viewer.

    Hi,
    I am having a text field in report like paragraph format in Detail section and I have setting the text alignment as u201CJustifyu201D. If I launch the report through dhtml viewer the text is not aligned in justify format, it is getting aligned as left alignment, but it is working properly while exporting to PDF and Design Preview panel.
    This problem is occurs in Crystal Report XI Release 2 and Crystal Report 2008 also.
    This has been already posted and the link is Text Alignment - Justification Problem
    Please help me to overcome this issue.
    Thanks in Advance.

    With CR 2008, make sure you are on SP4:
    SP4
    https://smpdl.sap-ag.de/~sapidp/012002523100008782452011E/cr2008sp4.exe
    SP4 MSI
    https://smpdl.sap-ag.de/~sapidp/012002523100008782532011E/cr2008sp4_redist.zip
    SP4 MSM
    https://smpdl.sap-ag.de/~sapidp/012002523100008782522011E/cr2008sp4_mm.zip
    If that does not help, please provide a link to screen shots of the issue.
    Ludek
    Follow us on Twitter http://twitter.com/SAPCRNetSup
    Got Enhancement ideas? Try the [SAP Idea Place|https://ideas.sap.com/community/products_and_solutions/crystalreports]

  • Output type not proposed in Message Control when PO is created

    Hi,
    DETAILS
    I have set up the system to send a IDOC when a PO is created. I have done the following settings in the system to send the IDOC using the message control functionality in the PO creation screen.
    1). Created a new output type ZNEU which is an exact copy of NEU output type provided by the SAP system.
    2). Assigned the new output type to the output determination procedure.
    3). Enabled the new output type ZNEU for ALE distribution.
    4). Maintained the condition records in the system for the output type ZNEU such that for the P org, endor and Docmuent type combination the output shall be proposed.
    5). Maintained a partner profile( Logical System ) and assigned the output type ZNEU to this partner profile.
    6). Created a Distribution model for Sender ~ Receiver for ORDERS message type.
    PROBLEM
    When i create a PO the new output type is not getting proposed by the system. I am not sure why it is not getting porposed in the message control.
    I tried to manually enter the ZNEU output type in the system to see if the system is accepting. I am getting an error
    Partner % does not exist for partner function LS
    Any idea what i am missing? Am i missing any configuration or am i doing something wrong?
    cheers

    The output is not being proposed automatically is becuase you are missing "Condition Records" for the output type ZNEU.
    Go to NACE.
    Select EF - Purchase Order
    Select "Condition Records"
    Select ZNEU and select condition records
    Now, system will bring the combinations of access sequence. Maintain appopriate record.
    This will enable you to get the output type automatically in the purchase order.
    Regards,
    Naimesh Patel

  • Output device not defined error while saving the quotation

    Hi all,
    We have some custom output types (ZGEN, ZSSO, ZQTO, ZJT)configured in the nace transaction for Application V1.  Whenever i am creating / saving a quotation one of the output type(ZQTO) is not processing for mail (External Send) and it is displaying an error as 'Output device not defined'.  If i remove all the output types while changing the quotation in VA22 from header, it is processing.
    I checked with all other output types combination.  The error is trigerred only when we  have ZJT output type along with ZQTO.
    We are not able to recognise the error.  Please help out to solve this issue.  Its very urgent.
    Thanks.

    Hi Remi
    Thanks for your reply. As per your reply I followed procedure and it allowed me to save Basic Pay Infotype (0008)
    Thanks a ton.
    Regards
    Prakash Bhave

  • Error: "output could not be issued" while seeing a print preview in va03

    Dear All
    In a T.code VA03 , if i have display a print pre-view for a particular order for an output type BAOA . Am getting an error "output could not be issued" . please give me the solution for this

    Hi,
    First check in PATH: - SPRO > Sales and Distribution > Basic Functions > Output Control > Output Determination > Output Determination Using the Condition Technique > Maintain Output Determination for Sales Documents > Maintain Output Types - Here for O/P Type BAOA, check whether FORM Routine "ENTRY" has been asisgned under "Processing Routine" option.
    If not resolved then secondly, Check whether any Requirement (Routine) has been assigned to the Output Type BAOA in the Output Determination Procedure.
    To check the same, go to PATH: - SPRO > Sales and Distribution > Basic Functions > Output Control > Output Determination > Output Determination Using the Condition Technique > Maintain Output Determination for Sales Documents > Maintain Output Determination Procedure - Here check for the Procedure assigned to your Sales Area and Sales Doc Type (for e.g. V10000). If any requirement is there then make it blank and then try printing the order by deleteting and adding new o/p record.
    If not resloved then Ask ABAPer to debug it.

  • Printfreview, output can not be issued. why?

    Hi, All
    I created a program and a related script form. And I need to make a test in printpriview. Of course, the business module person had set output type for my form. But when I pushed "Printview" , the error message happened that output can not be issued.
    <Priority normalized by moderator>
    Thanks in advance!
    Edited by: Vinod Kumar on May 26, 2011 9:49 AM

    I found the configurature on print output type had somthing wrong, that the output type configured by  business moduler has red spots. Please refer to the screen shot attached .
    So does it mean the print output hasn't configure sucessfully? And it's no business with my form or program?
    Edited by: stephanie.sheng on May 26, 2011 8:40 AM

  • Message 069 - Output could not be displayed (it may not be complete)

    Hi Gurus,
    KIndly help me please. Upon trying to print a billing document in VF31, the message Message 069 - Output could not be displayed (it may not be complete) appears and as a result I cannot print preview the document. However, I tried doing the print preview in our testing environment and I didn't experienced the same error. KIndly help me what configuration should I compare the two systems. Thank you in advance
    Thanks and regards,
    Happy

    Hi
    First of all check wheather condition record has been maintained or not in VV32.If not maintained then maintain in VV31.Also check wheather any batch job is running or not for that output type.If it is running then there are chances to get that message.You might of not faced the same problem in your sandbox server because you might have manually entered the output type
    Regards
    Srinath

Maybe you are looking for

  • ITunes 7 Rendering Issues

    Ahoy hoy, I became entangled in this problem upon first running iTunes; Running it for the first few minutes, all is fine, tick-tock, no problems so far. Then... If one is inclined to switch applications, to say Firefox etc., hide iTunes, and then sw

  • SQL Server 2000 Reporting withJava

    Hi All, Can any one give the code to open SQL Server 2000 Reporting file (i.e, with the extension '.rdl') as we do for the crystal reports '.rpt' file in jsp. Is there any eclipse plugin for SQL Server 2000 Reporting service. thanks in advance.

  • Mit DIAdem 8.1 erzeugte Autosequenz lassen sich mit DIAdem 10.1 nicht ausführen

    Hallo, bei einer Autosequenz, die in Diadem 8.1 geschrieben worden ist und mit Diadem10.1 ausgeführt wird kommt die Fehlermeldung "Schlüsselwort "NAVIGATOR,REPORT,DAC,ANY,DATA,GRAPH,VIEW" nicht in Schlüsselliste vorhanden" Gibt es eine einfache Mögli

  • Distilling transparent colors from Word

    I have a color transparency in a Word document that renders in a dithered fashion when I create the corresponding PDF document. I have tried the various pre-defined settings (standard, high quality, and press quality) as well as disabling compression

  • The same SMS messages are showing more than once

    Hi, On my SMS page, my message threads are showing up more than once , How would I go about fixing this?