Hello everyone please help with this problem esp in the GUI and textfiles part
The Department of Examinations in MUT requires your assistance to develop an application that will assist them with the attendance registers of all students writing an exam.
Processing
1. Using arrays your program should store the following data:
• Student number
• Student Surname
• Student Initials
• Subject Name
• Subject Level
• Qualification
• Seat Number
• Date of Exam(long date format)
• Venue of Exam
Note all these details should be in the array(s) when the program is loading.
2. Assuming that all the relevant data is stored, use a barcode scanner to read the student number from a student card and display on the screen the seat number as well as the subject details.
3. When the student is submitting his/her answer booklet the barcode scanner will also be used to capture the time the student left the exam room
4. Your program should then produce a report in a form of a text file that will have the following details:
• Student details(Number,suname,initials)
• Time each student took to write the paper
• The number of students that wrote the exam
• The number of students that were absent
What to do?
• Use OOP principles to design this system
• Use Jcreator to design GUI for this system
Developing An App Using Oo Principle In Jcreator
Started by
Mthobisi
, Mar 30 2012 05:57 PM
3 replies to this topic
#1
Posted 30 March 2012 - 05:57 PM
#3
Posted 31 March 2012 - 02:29 PM
public class Student
{
//Instance variables
private int studNum;
private String surname;
private String initials;
private String name;
private int level;
private String Qualification;
private int seat;
private int date;
private String venue;
//Default constructors
public Student()
{
studNum=0;
surname=null;
initials=null;
name=null;
level=0;
Qualification=null;
seat=0;
date=0;
venue=null;
}
//Argument Constructors
public void Student()
{
this.studNum=studNum;
this.surname=surname;
this.initials=initials;
this.name=name;
this.level=level;
this.Qualification=Qualification;
this.seat=seat;
this.date=date;
this.venue=venue;
}
//Mutators
public void setStudNum()
{
this.studNum=studNum;
}
public void setSurname()
{
this.surname=surname;
}
public void setInitials()
{
this.initials=initials;
}
public void setName()
{
this.name=name;
}
public void setLevel()
{
this.level=level;
}
public void setQualification()
{
this.Qualification=Qualification;
}
public void setSeat()
{
this.seat=seat;
}
public void setDate()
{
this.date=date;
}
public void setVenue()
{
this.venue=venue;
}
//Accessors
public int getStudNum()
{
return studNum;
}
public String getSurname()
{
return surname;
}
public String getInitials()
{
return initials;
}
public String getName()
{
return name;
}
public int getLevel()
{
return level;
}
public String getQualification()
{
return Qualification;
}
public int getSeat()
{
return seat;
}
public int getDate()
{
return date;
}
public String getVenue()
{
return venue;
}
public String toString()
{
return(studNum+""+surname+""+initials+""+name+""+level+""+Qualification+""+seat+""+date+""+venue);
}
}
Im not sure if Im on the right track since this is the 1st time im designing a GUI using J-Creator & using textfiles. I also did the test driver, but it does not run.
{
//Instance variables
private int studNum;
private String surname;
private String initials;
private String name;
private int level;
private String Qualification;
private int seat;
private int date;
private String venue;
//Default constructors
public Student()
{
studNum=0;
surname=null;
initials=null;
name=null;
level=0;
Qualification=null;
seat=0;
date=0;
venue=null;
}
//Argument Constructors
public void Student()
{
this.studNum=studNum;
this.surname=surname;
this.initials=initials;
this.name=name;
this.level=level;
this.Qualification=Qualification;
this.seat=seat;
this.date=date;
this.venue=venue;
}
//Mutators
public void setStudNum()
{
this.studNum=studNum;
}
public void setSurname()
{
this.surname=surname;
}
public void setInitials()
{
this.initials=initials;
}
public void setName()
{
this.name=name;
}
public void setLevel()
{
this.level=level;
}
public void setQualification()
{
this.Qualification=Qualification;
}
public void setSeat()
{
this.seat=seat;
}
public void setDate()
{
this.date=date;
}
public void setVenue()
{
this.venue=venue;
}
//Accessors
public int getStudNum()
{
return studNum;
}
public String getSurname()
{
return surname;
}
public String getInitials()
{
return initials;
}
public String getName()
{
return name;
}
public int getLevel()
{
return level;
}
public String getQualification()
{
return Qualification;
}
public int getSeat()
{
return seat;
}
public int getDate()
{
return date;
}
public String getVenue()
{
return venue;
}
public String toString()
{
return(studNum+""+surname+""+initials+""+name+""+level+""+Qualification+""+seat+""+date+""+venue);
}
}
Im not sure if Im on the right track since this is the 1st time im designing a GUI using J-Creator & using textfiles. I also did the test driver, but it does not run.
#4
Posted 02 April 2012 - 05:41 AM
Mthobisi, on 31 March 2012 - 02:29 PM, said:
public class Student
{
//Instance variables
//Default constructors
public Student()
{
studNum=0;
surname=null;
initials=null;
name=null;
level=0;
Qualification=null;
seat=0;
date=0;
venue=null;
}
//Argument Constructors
public void Student()
{
this.studNum=studNum;
this.surname=surname;
this.initials=initials;
this.name=name;
this.level=level;
this.Qualification=Qualification;
this.seat=seat;
this.date=date;
this.venue=venue;
}
//Mutators
public void setStudNum()
{
this.studNum=studNum;
}
...
...
...
public String toString()
{
return(studNum+""+surname+""+initials+""+name+""+level+""+Qualification+""+seat+""+date+""+venue);
}
}
Im not sure if Im on the right track since this is the 1st time im designing a GUI using J-Creator & using textfiles. I also did the test driver, but it does not run.
{
//Instance variables
//Default constructors
public Student()
{
studNum=0;
surname=null;
initials=null;
name=null;
level=0;
Qualification=null;
seat=0;
date=0;
venue=null;
}
//Argument Constructors
public void Student()
{
this.studNum=studNum;
this.surname=surname;
this.initials=initials;
this.name=name;
this.level=level;
this.Qualification=Qualification;
this.seat=seat;
this.date=date;
this.venue=venue;
}
//Mutators
public void setStudNum()
{
this.studNum=studNum;
}
...
...
...
public String toString()
{
return(studNum+""+surname+""+initials+""+name+""+level+""+Qualification+""+seat+""+date+""+venue);
}
}
Im not sure if Im on the right track since this is the 1st time im designing a GUI using J-Creator & using textfiles. I also did the test driver, but it does not run.
When I run:
public class Student1
{
public static void main(String[] args)
{
Student Std1 = new Student();
System.out.println(Std1);
}
}
I get:
0 null null null 0 null 0 0 null
There are no problems with you default constructor... except...
You have created setters (mutators), use them.
Constructor (Default)
studNum=0;Change to
setStudNum(0);same for the rest...
Constructors (Argument)
Your signature:
public void Student()is the same as your default. You must define your signatures...
this should look like...
public void Student(int initStudentNum, String initSurname, ... )
{
surname(initStudentNum);
...
...
}
all your variables / objects being passed must be listed. You can have as many parameterized (argument) constructos as you like as long as they all differ, (no overloading). i.e. you may pass just a student last name (and have everything alse be set as your defaults)public void Student(String initSurname)
{
setstudNum(0);
setsurname(initStudentNum);
...
...
}
But you may not create another signature ofpublic void Student(String initName)
{
setstudNum(0);
setsurname(null);
setInitials(null);
setName(initName);
...
...
}
Your 'mutators' all need to have
public void setStudNum(int newStdNum)
{
studNum = newStdNum
}
These are basic changes to the code that you provided. The code that you provided has nothing about 'GUI' or writing to a text file.
If you provide some additional code that you have written for this, I would be glad to take a look and help you out. But I am not going to write your code for you. Hope that this at least has helped a little. You should really look at you text or ask you professor for guidance if you really do not know what to do.










