Name: ______________________________________ Student
#: ______________________________________ |
|||||||||||||||||||
SODV 1202 Introduction to Object Oriented Programming Spring 2020 Assignment 01 |
|||||||||||||||||||
Instructor: Mahbub Murshed |
Date: July 23, 2020 |
||||||||||||||||||
Instructions: ·
Written
questions can be submitted on paper or scanned and submitted by dropbox.
Answers should be written clearly and coherently. Programming questions can
be submitted using compressed zip or rar format. ·
Assignments
must be submitted by the posted due date, or be subject to the course’s late
policy. Work must be completed individually and in accordance with the
academic integrity policy. ·
For all written
questions, you may assume that any necessary using directives are included. |
|||||||||||||||||||
|
Assignment 1: Written
Questions
1. |
Give concise answers to the following
questions |
/ 10 |
a) |
What is the importance of using properties in a C# program? |
/ 4 |
b) |
When local objects occupies memory compile time or run time? Explain. |
/ 4+2 |
2. |
Design a class representing a superstore item.
You don’t need to write implementations for any member functions, just list
any public or private field, property, or method declarations you think may
be needed. |
/ 10 |
3.
In the following function
implementation there are 5 syntax errors. Mark the errors in the code below
with a circled number corresponding to the spaces provided, and either briefly explain why it is an
error or give a fix for it.
_________________________________________________ 2) Syntax Error: ___________________________________________________ ___________________________________________________ 3) Syntax Error: ___________________________________________________
___________________________________________________ 4) Syntax Error: ___________________________________________________
___________________________________________________ 5) Syntax Error:
___________________________________________________
___________________________________________________ |
/ 10 |
Assignment 1: Book
Store
Overview
Write a program that manages
a simple Book Store by utilizing the Object Oriented Programming Architecture.
Directions
A book store wants to
develop a system to add/remove readers, add/remove books, track books rented
and returned from registered readers and show book store information. In order
to endure books rented and returned, your program will need to track books and
readers. A reader can rent maximum 2 (two) books and he/she can rent a book if
it is available to the store and not rented by other readers. The store can
remove any book if the book is not already rented to someone. The store can
also remove a reader, however, to remove a reader, all books rented by him/her
must be returned before otherwise, the system will generate an error message.
Your program must track each books and every readers. Implement your book store
program can be done by the following steps:
1.
Create a Book
class.
a.
Add fields
for the book’s name, serial and status. (Assume, book names can be same,
however will always differ by the serial number. i.e. together book name and
serial will be unique! )
b.
Add a
constructor that initializes every book’s fields with given values.
c.
Add a
function to check the availability of a book.
d.
Add a
function to rent a book.
e.
Add a
function to return a book.
f.
Finally,
add a function to show book information.
2.
Create a
Reader class.
a.
Add fields
for the reader’s name, and a list of books. (Assume each reader name is unique.
i.e. there are no two readers in the book store with the same name.)
b.
Add a
constructor that initializes reader’s name and to create an empty list of
books.
c.
Add a
function to rent a book and add the book to the reader’s list.
d.
Add a
function to return a book and remove the book from the list.
e.
Finally,
add a function to show reader information.
3.
Create a BookStore
class.
a.
Add fields
in order to store the list of books and the list of readers for the book store.
b.
Add a
constructor to initializes all lists to empty list.
c.
Add a
method for adding a reader to the store.
d.
Add a
method for removing a reader from the store. (to remove a reader, all books
rented by him/her must be returned first!)
e.
Add a
method for adding a book to the store.
f.
Add a
method to remove a book from the store. (to remove a book, it should be
available in the store, otherwise, program should issue an error message!)
g.
Add a
method to rent a book for a reader.
h.
Add a
method to return a book from a reader.
i.
Finally,
add a method to show bookstore information.
Evaluation
This assignment has 3
main components, assigned marks as follows:
Task |
Marks |
Written Questions |
30 |
Code Quality |
20 |
Code Functionality |
50 |
Total |
100 |
Marks for written
questions are indicated beside each question.
For the program code,
same activity submission rubrics will be used. Please read the Rubrics in d2l
for more information. To get full marks for quality, code must be readable,
well documented, and well designed according to standard practices.
Functionality will be
tested with standard automated tests. Students are also encouraged to run their
own tests on their code.
Get Free Quote!
382 Experts Online