Skip to content
MPGHThe Dark Arts
/
RegisterLog in
Forum
Community
What's NewLatest posts across the boardTrendingHottest threads right nowSubscribedThreads you follow
Discussion
GeneralIntroductionsEntertainmentDebate FortFlaming & Rage
Board
News & AnnouncementsMPGH TimesSuggestions & HelpGiveaways
More Sections
Art & Graphic DesignProgrammingHackingCryptocurrency
Hacks & Cheats
Games
ValorantCS2 / CS:GOCall of Duty / WarzoneFortniteApex LegendsEscape From Tarkov
+14 moreLeague of LegendsGTA VMinecraftRustROTMGBattlefieldTroveBattleOnCombat ArmsCrossFireBlackshotRuneScapeDayZDead by Daylight
Resources
Game Hacking TutorialsReverse EngineeringGeneral Game HackingAnti-CheatConsole Game Hacking
Tools
Game Hacking ToolsTrainers & CheatsHack/Release NewsNew
Submit a release →Share your cheat, tool, or config with the community.
AINEW
AI Tools
General & DiscussionPrompt EngineeringLLM JailbreaksHotAI Agents & AutomationLocal / Open Models
AI × Gaming
AI Aimbots & VisionML Anti-CheatGame Bots & Automation
Create
AI Coding / Vibe CodingAI Art & MediaAI Voice & TTS
The AI frontier →Where game hacking meets modern machine learning. Jump in.
Marketplace
Buy & Sell
SellingBuyingTradingUser Services
Trust & Safety
Middleman LoungeMarketplace TalkVouch Copy Profiles
Money
Cryptocurrency TalkCurrency ExchangeWork & Job Offers
Start selling →List accounts, services, and goods. Use the middleman to trade safe.
MPGH The Dark Arts

A community for offensive security research, reverse engineering, and AI.

Community

ForumMarketplaceSearch

Account

RegisterLog in

Legal

Privacy PolicyForum RulesHelp & FAQ
© 2026 MPGH · All rights reserved.Built by the community, for the community. For educational purposes onlyContent is shared for security research and education — we don't condone illegal use. You're responsible for complying with applicable laws. Use at your own risk.
Home › Forum › Programming › Other Programming › Java › Beginner in Java- Need Help With Project

Beginner in Java- Need Help With Project

Posts 1–4 of 4 · Page 1 of 1
CA
carmania24
Beginner in Java- Need Help With Project
Hi everyone!

First- thank you for taking a look at this forum, any help is greatly appreciated.

Here is what the instructions say:

Create a Java NetBeans project named StudentClient with the main class named StudentClient. Add a service class to the project named Student. This program will encapsulate the concept of a student, assuming a student has the following attributes (instance variables): a name, a social security number and a GPA (e.g., 3.5).For the Student class you will write the constructors, accessors and mutators, and toString and equals methods. In the client application class you will instantiate student class objects and write statements (method calls) to test the methods in your student service class.

I have 0 ideas on how to start this, and this is my biggest project (grade wise), so if you have any idea on how I can start it I will love you forever (no homo)

PS: I have another project in which I will upload the code to pastebin, I want to make sure I did that properly or not, and I will post a link back here along with the instructions in pastebin
#1 · 10y ago
Cosmo_
Cosmo_
This is what I came up with. If you need me to explain anything feel free to message me.

Code:
public class StudentClient {

    public static void main(String[] args) {
	Student mark = new Student("Mark", 555555555, 3.6);
        System.out.println(mark.toString());

        Student leslie = new Student();
        leslie.equals(mark);
        leslie.setName("Leslie");
        System.out.println(leslie.toString());
    }
}
Code:
public class Student {

    private String name;
    private int socialSecurityNumber;
    private double gpa; // grade point average

    private static final String DEFAULT_NAME = "Unregistered";
    private static final int DEFAULT_SOCIAL_SECURITY_NUMBER = 111111111;
    private static final int HIGHEST_SOCIAL_SECURITY_NUMBER = 999999999;
    private static final double LOWEST_GPA = 0.0;
    private static final double HIGHEST_GPA = 4.0;

    public String toString() {
        String information = "Name: " + name;
        information += "\n" + "Social Security Number: " + socialSecurityNumber;
        information += "\n" + "G.P.A: " + gpa;

        return information;
    }

    public void equals(Student student) {
        this.name = student.getName();
        this.socialSecurityNumber = student.getSocialSecurityNumber();
        this.gpa = student.getGpa();
    }

    // ================================== CONSTRUCTORS =========================================== //

    public Student() {
        this(DEFAULT_NAME, DEFAULT_SOCIAL_SECURITY_NUMBER, LOWEST_GPA);
    }

    public Student(String name) {
        this(name, DEFAULT_SOCIAL_SECURITY_NUMBER, LOWEST_GPA);
    }

    public Student(int socialSecurityNumber) {
        this(DEFAULT_NAME, socialSecurityNumber, LOWEST_GPA);
    }

    public Student(double gpa) {
        this(DEFAULT_NAME, DEFAULT_SOCIAL_SECURITY_NUMBER, gpa);
    }

    public Student(String name, int socialSecurityNumber) {
        this(name, socialSecurityNumber, LOWEST_GPA);
    }

    public Student(String name, double gpa) {
        this(name, DEFAULT_SOCIAL_SECURITY_NUMBER, gpa);
    }

    public Student(int socialSecurityNumber, double gpa) {
        this(DEFAULT_NAME, socialSecurityNumber, gpa);
    }

    public Student(String name, int socialSecurityNumber, double gpa) {

        // check to see if blank string was passed as the name
        // if it was then set name to default value otherwise set this.name = to string passed
        if (name.equals("")) {
            this.name = DEFAULT_NAME;
        }else {
            this.name = name;
        }

        // check that social is between 0 and 999999999
        // if not set it equal to default value
        if (socialSecurityNumber >= DEFAULT_SOCIAL_SECURITY_NUMBER && socialSecurityNumber <= HIGHEST_SOCIAL_SECURITY_NUMBER) {
            this.socialSecurityNumber = socialSecurityNumber;
        } else {
            this.socialSecurityNumber = DEFAULT_SOCIAL_SECURITY_NUMBER;
        }

        // ensure that the gpa passed to the method is between 0.0 and 4.0 inclusive
        // else set it equal to lowest value
        if (gpa >= LOWEST_GPA && gpa <= HIGHEST_GPA) {
            this.gpa = gpa;
        } else {
            this.gpa = LOWEST_GPA;
        }
    }

    // ============================ Getter and Setters ===================================== //

    public String getName() {
        return this.name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public int getSocialSecurityNumber() {
        return this.socialSecurityNumber;
    }

    public void setSocialSecurityNumber(int socialSecurityNumber) {
        this.socialSecurityNumber = socialSecurityNumber;
    }

    public double getGpa() {
        return this.gpa;
    }

    public void setGpa(double gpa) {
        this.gpa = gpa;
    }
}
- - - Updated - - -

Here was the output from the code above:

Name: Mark
Social Security Number: 555555555
G.P.A: 3.6
Name: Leslie
Social Security Number: 555555555
G.P.A: 3.6

Process finished with exit code 0
#2 · 10y ago
CA
carmania24
Quote Originally Posted by Cosmo_ View Post
This is what I came up with. If you need me to explain anything feel free to message me.

Code:
public class StudentClient {

    public static void main(String[] args) {
	Student mark = new Student("Mark", 555555555, 3.6);
        System.out.println(mark.toString());

        Student leslie = new Student();
        leslie.equals(mark);
        leslie.setName("Leslie");
        System.out.println(leslie.toString());
    }
}
Code:
public class Student {

    private String name;
    private int socialSecurityNumber;
    private double gpa; // grade point average

    private static final String DEFAULT_NAME = "Unregistered";
    private static final int DEFAULT_SOCIAL_SECURITY_NUMBER = 111111111;
    private static final int HIGHEST_SOCIAL_SECURITY_NUMBER = 999999999;
    private static final double LOWEST_GPA = 0.0;
    private static final double HIGHEST_GPA = 4.0;

    public String toString() {
        String information = "Name: " + name;
        information += "\n" + "Social Security Number: " + socialSecurityNumber;
        information += "\n" + "G.P.A: " + gpa;

        return information;
    }

    public void equals(Student student) {
        this.name = student.getName();
        this.socialSecurityNumber = student.getSocialSecurityNumber();
        this.gpa = student.getGpa();
    }

    // ================================== CONSTRUCTORS =========================================== //

    public Student() {
        this(DEFAULT_NAME, DEFAULT_SOCIAL_SECURITY_NUMBER, LOWEST_GPA);
    }

    public Student(String name) {
        this(name, DEFAULT_SOCIAL_SECURITY_NUMBER, LOWEST_GPA);
    }

    public Student(int socialSecurityNumber) {
        this(DEFAULT_NAME, socialSecurityNumber, LOWEST_GPA);
    }

    public Student(double gpa) {
        this(DEFAULT_NAME, DEFAULT_SOCIAL_SECURITY_NUMBER, gpa);
    }

    public Student(String name, int socialSecurityNumber) {
        this(name, socialSecurityNumber, LOWEST_GPA);
    }

    public Student(String name, double gpa) {
        this(name, DEFAULT_SOCIAL_SECURITY_NUMBER, gpa);
    }

    public Student(int socialSecurityNumber, double gpa) {
        this(DEFAULT_NAME, socialSecurityNumber, gpa);
    }

    public Student(String name, int socialSecurityNumber, double gpa) {

        // check to see if blank string was passed as the name
        // if it was then set name to default value otherwise set this.name = to string passed
        if (name.equals("")) {
            this.name = DEFAULT_NAME;
        }else {
            this.name = name;
        }

        // check that social is between 0 and 999999999
        // if not set it equal to default value
        if (socialSecurityNumber >= DEFAULT_SOCIAL_SECURITY_NUMBER && socialSecurityNumber <= HIGHEST_SOCIAL_SECURITY_NUMBER) {
            this.socialSecurityNumber = socialSecurityNumber;
        } else {
            this.socialSecurityNumber = DEFAULT_SOCIAL_SECURITY_NUMBER;
        }

        // ensure that the gpa passed to the method is between 0.0 and 4.0 inclusive
        // else set it equal to lowest value
        if (gpa >= LOWEST_GPA && gpa <= HIGHEST_GPA) {
            this.gpa = gpa;
        } else {
            this.gpa = LOWEST_GPA;
        }
    }

    // ============================ Getter and Setters ===================================== //

    public String getName() {
        return this.name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public int getSocialSecurityNumber() {
        return this.socialSecurityNumber;
    }

    public void setSocialSecurityNumber(int socialSecurityNumber) {
        this.socialSecurityNumber = socialSecurityNumber;
    }

    public double getGpa() {
        return this.gpa;
    }

    public void setGpa(double gpa) {
        this.gpa = gpa;
    }
}
- - - Updated - - -

Here was the output from the code above:

Name: Mark
Social Security Number: 555555555
G.P.A: 3.6
Name: Leslie
Social Security Number: 555555555
G.P.A: 3.6

Process finished with exit code 0
Wow I can't thank you enough!! I will try the code out once I get home. )

Btw nice user name my dogs name is also Cosmo :P
#3 · 10y ago
Cosmo_
Cosmo_
No problem and good luck!
#4 · 10y ago
Posts 1–4 of 4 · Page 1 of 1

Post a Reply

Similar Threads

  • I need help with Project blackout :SBy takinardy in Piercing Blow Help
    8Last post 14y ago
  • I need help with this projectBy killer121561 in Combat Arms Coding Help & Discussion
    7Last post 15y ago
  • Need help with starting a HUGE project (this goes for AZUMKILL, CrazyApple, IZ3RO etcBy lior19940 in Call of Duty Modern Warfare 2 GSC Modding Help/Discussion
    20Last post 16y ago
  • need help with javaBy abonabel in CrossFire Help
    5Last post 15y ago
  • Need help with a personal project: Hacking NavyFieldBy Slinky in Hack Requests
    19Last post 19y ago

Tags for this Thread

None