>   Aircraft Calculations.exe!WindowsApplication1.Aircraft.CalculateTakeOff1() Line 14  Basic
    Aircraft Calculations.exe!WindowsApplication1.DePlane.btnGo_Click(Object sender = {Text = "GO!"}, System.EventArgs e = {X = 34 Y = 11 Button = MouseButtons.Left}) Line 11 + 0xa bytes  Basic
    [External Code] 

These are the error codes I am getting.

Alright so essentially I need to create a class that houses the methods and then call the methods in the form but I can't seem to find out what the right code is to call it. I think there may be an issue with the conversion from a double to a string.

This is what I have for the Class

Public Class Aircraft
    Dim Names() As String = {"A-747", "A-737", "C-150", "D-240"}
    Dim TakeOffVelocity() As Double = {250, 264, 270, 240}
    Dim Acceleration() As Double = {33.5, 44.2, 37.1, 51.9}

    Sub CalculateTakeOff1()
        Dim time1 As Double = TakeOffVelocity(0)
        Dim accel1 As Double = Acceleration(0)
        Dim TakeOffTime1 As Double = time1 / accel1

        Dim TakeOffDistance1 As Double = accel1 * time1

        Dim takeOffA747 As String = ("The A-747 Aircraft has a required takeoff velocity of " + time1 +
                                     " ft/second and an acceleration constant of " + accel1 +
                                     ". Therefore, it requires " + TakeOffTime1 +
                                     " seconds to take off, with a distance of " + TakeOffDistance1 + " feet.")
        MsgBox("The A-747 Aircraft has a required takeoff velocity of " + time1 +
                                     " ft/second and an acceleration constant of " + accel1 +
                                     ". Therefore, it requires " + TakeOffTime1 +
                                     " seconds to take off, with a distance of " + TakeOffDistance1 + " feet.")
    End Sub
    Sub CalculateTakeOff2()
        Dim time2 As Double = TakeOffVelocity(1)
        Dim accel2 As Double = Acceleration(1)
        Dim TakeOffTime2 As Double = time2 / accel2

        Dim TakeOffDistance2 As Double = accel2 * ...

I am concerned about this particular part of the code. I am not sure why the bracket prior to your main method is there.

{
public static void main(String[] args) throws IOException 
{
    int loop=0;
    while(loop<3)
    {

This could certainly be throwing some errors.

Great! Thanks all. This is very helpful. And yes I see the issue with doing so many if statements much easier to use a checkbox array. Thanks for the help.

Okay this is what I am doing now.

[CODE]
import javax.swing.;
import java.awt.event.
;
import java.awt.*;

public class JLottery2 extends JFrame implements ItemListener
{
//instantiate constants
final int HIGHEST_VAL = 30;
final int LOWEST_VAL = 1;
final int BOXES_CHECKED = 6;
final int WIDE = 400;
final int TALL = 400;

//set random number generator
int numR = ((int) (Math.random() * 100) % HIGHEST_VAL + LOWEST_VAL);
int numR2 = ((int) (Math.random() * 100) % HIGHEST_VAL + LOWEST_VAL);
int numR3 = ((int) (Math.random() * 100) % HIGHEST_VAL + LOWEST_VAL);
int numR4 = ((int) (Math.random() * 100) % HIGHEST_VAL + LOWEST_VAL);
int numR5 = ((int) (Math.random() * 100) % HIGHEST_VAL + LOWEST_VAL);
int numR6 = ((int) (Math.random() * 100) % HIGHEST_VAL + LOWEST_VAL);

//instantiate new checkboxes
    JCheckBox box1 = new JCheckBox("1");
    JCheckBox box2 = new JCheckBox("2");
    JCheckBox box3 = new JCheckBox("3");
    JCheckBox box4 = new JCheckBox("4");
    JCheckBox box5 = new JCheckBox("5");
    JCheckBox box6 = new JCheckBox("6");
    JCheckBox box7 = new JCheckBox("7");
    JCheckBox box8 = new JCheckBox("8");
    JCheckBox box9 = new JCheckBox("9");
    JCheckBox box10 = new JCheckBox("10");
    JCheckBox box11 = new JCheckBox("11");
    JCheckBox box12 = new JCheckBox("12");
    JCheckBox box13 = new JCheckBox("13");
    JCheckBox box14 = new JCheckBox("14");
    JCheckBox box15 = new JCheckBox("15");
    JCheckBox box16 = new JCheckBox("16");
    JCheckBox box17 = new JCheckBox("17");
    JCheckBox box18 = new JCheckBox("18");
    JCheckBox box19 = new JCheckBox("19");
    JCheckBox box20 = new JCheckBox("20");
    JCheckBox box21 = new JCheckBox("21");
    JCheckBox box22 = new JCheckBox("22");
    JCheckBox box23 = new JCheckBox("23");
    JCheckBox box24 = new JCheckBox("24");
    JCheckBox box25 = new JCheckBox("25");
    JCheckBox box26 ...

This in particular is what I am trying to do."Allow the user to choose six check boxes to play the game. (Do not allow the user to choose more than six boxes.)" I am not certain how to implement this rule.

I understand using a loop to limit the number of random numbers, I had just created several number generators so i will be adjusting it to use the loop thank you.

Awesome guys thanks! I got it working using the double.TryParse method, appreciate the help!

[QUOTE=phoenix911;1737304]You could consider using a Masked Textbox. And then setting each masked textbox accordingly

your currency mask would something like this

[CODE]$0000.00[/CODE]

you can put however many zeros infront/behind. 0 means only numbers are allowed to be inputted.
and of course the period separates the dollars from the cents

Using masked textboxes makes things a lot easier/simpler[/QUOTE]

This is super helpful. Only one problem, what is a masked text box? Sorry very new to C# still not sure of all the jargon.

[QUOTE=stultuske;1737296]setCount to zero
while setCount < 6
{
add lotteryNumber
add 1 to setCount
}[/QUOTE]

When you say add lotteryNumber are you mapping this to anything else? I can see how this would create a loop no greater than 6 but I am not seeing how it limits the users choice of check box. Please elaborate. Thanks!

Okay so I am creating a windows form to basically act as a bank ledger for an individual. Pretty simple they must enter the account information, and a beginning balance. The key is the validation, it is really tripping me up. I need to ensure that upon clicking the continue button the textboxes are validated, the first should only be alphabetical components while the second two should only be numeric components. Additionally the last box must also be numeric only. Doubles are okay, it is currency after all. My code is below.

[CODE]using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace WindowsFormsApplication1
{
public partial class BankInfo : Form
{
double withdrawal;
double deposit;
double balance;
double newTotal;

    public BankInfo()
    {
        InitializeComponent();
    }

    private void txtAcctBegBal_Validating(object sender, CancelEventArgs e)
    {
        try
        {
            int numberEntered = int.Parse(txtAcctBegBal.Text);
            if (numberEntered == 0)
            {
                e.Cancel = true;
                MessageBox.Show("Please enter an amount greater than 0.");
            }
        }
        catch (FormatException)
        {
            e.Cancel = true;
            MessageBox.Show("You need to enter an integer");
        }
    }

    private void btnAcctInfo_Click(object sender, EventArgs e)
    {
        grpAcctInfo.Visible = true;
        txtAcctName.Visible = true;
        txtAcctNum.Visible = true;
        txtAcctBegBal.Visible = true;
        lblAcctName.Visible = true;
        lblAcctNum.Visible = true;
        lblBeginning.Visible = true;
        btnCnt.Visible = true;
    }

    private void btnCnt_Click(object sender, EventArgs e)
    {
            txtAmt.Visible = true;
            btnWithDraw.Visible = true;
            btnDeposit.Visible = true;
            lblAvailable.Visible = true;
            lblBeginning.Visible = false;
    }

    private void btnClear_Click(object sender, EventArgs e)
    {
        grpAcctInfo.Visible = false;
        txtAcctName.Visible = false;
        txtAcctNum.Visible = false;
        txtAcctBegBal.Visible = false;
        lblAcctName.Visible ...

Here is my assignment: In Chapter 5, you created a lottery game application. Create a similar game using check boxes. For this game, generate six random numbers, each between 0 and 30 inclusive. Allow the user to choose six check boxes to play the game. [B][U](Do not allow the user to choose more than six boxes.)[/U][/B] After the player has chosen six numbers, display the randomly selected numbers, the player ’ s numbers, and the amount of money the user has won, as follows: Matching Numbers Three matches Four matches Five matches Six matches Zero, one, or two matches Award ($) 100 10,000 50,000 1,000,000 0

Additional requirements are as follows:
• Add a menu bar to the program with a File menu.
• In the File menu, add a submenu (JMenuItem) called About.
• When the user clicks on the About menu item, display a
JOptionPane message dialog that contains your name, your
course, the section number, and MEID.

The primary issue I am having is with the limiting of checkboxes, I cannot seem to find examples of this in the text or anywhere online (except in javascript and html, which obviously do not help me here.) I have posted my code below. Please note that I am only looking for answers to the limit on check boxes at the moment the rest of the code I can complete myself.

[CODE]
import javax.swing.;
import java.awt.event.
;
import java.awt.*;

public class JLottery2 extends JFrame implements ActionListener
{
//instantiate constants
final int ...

Apparently I didn't give it enough tries. The first number it randomly picked twice in a row was 0. Then I tested again and it picked 8, then 58. So it appears to be working properly, thanks so much for your help!

I am still getting an error in the code, it appears that

[CODE] public partial class Form1 : Form
{
int range;

    //create the form
    public Form1()
    {
        InitializeComponent();

        //initialize the random number generator
        Random num = new Random();

        //set random number parameters
        range = num.Next(0, 100);
    }[/CODE]

is where the issue is at, the variable "range" is retaining its value of "0" and it is not getting re-assigned by the random number.

[QUOTE=cOrRuPtG3n3t!x;1735886]specSelect should be only used to store the index at which the name/job title was found, and this would be 'x' in the for loop and not as you did Names[specSelect] and Titles[specSelect]...if you dont use 'x' you will never transverse between the indexes of the arrays, have a look at my previous post.[/QUOTE]

Right that is what I did, that is what brought the additional errors.

Also @Norm, I changed it to 0 and you are correct it comes up as only Maxwell Rudolph, this does not work for me. I need it to pull the title for whatever name has been entered.

My assignment is as follows: Create a higher/lower guessing game using a graphical user interface. allow users to keep guessing until they guess the number. Choose two colors for the game: one should be used to indicate that the value the users guessed is higher than the target; the other is used to indicate the the value the users guesed is lower than the target. With each new guess, change the form color based on whether the guess is higher than the target or lower. Keep a count of the number of guesses it took. when they hit the target display a MessageBox indicating the number of guesses it took. Several approaches can be used to seed the target: one is to generate a random number by the constructing an object of the Randomclass. For example the following stores a random whole number between 0 and 100 in target

Random r = new Random();
int target = r.Next(0,100);

I seem to be having an issue with the "if" statements.

[CODE]using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace GuessingGame
{
public partial class Form1 : Form
{
//create the form
public Form1()
{
InitializeComponent();
}

    //create the button for the random generator
    private void btnBegin_Click(object sender, EventArgs e)
    {
        //initialize the random number generator
        Random num = new Random();

        //set random number parameters
        int range = num.Next(0, 100);

        //initialize variables
        int guess;
        guess = int.Parse(txtBox1.Text);

        //parameters to show higher or lower
        if ...

[QUOTE=cOrRuPtG3n3t!x;1735871]look here:
[code]
//for loop to run the array pull
for (int x = 0; x < numberOfItems; ++x)
{
if (arrayNum.equals(Names[specSelect]))
{
validItem = true;
jobTitleLabel.setText(Title[specSelect]);
}
else
{
jobTitleLabel.setText("Person is not found.");
}
}[/code]

you should have this or similar:
[code] //for loop to run the array pull
for (int x = 0; x < numberOfItems; ++x)
{
if (arrayNum.equals(Names[x]))
{
validItem = true;
jobTitleLabel.setText(Title[x]);
specSelect=x;
}
else
{
jobTitleLabel.setText("Person is not found.");
}
}[/code]
elect is set to -1 and in the for loop you are declaring the integer x to be increased as the for loop iterates. so the Names and Titles will have to use the x value in order to iterate through all the possible values, the specSelect will be used to store the index value at which the name of the person and their job title was found... and then it will be used to display is later by:
[code]
jobTitleLabel.setText("The job title of " + Names[specSelect] + "is " + Title[specSelect]);[/code][/QUOTE]

I did this and it returned a whole new slew of errors:

[CODE]run:
Exception in thread "AWT-EventQueue-1" java.lang.ArrayIndexOutOfBoundsException: -1
at JEmployeeTitle.actionPerformed(JEmployeeTitle.java:87)
at javax.swing.JTextField.fireActionPerformed(JTextField.java:492)
at javax.swing.JTextField.postActionEvent(JTextField.java:705)
at javax.swing.JTextField$NotifyAction.actionPerformed(JTextField.java:820)
at javax.swing.SwingUtilities.notifyAction(SwingUtilities.java:1636)
at javax.swing.JComponent.processKeyBinding(JComponent.java:2849)
at javax.swing.JComponent.processKeyBindings(JComponent.java:2884)
at javax.swing.JComponent.processKeyEvent(JComponent.java:2812)
at java.awt.Component.processEvent(Component.java:5911)
at java.awt.Container.processEvent(Container.java:2023)
at java.awt.Component.dispatchEventImpl(Component.java:4501)
at java.awt.Container.dispatchEventImpl(Container.java:2081)
at java.awt.Component.dispatchEvent(Component.java:4331)
at java.awt.KeyboardFocusManager.redispatchEvent(KeyboardFocusManager.java:1848)
at java.awt.DefaultKeyboardFocusManager.dispatchKeyEvent(DefaultKeyboardFocusManager.java:704)
at java.awt.DefaultKeyboardFocusManager.preDispatchKeyEvent(DefaultKeyboardFocusManager.java:969)
at java.awt.DefaultKeyboardFocusManager.typeAheadAssertions(DefaultKeyboardFocusManager.java:841)
at java.awt.DefaultKeyboardFocusManager.dispatchEvent(DefaultKeyboardFocusManager.java:668)
at java.awt.Component.dispatchEventImpl(Component.java:4373)
at java.awt.Container.dispatchEventImpl(Container.java:2081)
at java.awt.Component.dispatchEvent(Component.java:4331)
at java.awt.EventQueue.dispatchEvent(EventQueue.java:599)
at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:269)
at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:184)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:174)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:169)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:161)
at java.awt.EventDispatchThread.run(EventDispatchThread.java:122)
Exception in thread "AWT-EventQueue-1" java.lang.ArrayIndexOutOfBoundsException: -1 ...

[QUOTE=NormR1;1735870]The error says that -1 is NOT a valid index for an array.
You need to select an index between 0 and the length of the array -1.

Which element in the arrays do you want to display?
Should there be separate indexes for the names array and for the title array?
One to chose the person's name, the other to chose his title.[/QUOTE]

The Array needs to display only one name and the title from the parallel array.

So when someone enters the name (ie. David Morand) it displays the title from the title array of Customer Service Associate.

The error I am receiving from the NetBeans compiler is this:

[CODE]run:
java.lang.ArrayIndexOutOfBoundsException: -1
at JEmployeeTitle.init(JEmployeeTitle.java:48)
at sun.applet.AppletPanel.run(AppletPanel.java:424)
at java.lang.Thread.run(Thread.java:619)
BUILD SUCCESSFUL (total time: 6 seconds)[/CODE]

[CODE]//Author Dave Morand
//Description Assignment for CIS263AA
//Date 14 January 2012
import javax.swing.;
import java.awt.
;
import java.awt.event.*;

public class JEmployeeTitle extends JApplet implements ActionListener
{
//initialize arrays
String[] Names = {"Maxwell Rudolph", "David Morand", "Andrew Turner", "Andrew Lacquiere", "Joseph Go",
"Ron Kallam", "Tracy Kallam", "Kaylee Morand", "Cindy Morand", "Tim Morand"};
String[] Title = {"Customer Solutions Supervisor", "Customer Service Associate", "Customer Service Associate",
"Technical Support Associate", "Technical Support Associate", "QA Supervisor", "VP of Operations", "Daughter",
"Teacher", "Program Analyst"};

//create labels
JLabel fullNameLabel = new JLabel("Please enter your first and last name separated by a space");
JLabel nameDescription = new JLabel("Your Name");
JLabel jobTitleLabel = new JLabel("");

//set font
Font mainFont = new Font("Times New Roman", Font.PLAIN, 14);

//create text fields
JTextField fullNameText = new JTextField(25);
JTextField jobTitleText = new JTextField(15);

//create button
JButton findTitle = new JButton("Find the title");

//set container
Container con = getContentPane();

int specSelect = -1;

@Override
public void init() 
{
    //set parameters for pulling from the array
    final int numberOfItems = 10;
    String arrayNum = "";
    boolean validItem;

    //for loop to run the array pull
    for (int x = 0; x < numberOfItems; ++x) 
    {
        if (arrayNum.equals(Names[specSelect])) 
        {
            validItem = true;
            jobTitleLabel.setText(Title[specSelect]);
        }
        else
        {
            jobTitleLabel.setText("Person is not found.");
        }
    }

    //set fonts for labels
    fullNameLabel.setFont(mainFont);
    nameDescription.setFont(mainFont);
    jobTitleLabel.setFont(mainFont);

    //add labels to the container
    con.add(fullNameLabel);
    con.add(fullNameText);
    con.add(jobTitleText);
    con.add(findTitle);

    //set the layout for the container
    con.setLayout(new FlowLayout());

    //event handling
    findTitle.addActionListener(this);
    fullNameText.addActionListener(this);
    jobTitleText.addActionListener(this);
}

@Override
public void actionPerformed(ActionEvent e) 
{
    //set action to be taken upon button click
    String name ...

[QUOTE=NormR1;1735817]The values you are seeing:[Ljava.lang.String;@defa1ais [Ljava.lang.String;@f5da06 are the Strings returned by the default toString method for String arrays. If you want to see the full contents of the arrays, you could use the Arrays class's toString() method to format it.

If you only want to see one element from the array, you need to use an index (enclosed in [])[/QUOTE]

So on line 81:

[CODE]jobTitleText.setText("The job title of " + Names.toString() + "is " + Title.toString());[/CODE]

If I want it to display the entire array. How do I write it with an index, when I tried:

[CODE]jobTitleText.setText("The job title of " + Names[x] + "is " + Title[x]);[/CODE]

I received syntax errors.

My assignment is as follows: Create aJApplet that contains twoJTextFields, aJButton, and threeJLabels. When the user types an employee’ s first and last names (separated by a space) in a JTextField, the employee ’ s job title is displayed in a secondJTextField. Include two JLabels to describe theJTextFields used for data entry, and include a third JLabel that holds the employee ’ s title or an error message if no match is found for the employee. Use parallel arrays to store the employees ’ names and job titles. Save the file as JEmployeeTitle.java

I have having an issue specifically with the output of this code, everything compiles correctly, and the only issue I seem to be having is with the output of the name and title in line 81, I believe it is. Any help is appreciated.

[CODE]import javax.swing.;
import java.awt.
;
import java.awt.event.*;

public class JEmployeeTitle extends JApplet implements ActionListener
{
//initialize arrays
String[] Names = {"Maxwell Rudolph", "David Morand", "Andrew Turner", "Andrew Lacquiere", "Joseph Go",
"Ron Kallam", "Tracy Kallam", "Kaylee Morand", "Cindy Morand", "Tim Morand"};
String[] Title = {"Customer Solutions Supervisor", "Customer Service Associate", "Customer Service Associate",
"Technical Support Associate", "Technical Support Associate", "QA Supervisor", "VP of Operations", "Daughter",
"Teacher", "Program Analyst"};

//create labels
JLabel fullNameLabel = new JLabel("Please enter your first and last name separated by a space");
JLabel nameDescription = new JLabel("Your Name");
JLabel jobTitleLabel = new JLabel("");

//set font
Font mainFont = new Font("Times New Roman", Font.PLAIN, 14);

//create text fields
JTextField fullNameText = new JTextField(25); ...

[QUOTE=WDrago;1714215]That's exactly what is going to happen. You forgot to update numValue inside the while loop. It's stuck at the first value that entered before the loop. Also, the while loop is going to run as long as numValue is between 10 and 50. You need a NOT (!) before your evaluation expression (e.g. !(x==y))

In your case:[CODE]!((numValue >= 10) && (numValue <= 50))[/CODE]

BTW, you can improve this code by eliminating the out-of-loop entry of the first value by using do..while.[CODE]do
{
prompt user for input
convert to int32
} while (user input not between 10 and 50 )[/CODE]

Good luck,
Bill[/QUOTE]

PERFECT! Thank you. I will update this.

Okay I have created a validation loop which addresses the user entering a number between 10 and 50, as long as it is within these parameters it is supposed to ask for another number. When it is out of these parameters the program should let the user know it is outside the parameter and end the process. Below is what I have written, not sure where I went wrong as it always says it is a valid number, as long as the first number is valid.

[CODE]using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace Validator
{
class Validator
{
public static void Main(string[] args)
{
//initialize variables
String userInput = "";
int userInfo = 0, intValue;

        //provide instructions to the user
        Console.WriteLine("Please enter a value between 10 and 50:");

        //start the read process
        userInput = Console.ReadLine();

        //parse the user input
        int numValue;
        bool parsed = Int32.TryParse(userInput, out numValue);

        //while loop parameters
        while ((numValue >= 10) && (numValue <= 50))
        {
            intValue = Convert.ToInt32(userInfo);
            userInfo += intValue;
            Console.WriteLine("Your Number is within the parameters, enter another number.");
            userInput = Console.ReadLine();
        }

        //end of program lines printed once number is outside the range
        Console.WriteLine("The Number you have entered is outside the parameters");
        Console.Read();
    }
}

}
[/CODE]

Any assistance is appreciated, thanks.

Alright I have a school assignment I had to create a loop to accept grade percentages from 0 to 100 and it needs to give the average percentage and letter grade, this is what I have but it is not working correctly, it always gives an F and no percentage.

[CODE]using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace Grader
{
class Grader
{
public static void Main(string[] args)
{
//initialize variable
String userInput = "";
int addedGrades = 0, intValue;

        //give instructions to the user
        Console.WriteLine("Please enter your student's grades.");
        Console.WriteLine("\nOnce you have finished enter -100 to stop.");
        Console.WriteLine("\nEnter -100 to exit the program");

        //starts the read process
        userInput = Console.ReadLine();  

        //while loop parameters
        while (userInput != "-100")
        {
            intValue = Convert.ToInt32(addedGrades);
            addedGrades += intValue;
            Console.WriteLine("Enter -100 to exit");
            userInput = Console.ReadLine();
        }

        //create if statements to determine letter grade
        int averageGrades = addedGrades / 100;
            if ((averageGrades >= 0) && (averageGrades <= 59))
            {
                Console.WriteLine("Total grade = F");
                Console.WriteLine("Total percent = ", averageGrades);
            }
            else
                if ((averageGrades >= 60) && (averageGrades <= 69))
                {
                    Console.WriteLine("Total grade = D");
                    Console.WriteLine("Total percent = ", averageGrades);
                }
                else
                    if ((averageGrades >= 70) && (averageGrades <= 79))
                    {
                        Console.WriteLine("Total grade = C");
                        Console.WriteLine("Total percent = ", averageGrades);
                    }
                    else
                        if ((averageGrades >= 80) && (averageGrades <= 89))
                        {
                            Console.WriteLine("Total grade = B");
                            Console.WriteLine("Total percent = ", averageGrades);
                        }
                        else
                            Console.WriteLine("Total Grade = A");
                            Console.WriteLine("Total percent = ", averageGrades);
        Console.Read();
    }

}

}
[/CODE]

Any help is appreciated. Thanks.

Thanks! That did it. It appears I also had initiated [CODE] private int tvChannel = 0;
private String showDay = "";
private String showName = "";[/CODE]this twice. Once I removed the extra code and added the [CODE] myShowArray[d] = new TVShow(...);[/CODE] line it works wonderfully! Thank you so much!

[CODE]run:
Exception in thread "main" java.lang.ArrayIndexOutOfBoundsException: 5
at UseTVShow.main(UseTVShow.java:16)
Java Result: 1
BUILD SUCCESSFUL (total time: 6 seconds)[/CODE] This is the output I am receiving, though I have to be honest I don't understand what it means.

[CODE]import javax.swing.*;

public class UseTVShow
{
public static void main(String[] args)
{
final int TV_MAX = 5;
int d;
TVShow[] myShowArray = new TVShow[TV_MAX];
String tvInput = "";
for(d = 0; d < TV_MAX; ++d)
tvInput = JOptionPane.showInputDialog(null, "Please enter a television show: ");
myShowArray[d].setShowName(tvInput);
myShowArray[d].setDay("Monday");
myShowArray[d].setTVChannel(1 + d);
JOptionPane.showMessageDialog(null, "Show: " + myShowArray[d].getShowName()

  • " airs on " + myShowArray[d].getDay() + "'s on channel "
  • myShowArray[d].getTVChannel());
    }
    }[/CODE] This is what I have written to try and display the data. Specifically the [CODE]JOptionPane.showMessageDialog(null, "Show: " + myShowArray[d].getShowName()
  • " airs on " + myShowArray[d].getDay() + "'s on channel "
  • myShowArray[d].getTVChannel());[/CODE] section of the code. Any thoughts?

What I did was removed the additional [code] for(int d = 0; d < TV_MAX; ++d) [/code] loops and then moved the JOptionPane line into the loop. So it allows me now to enter the television shows 5 different times. What is happening now though is they are being stored in the array I created in the TVShow.java class and I do not know how to make them display even with the println method. What I need to know is how to call the [CODE]public void setDisplay()
{
JOptionPane.showMessageDialog(null, showName + " is on " + showDay + "'s, "

  • "on channel " + tvChannel);
    } [/CODE] from the TVShow.java class into the main method and display it. Does that make sense?

the modifications I made to the Main method, have allowed me now to enter more than 1 TV show, but even when using the System.out.println(text here blah blah blah); method I am unable to see what has been stored in the array.

Update to the code on the Main method useTVShow.java

[code]import javax.swing.*;

public class UseTVShow
{
public static void main(String[] args)
{
final int TV_MAX = 5;
int d;
TVShow[] myShowArray = new TVShow[TV_MAX];
String tvInput = "";
for(d = 0; d < TV_MAX; ++d)
tvInput = JOptionPane.showInputDialog(null, "Please enter a television show: ");
myShowArray[d].setShowName(tvInput);
myShowArray[d].setDay("Monday");
myShowArray[d].setTVChannel(1 + d);
JOptionPane.showMessageDialog(null, "Show: " + myShowArray[d].getShowName()

  • " airs on " + myShowArray[d].getDay() + "'s on channel "
  • myShowArray[d].getTVChannel());
    }
    }[/code]