View Single Post
  #1 (permalink)  
Old 05-04-2008, 08:27 PM
Bascotie Bascotie is offline
Member
 
Join Date: Apr 2008
Posts: 77
Bascotie is on a distinguished road
Using 2 Classes= Controller x Definition
Hey guys,

For school I am suppose to write a program with a controller class and a definition class.

I wonder if im on the right path, please assist me:

I am using Eclipse and what I have done was just make a package and within that package I have two classes, (Project2.java and Project2Class2.java)

My project wants me to use the JOptionPane to get some information from the "customer" and have them enter it in one line so this is what I have:

Code:
import javax.swing.JOptionPane; import java.util.StringTokenizer; public class Project2Class2 { public static void main(String[] args) { String userNameFirst = ""; String userNameLast = ""; String userPhone = ""; String userRolls = ""; String userPrints = ""; final int USER_EXPOSURES = 1; String userInput = JOptionPane.showInputDialog(null, "Please enter the following information with a space inbetween each:\n\n" + "First Name\n" + "Last Name\n" + "Phone Number \n" + "Number of Rolls \n" + "Number of Prints \n" + userNameFirst + " " + userNameLast + " " + userPhone + " " + userRolls + " " + userPrints); JOptionPane.showMessageDialog(null, "You input:\n" + userInput); } }
The problem is, I dont see why I need a controller class and another class to hold the definition. I know it must be done but I have no idea how it is to be done because all the examples I have looked at that have used a controller class and another class I do not understand how it could apply to this problem.

What the problem starts out asking for is for the "customer" to enter input such as user name, phone number, etc all in one line in the JOptionPane seperated by spaces and I have done that but how could I seperate it into two different classes?

Someone please help me get this one started, thank you!
Reply With Quote
Sponsored Links