- Feb 9, 2005
- 25
- 0
- 0
I have to make a program that uses two files. The first program will include this:
name
GPA
setName(String sName)
getName()
setGPA(float gpa)
getGPA()
the second program will:
declare a new studnet with the name Robert
Print the Student Name
Change students name to Frank
Print the student name
Ask the user to input the gpa
Print the student gpa.
I'm having a tough time with the first program, once I get to the setName(String sName) I have no clue what to do, as I have yet to learn about this.
This is what I have so far:
class Student
{
String name;
float gpa;
//Question!!! No so I can use the studnet name in the next program do I say the following? This is what I understand from setName(String sName).
public Student
{
name = Robert;
}
--------
Also, if that is correct, do I do the same for setGPA? What do I do for getGPA? Thanks to anyone who helps, I have exhausted all my other resources, I have no one else to turn to for help.
name
GPA
setName(String sName)
getName()
setGPA(float gpa)
getGPA()
the second program will:
declare a new studnet with the name Robert
Print the Student Name
Change students name to Frank
Print the student name
Ask the user to input the gpa
Print the student gpa.
I'm having a tough time with the first program, once I get to the setName(String sName) I have no clue what to do, as I have yet to learn about this.
This is what I have so far:
class Student
{
String name;
float gpa;
//Question!!! No so I can use the studnet name in the next program do I say the following? This is what I understand from setName(String sName).
public Student
{
name = Robert;
}
--------
Also, if that is correct, do I do the same for setGPA? What do I do for getGPA? Thanks to anyone who helps, I have exhausted all my other resources, I have no one else to turn to for help.