Help with some beginner code

Hello, I am new to java and I need a bit of help with some code that I'm writing. here is the code:
import javax.swing.*;
public class Test{
     public static void main(String[] args){
     JOptionPane.showMessageDialog(null,"We will now build a block with *'s","Block",1);
     String input=JOptionPane.showInputDialog(null,"Type a number: ","Number",3);
     int number=Integer.parseInt(input);
     int count=0; int count2=0;
     for(count2=0; count2<number; count2++){
          for(count=0; count<number; count++){
          System.out.print("* ");
System.exit(0);
}Now, all I need is to build a block of *'s with the number that the user inputs. With the code that I wrote I get the correct number of *'s but not in the form of a block. They just print out in a straight line. I know this is a very simple task but could someone please help me out? What do I need to modify in my code so that the *'s print out arranged as a block like so:
**********

Your code only uses the print method which prints without a carriage return/line feed. So you need to add a line of code to print a carriage return/line feed. Where? well that is your task to work out.

Similar Messages

  • I need help with some simple code! Please read!

    hi everyone.
    I'm having problems with a piece of code, and i'd be extremely greatful if somebody could give me a hand with it. I'm totally new to java and have to make a program for my university degree, but i'm finding it extremely difficult, mainly due to my total lack of apptitude for this type of thing. I know this is easy stuff, but the books I have are no use so any help would be greatly appreciated.
    I have to write a program which uses two class files. I want one with the code to produce a simple button, and one to invoke it several times at different locations. I decided to write the program as one class file at first, and thought i'd be able to split it up at later. The program works fine when it is one class file. My book said that to split the two classes up, all i needed to do was change the second class to public, although this seems to not work at all. I'm at my wits end on this, and if anyone could correct my code I'd be eternally greatful.
    Here is the first class... (sorry about the lack of indentation)
    >>>>>>>>>>
    import java.awt.*;
    import java.applet.Applet;
    public class Phone extends Applet {
    private Image image;
    public void init() {
    setLayout(null);
    image = getImage(getDocumentBase(), "phone.jpg");}
    public void paint (Graphics g) {
    g.drawImage(image, 0, 0, 700, 530, this);
    PhoneButton myButton;
    myButton = new PhoneButton(20,20);
    >>>>>>>
    This is the second class....
    >>>>>>>
    public class PhoneButton {
    private Button butt;
    public PhoneButton(int a, int b, int c){
    setLayout(null);
    butt = new Button();
    butt.setBounds(a,b,20,20);
    add(butt);
    >>>>>>>>
    My compiler generates errors relating to Button, but i can't do anything to please it.
    Also, could anyone give me some pointers on how to add a different number or symbol to each button. That is what I added int c for, but i couldn't get it to work.
    Cheers in advance.
    Michael Morgan

    I found that there are 5 error in your code.
    1. You should import the "java.awt" package to the PhoneButton.java
    2. The PhoneButton is not a kind of Component. You cannot not add it to the Phone class
    3. the myButton = new PhoneButton(20, 20) does not provide enough parameters to create PhoneButton
    4. You cannot add a Button to a PhoneButton. Becaue the PhoneButton is not a kind of Container
    Fixed code:
    import java.awt.*;
    public class PhoneButton extends Button {
    public PhoneButton(int a, int b, int c){
         setBounds(a, b, 20, 20);
         setLabel(String.valueOf(c));
    ===========================================
    import java.awt.*;
    import java.applet.Applet;
    public class Phone extends Applet {
    private Image image;
    public void init() {
    setLayout(null);
    image = getImage(getDocumentBase(), "phone.jpg");}
    public void paint (Graphics g) {
    g.drawImage(image, 0, 0, 700, 530, this);
    PhoneButton myButton;
    myButton = new PhoneButton(20,20, 1);
    ======================
    Visual Paradigm for UML - Full Features UML CASE tool
    http://www.visual-paradigm.com/

  • Help with some html code for flash site!

    Got this site>
    http:/www.thedesignport.com
    Site works great! everything is uploaded! What I cant seem to
    get workning is the html code to add a description under the title
    of the website in a google search? Goto google enter "topanga
    mountain school" I'm top spot on the second page but with NO
    description?? have a look at the html code for
    http://www.thedesignport.com
    Have I gone wrong somewhere?? But I've found if you put
    "topanga mountain school pdf" into google ( I have three pdf's on
    the site) My site is Second on the search with a DESCRIPTION of the
    pdf's under the site name?? I dont get it?? Any help would be
    great!

    You're not getting any help here because this is the forum for discussions of the Community Help Client application and Help system in general. For CSS questions, you should probably try something like the Dreamweaver forum.

  • Help with unhappy beginner code...

    Hello Java gurus,
    I'm learning java and one of my class assignments is the old "mortgage calculator"... I made code up, compiled okay, but it won't execute. Gives me all sorts of errors. I THINK it's to do with the double vs int vs float... Please help!!! I've been playing with this and can't figure whats erroring. I know its prob something simple so please explain when you write back what I'm not understanding... Thank you! -nika
    Assignment:
    The monthly payment on mortgage loan of L dollars, at a rate of interest r is given by
    Monthly payment = []
    Where N is the number of years of mortgage. Write a program to find the monthly
    payment for 30 years, for principals from $100,000 through $200,000(with increments
    of $20,000) and interest rates of 6% through 10% (with increments of 0.5%). Print
    monthly payment as a whole number (rounded off).
    The output must be a neat table, similar to the following (your answers may be slightly
    different because of rounding off).
    Principal 6% 6.5% 7% 7.5% 8% 8.5% 9% 9.5% 10%
    100000 600 632 665 699 733 768 804 840 877
    120000 719 758 798 839 880 922 965 1009 1053
    140000 � � � � � � � � �
    160000 � � � � � � � � �
    180000 � � � � � � � � �
    200000 � � � � � � � � �
    Hint: Use the following idea to compute (1 + r/12)12N
    double temp = 1+r/12;
    double temp1 = 1;
    for (int i = 1; i<=12*N;i++)
    temp1 = temp1*temp;
    The final formula now becomes:
    double mp = (L*(r/12)*temp1)/(temp1-1);
    MY CODE:
    import java.util.*;
    class MortgagePmt {
    public static void main(String args[])     {
    int n = 30;     
    System.out.println("Mortgage Monthly Payment");
    System.out.println("Principal 6.0% 6.5% 7.0% 7.5% 8.0% 8.5% 9.0% 9.5% 10.0% ");
    for (int l = 100000; l<=200000; l=l+20000){
    System.out.printf("%9d ",l);
    for(double r = 6.0; r<=10.0; r=r+0.5){
    double temp = 1+r%12;
    double temp1 = 1;
    for (int i = 1; i<=12*n;i++)
    temp1 = temp1*temp;
    double mp = (l*(r%12)*(temp1))/(temp1 - 1);
    System.out.printf("%5.0f", mp);
    System.out.println("");
    }

    You really need to do an analysis on your algo... there is NO WAY that it is correct.
    MY CODE:
    import java.util.*;
    class MortgagePmt {
    public static void main(String args[])     {
    int n = 30;     
    System.out.println("Mortgage Monthly Payment");
    System.out.println("Principal 6.0% 6.5% 7.0% 7.5% 8.0% 8.5% 9.0% 9.5% 10.0% ");
    for (int l = 100000; l<=200000; l=l+20000){
    System.out.printf("%9d ",l);
    for(double r = 6.0; r<=10.0; r=r+0.5){
    double temp = 1+r%12;
    double temp1 = 1;What is this following little section for? temp1 comes out of there at 1.7x10^304... err, no way that is right. I do not believe there is that much anything in the world, let alone money.
    for (int i = 1; i<=12*n;i++)
    temp1 = temp1*temp;
    double mp = (l*(r%12)*(temp1))/(temp1 - 1);
    System.out.printf("%5.0f", mp);
    System.out.println("");
    }One of the best things you can do at this point, if it's not thee very best thing, is to get your debugger out and find out how to use it. Your code ran as you posted it, but your algorithm is not right and numbers you are calculating do not even make sense--all of them output as NaN (not a number). Take each feature of your assignment and code it 1 piece at a time tracing each seeing that the numbers you calculate make sense, and as you get that piece to work, move on to the next feature of your assignment. This way you don't write out a bunch of none tested code that you don't know what it is doing.
    Throwing out code that you think is a solution that you do not know what it does and have no hope of fixing is no better than no solution at all--IMO it is far worse: you'll work attempting to fix it, not knowing what it is doing and all the time all you are building is your frustration.
    (BTW: don't think I'm singling you out and speaking harshly to you--I've been there too. Sometimes it's better to just start over. Get a handle on what needs to be done. Get a working pencil and paper model, then describe the process in an algorithm, then code from that algorithm. Implement in steps and make sure each step works before moving on to the next. There is no magic in the computer--it won't make a bad process good--on the contrary it usually makes bad things worse, you have to design a good process first to implement a good process.)

  • Need help with some simple code

    Hi,
    I'm doing a lab for a class I'm taking and for the most part my code is working properly. It is supposed to accept inputs from the user of ints, doubles, or strings using the Scanner class until the user inputs "quit". It stores each input in array lists of class Integer, Double, and String. It the prints out each element of these in a list and quits the program. The problem is that after I query the user for input, if an int or double is input, the program then requires an input again before it will continue querying. So my question is how do I get it to query only once?
    The code and a copy of what it IS doing, and what it SHOULD do are shown below in bold.
    import java.util.ArrayList;
    import java.util.Scanner;
    import java.lang.Integer;
    import java.lang.Double;
    import java.lang.String;
    public class inputsort
    public static void main()
    int n = 0;
    boolean done = false;
    String quit;
    Scanner sc = new Scanner(System.in);
    ArrayList<Integer> intList = new ArrayList<Integer>();
    ArrayList<Double> doubList = new ArrayList<Double>();
    ArrayList<String> stringList = new ArrayList<String>();
    while(!done)
    System.out.print("Enter an int, double, any random text, or type quit to end: ");
    *if (sc.hasNextInt()){*
    intList.add(sc.nextInt());
    sc.next();
    *} else if (sc.hasNextDouble()){*
    doubList.add(sc.nextDouble());
    sc.next();
    *} else {*               
    quit = sc.next();
    *if (quit.equals("quit")) {*
    done = true;
    *else {*
    stringList.add(quit);
    System.out.println("Integers:");
    while(n < intList.size())
    System.out.print("Integer[" + n + "]: ");
    System.out.print(intList.get(n) + "\n");
    n += 1;
    n = 0;
    System.out.println("Doubles:");
    while(n < doubList.size())
    System.out.print("Double[" + n + "]: ");
    System.out.print(doubList.get(n) + "\n");
    n += 1;
    n = 0;
    System.out.println("Others:");
    while(n < stringList.size())
    System.out.print("Other[" + n + "]: ");
    System.out.print(stringList.get(n) + "\n");
    n += 1;
    Here's what it IS doing:
    Enter an int, double, any random text, or type quit to end: 10
    *10*
    Enter an int, double, any random text, or type quit to end: 1.2
    *1.2*
    Enter an int, double, any random text, or type quit to end: 3.4
    *3.4*
    Enter an int, double, any random text, or type quit to end: 5.6
    *5.6*
    Enter an int, double, any random text, or type quit to end: test
    Enter an int, double, any random text, or type quit to end: monkey
    Enter an int, double, any random text, or type quit to end: quit
    Integers:
    Integer[0]: 5
    Integer[1]: 10
    Doubles:
    Double[0]: 1.2
    Double[1]: 3.4
    Double[2]: 5.6
    Others:
    Other[0]: test
    Other[1]: monkey
    Here is what it SHOULD be doing:
    Enter an int, double, any random text, or type quit to end: 10
    Enter an int, double, any random text, or type quit to end: 1.2
    Enter an int, double, any random text, or type quit to end: 3.4
    Enter an int, double, any random text, or type quit to end: 5.6
    Enter an int, double, any random text, or type quit to end: test
    Enter an int, double, any random text, or type quit to end: monkey
    Enter an int, double, any random text, or type quit to end: quit
    Integers:
    Integer[0]: 5
    Integer[1]: 10
    Doubles:
    Double[0]: 1.2
    Double[1]: 3.4
    Double[2]: 5.6
    Others:
    Other[0]: test
    Other[1]: monkey
    Any help is greatly appreciated!!!
    Thanks!
    Edited by: sublimeph03nix on Jan 21, 2009 7:24 PM

    My professor told me to add sc.next(); because she said when you hit return its reads that in the scanner class too, so it's kinda to clear the buffer I think, I wasn't really sure. It changes nothing on the front end if I remove it.
    As for the thing, it wont let me edit for some reason.  I'll try again in a bit.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       

  • Help with some ABAP code

    I am trying to fill the quantity value if it is blank by looking for a record with the key and putting it's value in it.  the code is below but the part whee it says where order_qty > 0 is not working.  It just hops out even if it is.
    CLEAR: T_SCHED_DATA, T_QUANTITY_DATA.
      REFRESH: T_SCHED_DATA, T_QUANTITY_DATA.
      SELECT DOC_NUMBER S_ORD_ITEM SCHED_LINE DSDEL_DATE REQ_DATE ORDER_QTY
       INTO TABLE T_SCHED_DATA
       FROM /BIC/AZSCH_O5400
         FOR ALL ENTRIES IN DATA_PACKAGE
        WHERE
         DOC_NUMBER = DATA_PACKAGE-DOC_NUMBER AND
         S_ORD_ITEM = DATA_PACKAGE-S_ORD_ITEM AND
         SCHED_LINE = DATA_PACKAGE-SCHED_LINE.
      SELECT DOC_NUMBER S_ORD_ITEM SCHED_LINE DSDEL_DATE REQ_DATE ORDER_QTY
       INTO TABLE T_QUANTITY_DATA
       FROM /BIC/AZSCH_O5400
        FOR ALL ENTRIES IN T_SCHED_DATA
        WHERE
         DOC_NUMBER = T_SCHED_DATA-VBELN AND
         S_ORD_ITEM  = T_SCHED_DATA-POSNR.
      T_QUANTITY_DATA2[] = T_QUANTITY_DATA[].
      sort t_quantity_data2 by vbeln posnr SCHED_LINE
           ascending.
    sort t_quantity_data by vbeln posnr SCHED_LINE
           ascending.
      loop at T_QUANTITY_DATA into LF_DATA
        where order_qty > 0.
          loop at T_QUANTITY_DATA2 into LF_DATA2
          where
           vbeln = LF_DATA-VBELN AND
           posnr = LF_DATA-POSNR AND
           DSDEL_DATE = LF_DATA-DSDEL_DATE AND
           SCHED_LINE NE LF_DATA-SCHED_LINE and
           order_qty = 0.
            lf_data3 = lf_data2.
            move LF_DATA-order_qty to lf_data3-order_qty.
            append lf_data3 to T_QUANTITY_DATA3.
          endloop.
      endloop.

    loop at T_QUANTITY_DATA into LF_DATA
    where <b>order_qty > 0.</b> <b> " when this is greater than zero</b>
    loop at T_QUANTITY_DATA2 into LF_DATA2
    where
    vbeln = LF_DATA-VBELN AND
    posnr = LF_DATA-POSNR AND
    DSDEL_DATE = LF_DATA-DSDEL_DATE AND
    SCHED_LINE NE LF_DATA-SCHED_LINE and
    <b>order_qty = 0.</b>  <b>" how can it be zero here</b>
    lf_data3 = lf_data2.
    move LF_DATA-order_qty to lf_data3-order_qty.
    append lf_data3 to T_QUANTITY_DATA3.
    endloop.
    endloop.

  • Need help with a activation code for Adobe Acrobat X Standard for my PC,, Don't have older version serial numbers,  threw programs away,  only have Adobe Acrobat X Standard,  need a code to unlock program?

    Need help with a activation code for Adobe Acrobat X Standard for my PC, Don't have older Version of Adobe Acrobat 9, 8 or 7. 

    You don't need to install the older version, you only need the serial number from your original purchase. If you don't have them to hand, did you register? If so, they should be in your Adobe account. If not you really need to contact Adobe, though it isn't clear they will be able to do anything without some proof of purchase etc.

  • Help with HTML form code

    I need help on some HTML code if at all possible.
    What I am trying to do is set up a page that someone can
    enter their name address and email into a form and when they hit
    the submit button it automatically sends them a premade email of my
    choosing that I make prior and somehow maybe embeded into the html
    code to the address that they entered? I dont know if it is
    possible but I am sure it can be.
    Thank you in advance

    Actually, you could be subject to "abuse complaints", not
    "abuse".
    Murray --- ICQ 71997575
    Adobe Community Expert
    (If you *MUST* email me, don't LAUGH when you do so!)
    ==================
    http://www.dreamweavermx-templates.com
    - Template Triage!
    http://www.projectseven.com/go
    - DW FAQs, Tutorials & Resources
    http://www.dwfaq.com - DW FAQs,
    Tutorials & Resources
    http://www.macromedia.com/support/search/
    - Macromedia (MM) Technotes
    ==================
    "bregent" <[email protected]> wrote in
    message
    news:fb547q$b49$[email protected]..
    > >What I am trying to do is set up a page that someone
    can enter their name
    > address
    >
    > Sure, you can do it fairly easily with any scripting
    language. You need to
    > be
    > cautious about sending automated emails to anyone
    without first validating
    > that
    > they are the actual owners of the email address,
    otherwise you open your
    > site
    > up to abuse.
    >
    > >I dont know if it is possible but I am sure it can
    be.
    >
    > Huh?
    >

  • Help with basic ABAP code (merge internal tables, sort of...)

    Hello,
    Can someone please help write some basic code for a Basis guy with limited ABAP knowledge?
    Should be some easy points for an experienced ABAPer!
    I have identicaly structured internal tables I_A and I_B and I_C which have already been filled by function models I called.
    How will I code the following?:
    I want to read all the data of I_A into a new internal table I_MASTER (structured the same as I_A,I_B and I_C).
    Then I want to read I_B and:
    1)Update I_MASTER with NEW records
    2)Update existing records if the value of field MYFIELD in I_B is smaller than the value of MYFIELD in I_MASTER.
    Then I want to read I_C and:
    1)Update I_MASTER with NEW records
    2)Update existing records if the value of field MYFIELD in I_C is smaller than the value of MYFIELD in I_MASTER.
    Let me know if I can provide anymore information.
    Thanks in advance for you help!
    Adriaan
    Message was edited by: Adriaan
    Message was edited by: Adriaan

    Hi Adriaan ,
    I want to read all the data of I_A into a new internal table I_MASTER (structured the same as I_A,I_B and I_C).
    <b>i_master[] = i_a[] .</b>
    loop at i_b .
    read table i_master with key myfiled < i_b-myfield .
    if sy-subrc = 0 .
    append i_master from i_b .
    endif.
    endloop.
    loop at i_c .
    read table i_master with key myfiled < i_c-myfield .
    if sy-subrc = 0 .
    append i_master from i_c .
    endif.
    endloop.
    Let me know if this helped .
    Regards,
    Varun .
    Message was edited by: varun sonu

  • Want a complete migration guide to upgrade 11.1.0.7 to 11.2.0.3 database using DBUA..We are implementing R12.1.3 version and then have to migrate the default 11gR1 database to 11.2.0.3 version. Please help with some step by step docs

    Want a complete migration guide to upgrade 11.1.0.7 to 11.2.0.3 database using DBUA..We are implementing R12.1.3 version and then have to migrate the default 11gR1 database to 11.2.0.3 version. Please help with some step by step docs

    Upgrade to 11.2.0.3 -- Interoperability Notes Oracle EBS R12 with Oracle Database 11gR2 (11.2.0.3) (Doc ID 1585578.1)
    Upgrade to 11.2.0.4 (latest 11gR2 patchset certified with R12) -- Interoperability Notes EBS 12.0 and 12.1 with Database 11gR2 (Doc ID 1058763.1)
    Thanks,
    Hussein

  • HT3209 Purchased DVD in US for Cdn viewing. Digital download will not work in Cda or US? please help with new Digital code that will work

    Purchased DVD in US for Cdn viewing. Digital download will not work in Cda or US? please help with new Digital code that will work

    You will need to contact the movie studio that produced the DVD and ask if they can issue you a new code valid for Canada. Apple cannot help you, and everyone here in these forums is just a fellow user.
    Regards.

  • Help with some java login code

    hey,
    I am a new member but used to visit the site regularly. I am undergoing a java project and I cannot seem to get my head around how to code when users log in, there name must appear at the top of each page they visit.
    User enters name into a text box. Do I use getter and setter methods? any bit of help would be of some advantage to me.
    Thanks for your time and I'll help with anyone else who is stuck.

    if JSP or servlet use Session...
    if you are using frame you have to consider... which frame is a top parent. that top frame will have the set and get method.. for you to set and retrieve the user name.. bear in mind that different object will have different user...
    so you have to play fair game ...hehehehe :-)

  • Need help with adjusting Javascript code to work in Adobe Edge (Countdown)

    Hello
    Im a newbie when it comes to working with Javascript and Adobe Edge and need a bit of help with adjusting some javascript code to work with Adobe Edge. A friend of mine helped me with making this javascript code: Edit fiddle - JSFiddle
    Its a simple countdown which counts down to a certain time at a certain date. What I aim to do is to add this code as a trigger on a text-element called "countdown" (within a symbol called "count").
    I have tried to do this as the code is, but it does not work. Anyone have any suggestions?
    Thanks!
    Mvh,
    Øyvind Hermans

    Hello again
    I have stumbled upon a problem with these animations; They crash the browser after viewing them a little while, usually less than 30 seconds in.
    Is this problem also occuring when you watch the animations?
    Is the countdown-code to much for the browsers to handle?
    Thanks in advance for your answers.
    Sincerely,
    Øyvind Hermans

  • Help with some java work ... :(

    Hi, I was wondering can anyone here give me some help or show me the way with this programming assignment. This is my first week of programming in Java and is really struggling ...
    I already have some very useful help from some people on here but still have no luck.
    Below is what my assignment is about and what I've done so far, sorry if it's very basic but I'm trying my hardest.
    You are required to write a program in Java that can store the details of three books. Their details are
    Author
    Shelf location
    Availability
    The program should give each book a unique shelf location starting from 0001. The details should be entered from the keyboard. The program should, on request, be able to print the details of each book to the screen. The program should terminate on request. The program should first ask for a preset password to be given before continuing executing any operation described above
    public class Library {
    public static void main(String[] args) {
    String[][] books =
         { "Shelf Location", "Author   ", "Book Name     ", "Availability" },
    { "0001          ", "A. Smith ", "Hello World   ", "1           " },
    { "0002          ", "C. Jones ", "Goodbye World ", "0           " },
    { "0003          ", "D. Wan   ", "Whatever      ", "5           " }
    for (int i = 0; i < books.length; i++) {
         System.out.print(books[0] + " ");
    for (int j = 1; j < books[i].length; j++) {
         System.out.print(books[i][j] + " ");
         System.out.println();
    import java.io.*;
    public class Login2
    private static BufferedReader in;
    private static BufferedReader keyboard;
    public static void main(String[] args) throws IOException
    keyboard = new BufferedReader(
    new InputStreamReader(System.in));
    String input;
    boolean done = false;
    while (!done)
    System.out.print("Enter Password in UPPERCASE (QUIT to exit)");
    input = keyboard.readLine();
    if ((input.equals("LOGIN")) || (input.equalsIgnoreCase("QUIT")))
    done =
    true;
    return.Library();
    I was told to use cases, instances, etc ... nothing complicated is needed but it is still to much for me. I saw some examples of people's work and they only have approx 1.5 pages of code.
    Thanx very much for people who reads this thread and offers me help.

    Here's something to play around with (minimal error handling)
    import java.io.*;
    class Library
      private final String password = "java";
      BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
      private String books[][] = new String[3000][];
      int bookTotal = 0;
      public Library() throws IOException
        options();
      private void options() throws IOException
        System.out.print("\nLibrary Options - \n0 - quit\n1 - Enter book details"+
              "\n2 - List book details\n\nPlease enter selection number: ");
        int selection = Integer.parseInt(br.readLine());
        if(selection == 0) goodBye();
        else
          checkPassword();
          if(selection == 1) newBook();
          else listBook();
      private void newBook() throws IOException
        String another="";
        do
          if(bookTotal == books.length)
            System.out.println("Unable to add more books");
            return;
          books[bookTotal] = new String[4];
          System.out.print("\nEnter title details: ");
          books[bookTotal][0] = br.readLine();
          System.out.print("Enter author details: ");
          books[bookTotal][1] = br.readLine();
          System.out.print("Enter shelf location details: ");
          books[bookTotal][2] = br.readLine();
          System.out.print("\n0 - out of stock\n1 - available\n2 - on loan"+
                                           "\nEnter availability details: ");
          books[bookTotal][3] = br.readLine();
          bookTotal++;
          System.out.print("\nEnter another book? (y/n): ");
          another = br.readLine();
        }while(another.toLowerCase().equals("y"));
        options();
      private void listBook() throws IOException
        String another="";
        String titles = "\n";
        String availability[] = {"out of stock","available","on loan"};
        for(int i=0;i<bookTotal;i++) titles += (i+1)+" - "+books[0]+"\n";
    int selection = 0;
    if(bookTotal > 0)
    do
    System.out.print(titles+ "Please enter selection number: ");
    selection = Integer.parseInt(br.readLine()) - 1;
    System.out.println("\nBook title = "+books[selection][0]);
    System.out.println("Book author = "+books[selection][1]);
    System.out.println("Book shelf location = "+books[selection][2]);
    System.out.println("Availability = "+availability[Integer.parseInt(books[selection][3])]);
    System.out.print("\nList another book? (y/n): ");
    another = br.readLine();
    }while(another.toLowerCase().equals("y"));
    else System.out.println("\nno books to list\n");
    options();
    private void goodBye()
    System.out.println("\nThank you for using the Library program.\nGoodbye.\n");
    System.exit(0);
    private void checkPassword() throws IOException
    System.out.print("\nEnter password to continue: ");
    String pwd = br.readLine();
    if(!pwd.equals(password)) goodBye();
    public static void main(String args[]) throws IOException
    new Library();

  • Need Help With Simple ABAP Code

    Hello,
    I'm loading data from a DSO (ZDTBMAJ) to an Infocube (ZCBRAD06). I need help with ABAP code to some of the logic in Start Routine. DSO has 2 fields: ZOCTDLINX & ZOCBRDMAJ.
    1. Need to populate ZOCPRODCD & ZOCREFNUM fields in Infocube:
        Logic:-
        Lookup /BI0/PMATERIAL, if /BIC/ZOCBRDMAJ = /BIC/OIZOCBRDMAJ
        then /BIC/ZOCPRODCD = ZOCPRODCD in Infocube
               /BIC/ZOCREFNUM = ZOCREFNUM in Infocube         
    2. Need to populate 0G_CWWTER field in Infocube:
        Logic:
        Lookup /BIC/PZOCTDLINX, if /BIC/ZOCTDLINX = BIC/OIZOCTDLINX
        then G_CWWTER = 0G_CWWTER in Infocube.
    I would need to read single row at a time.
    Thanks!

    I resolved it.

Maybe you are looking for

  • I had to reformat my computer and now itunes won't recognize my iphone. How can I fix this?

    I had to reformat my computer and now itunes won't recognize my iphone. How can I fix this?

  • Crashed during install

    help, I've lost everything...I was in the process of installing, it said the drive where boot camp was installed was locked, then it crashed, when it restarted it restarted in Windows7 mode and now I can't get back to the Lion install.....I have no i

  • Implementing E-Recruitment

    We are currently on using SAP HR only on release 4.7 and are looking to implement E-Recruiting.  We do not plan to upgrade in the near future. We had a site visit from an SAP Consultant who recommended we implement the E-Recruitment 6.0 on an ERP2005

  • Why is Photoshop CS4 so slow?

    Hi, I know there's probably a lot of talk on this - there is doing google searches. I recently upgraded to CS4. All other programs are great (ID, DW, etc.) but Photoshop... I'm ready to go back to Photoshop CS3. When I turn the guides on and off it l

  • Composing of DVD - Start to Finish

    We are marketing a new DVD for one of our clients, this project requires editing footages for a sermonize held in Australia, I only have a master copy from a DVD. We want to sell the production in our retail store, so I need to import, edit, export a