|
-
Oct 20th, 2001, 11:42 PM
#1
convert Java Class to VB Class
Please help me convert the following Java code into a VB class. All the functionality of the Java code must be incorporated within the VB class. Thank you very much!
class Student
{
private String Name; // Name of the student
private String Nationality; // Nationality of the Student
private double GPA; // Overall GPA owned by the Student
private boolean inAGroup=False; // Records whether a student is in a group or not
private String Group; // Group the student is assigned to
// Constructor to create a Student object
public Student (String aName, String aNationality, double aGPA)
{
Name = aName; // Set the Name for the Student
Nationality = aNationality; // Set the Nationality for the Student
GPA = aGPA; // Set the GPA for the Student
}
// Method to assign a Student to a Group
public void putInAGroup()
{
inAGroup=True; // Record Student's status in a Group as True
}
// Method to take student out of a Group
public void takeOutOfGroup()
{
inAGroup=False; // Record Student's status in a Group as False
}
// Method to change the Group a student belongs to
public void changeGroup(String newGroup)
{
Group = newGroup; // Set the Group the Student belongs to
}
// Method to get the GPA for a Student
public double getGPA()
{
return GPA; // Return the GPA for a Student
}
}
-
Oct 21st, 2001, 09:45 AM
#2
Dazed Member
It matters if you want to keep the class structure and make the file a .cls module or just have subprocedures and functions in a standard module .bas.
-
Oct 21st, 2001, 10:04 AM
#3
Thank you Dilenger4. But can you explain to me more on how to make it a .cls or .bat file. I'm sorry for being knowless!
-
Oct 21st, 2001, 10:51 AM
#4
Dazed Member
Im assuming that you are currently running Visual Basic 6
and not VB Net (which is VB 7). Youre best bet would be to ask this in the VB forum, since it sounds like you have never used Visual Basic before. Conversion of the code you have posted shouldnt be that difficult though.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|