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

Assignment 5

Uploaded by

bsce23017
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)
5 views

Assignment 5

Uploaded by

bsce23017
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/ 4

CE101T – Object Oriented Programming

Section: Assignment # 5 Total marks: 35


Name : __________________ Roll number : __________________

Submission:
• Email instructor or TA if there are any questions. You cannot look at others’ solutions or use others’
solutions, however, you can discuss it with each other. Plagiarism will be dealt with according to the
course policy.
• Submission after due time will not be accepted.

Follow this naming convention for your report, it should highlight difficulties you faced and things you
learned in this assignment. Naming Pattern ( Roll#_Assignment#.pdf e.g BSCE23000_Assignment3.pdf )
In this assignment you have to do following tasks:
Task 1: Ensure that you have installed all three softwares in your personal computer (Github, Cygwin
& CLion). Now, accept the assignment posted in Google Classroom and after accepting, clone the
repository to your computer. Make sure you have logged into the github app with your account.
Task 2: Open Cygwin app, Move to your code directory with following command “cd
<path_of_folder>”
<path_of_folder> can be automatically populated by dragging the folder and dropping it to the
cygwin window.
Run the code through Cygwin, use command “make run”, to get the output of the code
Task 3: Solve the given problems, write code using CLion or any other IDE.
Task 4: Keep your code in the respective git cloned folder.
Task 5: Commit and Push the changes through the Github App
Task 5: Write the code in separate files (structure_name.h, structure_name.cpp) for each struct, declare
struct variables, and call functions from main.cpp. Ensure that file names are in lowercase.
Task 6: Run ‘make run’ to run C++ code
Task 7: Run ‘make test’ to test the C++ code

Object Oriented Programming


CE101T-Spring 2024
Problem Statement: Group Collaboration and GitHub Branches

Task 1: Cash Register Program


Implement a CashRegister class with the following private data members and public member
functions:

Data members:
item_count (int)
total_price (double)

Member functions:
Default Constructor: Dynamically allocates memory for data members, it also reset item count
and total price.
Setter Method: A method named setItem that takes price as parameter, adds an item to the
current sale with the specified price.
Getter Methods:
A default method named getTotal that returns the total amount due for the current sale.
A default method named getCount that returns the total item count for the current sale.
Destructor: Release the dynamically allocated memory.

Non member function:


A method named display that takes a const CashRegister& parameter and displays the item
count and total amount
Display Format:
Item count: 2
Total amount due: $5.5

Object Oriented Programming


CE101T-Spring 2024
Task 2: Construct Rectangle Program
Implement a class called Rectangle with the following private data members and public member
functions:

Data members:
width (int)
height (int)

Member functions:

Default Constructor: Allocates memory for data members and resets width and height.
Setter Method: A method named setRectangle that takes width and height as parameters and
constructs a rectangle.
Getter Methods:
A method named getWidth returns the width.
A method named getHeight returns the height.
Destructor: Releases the dynamically allocated memory.

Non-member function:

A method named displayAfterResize that takes a const Rectangle& parameter and a int type
factor, and resizes the rectangle by multiplying the width and height by the given factor.
Display Format:
Resized Rectangle: width = 6, height = 8

Object Oriented Programming


CE101T-Spring 2024
Task 3: Modelling Email Message Program
Implement a class called Message with the following private data members and public member
functions:

Data members:

sender (string)
receiver (string)
message_body (string)

Member functions:

Default Constructor: Dynamically allocates memory for data members and resets them.
Setter Method: A method named setMessageAttributes that takes sender, receiver, and
message_body as parameters and initializes the class attributes.
Getter Methods:
A method named getSender that returns the sender.
A method named getReceiver that returns the receiver.
A method named getMessage that returns the message.
Destructor: Releases the dynamically allocated memory.

Non-member function:

A method named displayMessage that takes a const Message& parameter and prints the
message.
Display Format:
Sender: sender
Receiver: receiver
Message: message_body

Object Oriented Programming


CE101T-Spring 2024

You might also like