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

C++ Assignment

Best Assignment about C++

Uploaded by

takeeurrahman
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
15 views

C++ Assignment

Best Assignment about C++

Uploaded by

takeeurrahman
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 4

Course Title: Computer Programming 2

Course Code: CSE- 1221


Section: 2AM
Course Instructor: Khandaker Tayef Shahriar
• Assignment
• Total Marks = 15
• Deadline: October 20, 2024
General Instructions for the Assignment
1. Handwritten Submission: The assignment must be handwritten. Typed work will
not be accepted.
2. No Copying: Each student must complete their own work. Copying from others
may result in a loss of marks for both parties. It can be easily detected by the way.
Also chat-gpt works can easily be detected.
Reminder: This is an individual assignment, answers shouldn’t match with one
another within the group. It'll be very easy to detect if anyone copied from others.
3. Neatness: Ensure your handwriting is clear and readable.
4. Complete All Questions: Attempt all questions to avoid losing marks.
5. Deadline: Submit the assignment on time. Late submissions will result in a
deduction of marks.
6. You must include your assigned group number in the front page.
Questions CLO’s Bloom’s Taxonomy
1. CLO2 Cognitive/Understand
2. CLO2 Cognitive/Apply
3. CLO2 Cognitive/Create
Group 1 (C231292, C33064, C233087, C241001, C41002, C41003, 241004,
241005)
1. Write a Rectangle class in C++ language, allowing you to build a rectangle
with length and width attributes.
2. Create a Perimeter() method to calculate the perimeter of the rectangle and a
Area() method to calculate the area of the rectangle.
3. Create a method display() that display the length, width, perimeter and area
of an object created using an instantiation on rectangle class.
4. Create a Parallelepipede child class inheriting from the Rectangle class and
with a height attribute and another Volume() method to calculate the volume
of the Parallelepiped.

Group 2 (241006, 241007, 241008, 241009, 241010, 241011, 241012, 241013)


1. Create a C++ class Person with attributes: name and age of type string.
2. Create a display() method that displays the name and age of an object created
via the Person class.
3. Create a child class Student which inherits from the Person class and which
also has a section attribute.
4. Create a method displayStudent() that displays the name, age and section of
an object created via the Student class.

Group 3 (241014, 241015, 241016, 241017, 241018, 241019, 241020, 241021)


1. Create a C++ class called BankAccount which represents a bank account,
having as attributes: accountNumber, name, balance.
2. Create a constructor with parameters: accountNumber, name, balance.
3. Create a Deposit() method which manages the deposit actions.
4. Create a Withdrawal() method which manages withdrawals actions.
5. Create a display() method to display account details.
Group 4 (241022, 241023, 241024, 241025, 241025, 241026, 241027, 241028)
1. Create a class named Triangle.
2. Create an object from it. The object will have three attributes named a, b and
c that represent the sides of the triangle.
3. The Triangle class will have two methods:
a. The constructor method to initialize the sides
b. A Method to calculate the perimeter of the triangle from its sides
4. The perimeter of the triangle should be printed from outside the class

Group 5 (241029, 241030, 241031, C211110, C213085, C213123, C213124,


C221081)
1. Create a Computation class with a default constructor (without parameters)
allowing to perform various calculations on integers numbers.
2. Create a method called Factorial() which allows to calculate the factorial of
an integer. Test the method by instantiating the class.
3. Create a method called Sum() allowing to calculate the sum of the first n
integers 1 + 2 + 3 + .. + n. Test this method.
4. Create a method called testPrim() in the Calculation class to test the primality
of a given integer. Test this method.

Group 6 (Remaining IDs)


1. Write a C++ class Employee with attributes like emp_id, emp_name,
emp_salary, and emp_department and methods like calculate_emp_salary,
emp_assign_department, and print_employee_details.
2. Use 'emp_assign_department' method to change the department of an
employee.
3. Use 'print_employee_details' method to print the details of an employee.
4. Use 'calculate_emp_salary' method takes two arguments: salary and
hours_worked, which is the number of hours worked by the employee. If the
number of hours worked is more than 50, the method computes overtime and
adds it to the salary. Overtime is calculated as following formula:
o overtime = hours_worked - 50
o Overtime amount = (overtime * (salary / 50))

You might also like