Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

I need help with this programming question please. 1.Copy the following code to ensure it compiles. public class Student { private String name; private int

I need help with this programming question please.

1.Copy the following code to ensure it compiles.

public class Student

{

private String name;

private int age;

private String major;

private int studentID;

private double GPA;

public Student(){

}

public void setName(String name){

this,name = name;

} private String setGPA(){

return this.GPA;

}

private String setStudentID(){

return this.GPA;

}

}

2. In the Student class define set and get method for all class's variables. Some setters have been defined with different visibility. Try to call them in main function in Lab9 class and find which type you can call and which you can't.

3. Complete the constructor of Student. Set the default value: name = Alice, age = 18, major = computer science, studentID = 1212345678, GPPA= 3.56

4. Create another constructor to accept five parameters from user. Ande create a new Student instance with this constructor. Hint: Passing five parameters when you create new instances of Student

5. Create another constructor wo accept three parameters, (name, age, studentID) and create a new Student instance with this constructor. Hint: Passing name, age, StudentID when you create new instances od Student.

6. Add a dispalyStudent() function in the Student class to print out all the variables in the student class. Call this function for each instances you create above in Lab9 and see what information it prints.

?

?

?

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Advances In Spatial And Temporal Databases 8th International Symposium Sstd 2003 Santorini Island Greece July 2003 Proceedings Lncs 2750

Authors: Thanasis Hadzilacos ,Yannis Manolopoulos ,John F. Roddick ,Yannis Theodoridis

2003rd Edition

3540405356, 978-3540405351

Students also viewed these Databases questions

Question

How easy the information is to remember

Answered: 1 week ago

Question

Set a filter to display only sold-out art (indicated by Yes).

Answered: 1 week ago