0% found this document useful (0 votes)
6 views

Assignment 1

The document outlines a class diagram for a 'Student' class with attributes for student ID, name, subject, and mark, along with methods to display student information and adjust marks. It specifies the use of a parameterized constructor and the 'this' keyword for instance variables. The main method initializes four student objects with specific values and calls the display and carve methods for each student.

Uploaded by

Alaa Ismail
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
6 views

Assignment 1

The document outlines a class diagram for a 'Student' class with attributes for student ID, name, subject, and mark, along with methods to display student information and adjust marks. It specifies the use of a parameterized constructor and the 'this' keyword for instance variables. The main method initializes four student objects with specific values and calls the display and carve methods for each student.

Uploaded by

Alaa Ismail
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 1

Write a program to represent the following class diagram:

Student
- studentID: int
- name: String
- subject: String
- mark: double
+display( ):void
+carve( ):void

1. Using parameterized-constructor and this keyword for all instance


variables.
2. display( ) method : is used to display the information of student who has
studentID = 102.
3. carve( ) method is used to carve 2 marks (‫ )منح عالمتين‬for student who has mark
< 5 and display his information, otherwise the mark will stay as it is with
displaying the student information.

In the main method, do the following:

1. Initial values for 4 students as mentioned bellow:


(100,"ali","oop",6)

(101,"sami","oop",3)

(102,"sara","oop",2)

(103,"lina","oop",7)

2. Call the display( ) method and carve( ) method for the 4 objects that are
created previously in the main method.

You might also like