Results 1 to 4 of 4

Thread: convert Java Class to VB Class

  1. #1
    gocoogs
    Guest

    Exclamation 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
    }

    }

  2. #2
    Dazed Member
    Join Date
    Oct 1999
    Location
    Ridgefield Park, NJ
    Posts
    3,418
    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.

  3. #3
    gocoogs
    Guest
    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!

  4. #4
    Dazed Member
    Join Date
    Oct 1999
    Location
    Ridgefield Park, NJ
    Posts
    3,418
    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
  •  



Click Here to Expand Forum to Full Width