Jump to content


Developing An App Using Oo Principle In Jcreator


  • Please log in to reply
4 replies to this topic

#1 Mthobisi

Mthobisi

    Newbie

  • Members
  • Pip
  • 3 posts

Posted 30 March 2012 - 05:57 PM

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

#2 nyccanuck

nyccanuck

    Advanced Member

  • Members
  • PipPipPip
  • 78 posts

Posted 31 March 2012 - 04:57 AM

View PostMthobisi, on 30 March 2012 - 05:57 PM, said:

Hello everyone please help with this problem esp in the GUI and textfiles part

.
.
.


What to do?
Use OOP principles to design this system
Use Jcreator to design GUI for this system

What do you have so far?

#3 Mthobisi

Mthobisi

    Newbie

  • Members
  • Pip
  • 3 posts

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.

#4 nyccanuck

nyccanuck

    Advanced Member

  • Members
  • PipPipPip
  • 78 posts

Posted 02 April 2012 - 05:41 AM

View PostMthobisi, 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.

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 of
public 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.

#5 arronlee

arronlee

    Newbie

  • Members
  • Pip
  • 6 posts

Posted 25 June 2013 - 08:10 AM

Good idea. I wonder what platform is your Barcode Scanner used for? .NET? Or .JAVA?
Best Regards,
Arron



I am testing about SDKs dealing with images, barcodes, and documents.
Do you have any ideas?


Next Tomorrow is Another Day.