Man, this has been the worst week I've had in a long time. I really can't focus to do this project. But I figure if I can get a little push forward that might get my mind going. I'm supposed to take a class named 'student' and a constructor named student that initializes a string named 'name' and an int name 'ID' and use Math.random to produce a 4 digit number. Then use a printdata method to print the name with ID. Next building a class named 'first' that creates an array of 5 students. I have to ask the names with JOptionPane.showInputDialog and print the results with the printdata method.
CODE
import javax.swing.JOptionPane;
public class project3 {
// Main Method
public static void main(String[]args) {
JOptionPane.showInputDialog("Enter the next Student's Name:");
}
}
class student{
String name;
int ID = (int)(Math.random() * 1000);
// Return the ID Number
double getID(){
return ID;
}
}
class first{
String name = new String();
}
Ok, I know this absolutely sucks, but I'm really having trouble focusing. I'm not asking for someone to do my homework for me, but a push in the right direction would help. I've tried writing for loops (so I don't have write the JOption.showInputDialog message 5 times, and I'm having trouble inputing the names into an Array.
This post has been edited by Israel: 20 Apr, 2007 - 10:10 PM