-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcode 49.txt
54 lines (41 loc) · 1.15 KB
/
code 49.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
package studentstuff;
public class Student{
private String strName;
private String strStudentNum;
private String strCourse;
private double dblAmount;
// properties get and set methods for each of the 3 above
public String getName(){
strFullName = strName + " " + strSurname;
return strFullName ;
}
public void setName(String strNewName){
strName = strNewName;
}
public void setAmount(double dblNewAmount){
dblAmount = dblNewAmount;
}
public double getAmount(){
dblAmount = dblAmount - (dblAmount * 0.25);
return dblAmount;
}
// constructors
public Student(){
}
public Student(String strNewName, String strNewNum, String strNewCourse){
strName = strNewName;
strStudentNum = ...
strCourse = ...
}
// methods
}
//----------------------------------------------------------------------------------------
package studentstuff;
public class StudentStuff{
public static void main(String[] args){
Student stud1 = new Student();
String strName;
strName = JOptionPane.showInputDialog(null, "Please enter the students name: ");
stud1.setName(strName);
}
}