BEST代写-线上编程学术专家

Best代写-最专业靠谱代写IT | CS | 留学生作业 | 编程代写Java | Python |C/C++ | PHP | Matlab | Assignment Project Homework代写

C++编程代写 | COMP2404B – Introduction to Software Engineering Assignment 1

C++编程代写 | COMP2404B – Introduction to Software Engineering Assignment 1

本次代写是C++编程的一个assignment

1 Submission Instructions

Submit to Brightspace on or before the due date a compressed file (.tar or .zip) that includes

1. Header and source files for all classes instructed below.

2. A working Makefile that compiles and links all code into a single executable. The Makefile should be specific
to this assignment – do not use a generic Makefile.

3. A README file with your name, student number, a list of all files and a brief description of their purpose,
compilation and execution instructions, and any additional details you feel are relevant.

2 Learning Outcomes

In this tutorial you will learn the basics of Classes in C++. You will make a few simple classes, populate the
members, and use functions and constructors in a meaningful and appropriate way. You will learn how to provide a
working Makefile and do some rudimentary testing.

3 Overview

The Carleton Library has rooms that students may book and use. In this assignment you will make a room booking
application. A student may request a certain room at a certain day and time. Or search for rooms that match certain
criteria (such as maximum capacity, computers and whiteboards) and check their availability.

4 Classes Overview

This application will consist of 5 classes. A brief description of each class follows.

1. Student – name and student number

2. Room – name and other criteria

3. Date – year, month, day, hour and duration

4. Reservation – a Student, a Room, and a Date object representing the who, where and when of a Reservation.

5. Library – a collection of Students, Rooms and Reservations along with some functions for managing them
(add, find, isFree etc).

5 Instructions

Download the starting code from Brightspace. It includes some global functions that you are to use for testing. All
member variables are private unless otherwise noted. All member functions are public unless otherwise noted.
Some return values are not explicitly given. You should use your best judgment (they will often be void, but not
always). ALL CLASSES MUST HAVE A PRINT FUNCTION.

5.1 The Student Class

Make a student class. This will be a simple data class with 2 data members and a bool lessThan method for sorting.

1. Make two member variables:

(a) name: a string
(b) number: a string

2. Make a no argument constructor that initializes name and number to suitable default values. Make a second
constructor that takes two strings as arguments. The first string should be used to initialize name and the
second string should used to intialize number.

3. Make a copy constructor.

4. Make getters and setters for the member variables.

5. Make a function bool lessThan(Student& s). Return true if this->number comes before s.number alpha-
betically, return false otherwise.

5.2 The Room Class

Make a Room class. This room has certain features that we will track using member variables. Instead of using room
numbers, to make the rooms more distinct we will give them names. Each room has a capacity of at least 1 person.
There is no practical maximum for the capacity (at some point in the future the library could have an auditorium).
Each room has a number of computers from 0 to infinity. And each room has a whiteboard or does not. When a
student makes a room request they will request certain criteria which we will try and match (though this will be
done in the Library class).

1. Give your room class the following member variables: string name, int capacity, int computers, bool
whiteboard.

2. Make a constructor with parameters in the same order given above. Make a copy constructor.

3. Make getters and setters for the member variables. The getter for whiteboard should be bool hasWhiteboard().

4. Make a function bool meetsCriteria(int capacity, int computers, bool whiteboard). This function
should return true if the capacity, computers, and whiteboard parameters of the Room meets or exceeds the
parameters given. For example, if you ask for a capacity 2 a Room with capacity 3 and any number of computers
and a whiteboard is acceptable. Give the parameters have appropriate default values. So, for instance, someone
could call bool meetsCriteria(3) if they wanted a room with capacity of 3, regardless of whether there are
computers or a whiteboard.

5. Make a function bool lessThan(Room& r). Return true if this->name comes before r.name alphabetically,
and return false otherwise.

5.3 The Date Class

Modify the Date class that we saw in class. We want to modify it so that, in addition to year, month and day, it
keeps track of the hour and duration of when we are to reserve and / or use a room.

1. Add a global integer constant1 to the header file to indicate the maximum allowable duration and set it to 3.

2. Add two new integer member variables, one for hour and one for duration.

(a) Make setters for both of these member variables that do appropriate checks on the values. We will use a
24-hour clock, so the hour should be an integer from 0 to 23. The duration should be an integer from 1
to the maximum allowable duration defined above. If the values fall outside of the allowed range, set the
member variables to the nearest allowable value.

3. Adjust the 3-argument constructor to accept two more integer arguments. It should now look like
Date(int year, int month, int day, int hour, int duration)

4. Make any required changes to the copy constructor, the no-argument constructor, the print() function, the
setters, getters, and any other relevant functions.

5. Change the lessThan(Date&) method to also compare the hour members. The purpose of this method is to
sort the reservations. As such, we should NOT compare durations in this method. We only compare when the
Dates begin.

6. Make a method bool overlaps(Date& d). This function should return true if two Dates overlap and false if
they do not overlap. Two dates, Date d1 and d2, overlap if they start on the same date and at the same hour.
They also overlap if d1 and d2 are on the same date and, for example, d1.hour == 13 and d2.hour == 14
and d1.duration > 1. Essentially both Dates define a range of time, and if those ranges overlap this function
should return true. You may assume that different days do not overlap regardless of duration, that is, you may
ignore the case where a Date starts at hour 23 on one day with a duration of 2 and another Date starts at hour
0 the next day.

bestdaixie

评论已关闭。