Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8363693
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T12:14:45+00:00 2026-06-09T12:14:45+00:00

I have some java book and i’m doing exercises. But right now i’m stuck

  • 0

I have some java book and i’m doing exercises. But right now i’m stuck on exercises associated with arrays. i have following exercise:

Create a CollegeCourse class. The class contains fields for the course ID (for example,
“CIS 210”), credit hours (for example, 3), and a letter grade (for example, ‘A’).

Include get() and set()methods for each field. Create a Student class containing an
ID number and an array of five CollegeCourse objects. Create a get() and set()
method for the Student ID number. Also create a get() method that returns one
of the Student’s CollegeCourses; the method takes an integer argument and
returns the CollegeCourse in that position (0 through 4). Next, create a set()
method that sets the value of one of the Student’s CollegeCourses; the method
takes two arguments—a CollegeCourse and an integer representing the
CollegeCourse’s position (0 through 4).

I already did data fields and id’s and getters from student class. But right now i’m a little confused with this:

Also create a get() method that returns one
of the Student’s CollegeCourses; the method takes an integer argument and
returns the CollegeCourse in that position (0 through 4). Next, create a set()
method that sets the value of one of the Student’s CollegeCourses; the method
takes two arguments—a CollegeCourse and an integer representing the
CollegeCourse’s position (0 through 4).

Can anyone point me to the right direction how to resolve this. Because it’s array chapter i think it must be resolved doing arrays? Any help would be appreciated.

EDIT: ok here is my CollegeCourse Class

public class CollegeCourse {

String courseID;
int creditHours;
char grade;

public void setCourseId(String id) {

    this.courseID = id;

}

public String getCourse() {

    return courseID;
}


public void setHours(int hours) {

    this.creditHours = hours;
}

public int getHours() {

    return creditHours;

}

public void setGrade(char grade) {

    this.grade = grade;

}

}

and here is my student class ( im stuck here):

public class Student {

int id;
CollegeCourse[] cc = new CollegeCourse[5];


public void setId(int id) {

    this.id = id;
}

public int getId() {

    return id;
}


public void setCollegeCourse(CollegeCourse course, int position) {


    // i'm stuck here


}

}

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-09T12:14:46+00:00Added an answer on June 9, 2026 at 12:14 pm

    Basically its asking you to create a getter/setter for contents of the array;

    CollegeCourse[] courses...
    
    ...
    
    public CollegeCourse getCourse(int index) {
        return courses[index];
    }
    
    public void setCourse(int index, CollegeCourse course) {
        courses[index] = course;
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am doing some exercises from the book Thinking In Java . I have
I have some question about arrays, I'm reading some book about Java, and now
I am doing some exercise from a book and have some problems with the
I'm doing the first chapter exercises on my Java book and I have been
I am a bit new with android but I have some java experience. So
I have some experience with Java , C , databases , networking etc..But anything
I have gone through Head First Java and some other sites but I couldn't
I have downloaded some Java source code from a book. It contains many directories
I have some java.sql.Time objects as follows: String s1 = 12:00:04; String s2 =
I have some Java code which performs bitwise operations on a BitSet. I have

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.