Abbas Ali's Profile
Reputation: 1
Apprentice
- Group:
- New Members
- Active Posts:
- 2 (0 per day)
- Joined:
- 10-March 12
- Profile Views:
- 32
- Last Active:
Dec 12 2012 11:02 AM- Currently:
- Offline
Previous Fields
- Dream Kudos:
- 0
Posts I've Made
-
In Topic: College Class ?
Posted 12 Dec 2012
ipushmycar, on 11 December 2012 - 06:18 AM, said:You need to review classes.
http://docs.oracle.c...OO/classes.html
Or these:
http://www.dreaminco..._1&#entry391713
http://www.dreaminco...ing-classes-ii/
ok that's really good but it's not my problem it's in class college it breaks in the pint that i can't understand ???
import javax.swing.JOptionPane; public class College extends Person { String name; Student [] s=new Student [1000]; Administrator [] a=new Administrator [135]; Staff [] st=new Staff[200]; public void input (){ int i=0; int y=0; int z=0; String check=JOptionPane.showInputDialog("Would you like to input student,administrator or staff"); if(check == "student" ) { while (i<1000) { s[i].setName(JOptionPane.showInputDialog("Enter student's name")); String status=JOptionPane.showInputDialog("Enter "+s[i].getName()+"'s status"+"\nfreshman,sophomore,junior or senior"); if(status=="freshman") s[i].setclassStatus("Freshman"); else if (status=="sophomore") s[i].setclassStatus("Sophomore"); else if (status=="senior") s[i].setclassStatus("Senior"); else if (status=="junior") s[i].setclassStatus("Junior"); else s[i].setclassStatus("Wrong status"); s[i].setAddress(JOptionPane.showInputDialog("Enter "+s[i].getName()+"'s address")); s[i].setEmail(JOptionPane.showInputDialog("Enter "+s[i].getName()+"'s e-mail address")); String pho=JOptionPane.showInputDialog("Enter "+s[i].getName()+"'s phone"); s[i].setPhone(Integer.parseInt(pho)); i++; } } else if(check=="staff") { while (y<200 && st[y].getPhone()>0) { st[y].setName(JOptionPane.showInputDialog("Enter the name of staff")); st[y].setTitle(JOptionPane.showInputDialog("Enter "+st[y].name+"'s"+" title")); st[y].address=JOptionPane.showInputDialog("Enter "+st[y].name+"'s"+" address"); st[y].emailadrress=JOptionPane.showInputDialog("Enter "+st[y].name+"'s"+" e-mail address"); String pho=JOptionPane.showInputDialog("Enter "+st[y].name+"'s"+" phone"); st[y].phone=Integer.parseInt(pho); String Office=JOptionPane.showInputDialog("Enter "+st[y].name+"'s"+" office number"); st[y].officeNum=Integer.parseInt(Office); String Sal=JOptionPane.showInputDialog("Enter "+st[y].name+"'s"+"salary"); st[y].salary=Integer.parseInt(Sal); y++; } } else if(check=="administrator") { while (z<135 && a[z].phone>0) { a[z].name=JOptionPane.showInputDialog("Enter the name of Administrator"); a[z].address=JOptionPane.showInputDialog("Enter "+a[z].name+"'s"+" address"); a[z].emailadrress=JOptionPane.showInputDialog("Enter "+a[z].name+"'s"+" e-mail address"); String pho=JOptionPane.showInputDialog("Enter "+a[z].name+"'s"+" phone"); a[z].phone=Integer.parseInt(pho); String Office=JOptionPane.showInputDialog("Enter "+a[z].name+"'s"+" office number"); a[z].officeNum=Integer.parseInt(Office); String Ohours=JOptionPane.showInputDialog("Enter "+a[z].name+"'s"+" office hours"); a[z].officeHours=Integer.parseInt(Ohours); a[z].rank =JOptionPane.showInputDialog("Enter "+a[z].name+"'s"+" rank"); String Sal=JOptionPane.showInputDialog("Enter "+a[z].name+"'s"+"salary"); a[z].salary=Integer.parseInt(Sal); z++; } } } }
Sorry , i forget to mention that break in this line after
String check=JOptionPane.showInputDialog("Would you like to input student,administrator or staff");
My Information
- Member Title:
- New D.I.C Head
- Age:
- Age Unknown
- Birthday:
- Birthday Unknown
- Gender:
Contact Information
- E-mail:
- Private
Friends
Abbas Ali hasn't added any friends yet.
|
|


Find Topics
Find Posts
View Reputation Given
|
Comments
Abbas Ali has no profile comments yet. Why not say hello?