Assignment 1 (1)
Assignment 1 (1)
CS-212
Assignment # 1
Due Date: Tuesday, 04 March 2025
Student Details:
Name:
NUST ID:
Semester: Spring 2025 Batch: BSAI
Obtained Marks:
Total Marks: 20
Important Instruction
Fill your information on the cover page.
Make your work clear and well-presented.
Copying from other students or resources will result in ZERO mark.
Number all the subsequent pages properly.
1
Department of Computer Science
Assignment:
Find 04 real-world entities and create a class for each entity using proper C++ syntax. Each
entity carries equal marks (05 marks each).
Each class must have at least:
03 Data Members (Attributes)
03 Member Functions (Methods)
Write a one-line description for each data member and member function explaining
why you have chosen it for this class.
Each student must choose unique entities (no two students should have the same
classes).
Plagiarism or copying from others will result in a zero score.
Submission Guidelines:
Submit your assignment as a .docx file.
Ensure your code is well-formatted and properly indented.
Add comments explaining your logic.
Any copied work will be marked as zero.
Assignment file name should be like this. studentName.docx i.e., muhammadAli.docx.
2
Department of Computer Science
3
Department of Computer Science
}
// This function is used for showing details of mobile
void showDetails() {
cout << "Brand: " << brand << ", Price: $" << price << ",
Battery Life: " << batteryLife << " hours" << endl;
}
};
// Main Function
int main() {
MobilePhone myPhone;
// Assigning values
myPhone.brand = "Samsung";
myPhone.price = 799.99;
myPhone.batteryLife = 24;
// Using Member Functions
myPhone.showDetails();
myPhone.makeCall("123-456-7890");
myPhone.sendMessage("Hello, how are you?");
return 0;
}
Output