Advertisement
Help Keep Boards Alive. Support us by going ad free today. See here: https://subscriptions.boards.ie/.
If we do not hit our goal we will be forced to close the site.

Current status: https://keepboardsalive.com/

Annual subs are best for most impact. If you are still undecided on going Ad Free - you can also donate using the Paypal Donate option. All contribution helps. Thank you.
https://www.boards.ie/group/1878-subscribers-forum

Private Group for paid up members of Boards.ie. Join the club.

Java program

  • 18-10-2007 04:25PM
    #1
    Closed Accounts Posts: 11


    Please, could somebody help me here. I'm crap at Java and need to write out this simple enough progam for college. Needs to be in tomorrow and have spent ages trying to do it but it's still wrong, too many errors, won't compile, etc. Meant to be using a method in it but just can't do this program. Any sort of help at all would be appreciated!

    Capture information relating to your CD collection

    Prompt for number of CD's that you are going to enter
    use JOptionPane to collect data

    Loop correct number of times to collect the details of each CD from the user
    use JOptionPane to collect data

    Perform simple error checking on input
    E.g. check that the user input something
    Populate 3 arrays with the information collected

    CD collection
    Artist
    Title
    Year

    Display the CD collection back to the user
    format output
    one row per CD

    Use both System.out.println and JOptionPane to display output


Comments

  • Registered Users, Registered Users 2 Posts: 271 ✭✭homerjk


    What have you got so far?
    Where are breaking down? (What is the error that is blocking you?)

    Also, you should really post this or get it moved to the Programming board.


  • Closed Accounts Posts: 11 irishgem


    Ok, well if I show you what I have, you will laugh but will show anyway as will demonstrate how bad I am and that haven't a clue!!! I don't have any methods. Have the arrays wrong etc

    importjavaswing.JOptionPane ; */
    public class Music
    {


    public static void main(String[] args)
    {
    int numEnter;

    String [] artist ={"Bob Marley", "Pink Floyd", "Bob Dylan", "The Doors, ", "Therapy?"};
    String [] title ={"No woman no cry", "Wish You were Here", "The Alabama Song", "All Over You", "Screamager"};
    int[]year ={1975,1975,1967,1962,1992};

    JOptionPane.showinputDialog ("Enter a number between 1 and 5");
    for(int i=0;i<5; i++)

    System.out.println( "Artist is" + artist, "Title is" + title, "Year is" + year);
    JOptionPane.showMessageDialog(null, "Artist is" + artist, "Title is" + title, "Year is" + year, JOptionPane.INFORMATION_MESSAGE);
    }


This discussion has been closed.
Advertisement