Sure, here is the UML diagram for the Student class:
```
Class Diagram
Class: Student
Attributes:
firstName: String
lastName: String
gpa: double
Methods:
constructor(firstName: String, lastName: String)
getfirstName(): String
getlastName(): String
getgpa(): double
calculateGpa(grade1: double, grade2: double, grade3: double): void
```
Here is the code for the Student class:
```python
class Student:
def __init__(self, firstName, lastName):
self.firstName = firstName
self.lastName = lastName
self.gpa = 0.0
def getfirstName(self):
return self.firstName
def getlastName(self):
return self.lastName
def getgpa(self):
return self.gpa
def calculateGpa(self, grade1, grade2, grade3):
self.gpa = (grade1 + grade2 + grade3) / 3
def main():
firstName = input("Enter student's first name: ")
lastName = input("Enter student's last name: ")
student = Student(firstName, lastName)
grade1 = float(input("Enter student's first grade: "))
grade2 = float(input("Enter student's second grade: "))
grade3 = float(input("Enter student's third grade: "))
student.calculateGpa(grade1, grade2, grade3)
print("Student's GPA is: ", student.gpa)
if __name__ == "__main__":
main()
```
This code prompts the user to enter the student's first and last name, then creates an object of the Student class and initializes its fields with the values accepted from the user. Next, the user is prompted to enter 3 grades for the student. Once all the grades are entered and validated, the calculateGpa method of the Student object is called and its gpa is displayed.
I hope this helps! Let me know if you have any other questions.