MCPcopy Create free account
hub / github.com/Vishruth-S/CompetitiveCode / HotelRoom

Class HotelRoom

Hackerrank_problems/Hotel Price/solution.cpp:6–18  ·  view source on GitHub ↗

create an instance for hotel room

Source from the content-addressed store, hash-verified

4using namespace std;
5//create an instance for hotel room
6class HotelRoom {
7public:
8 HotelRoom(int bedrooms, int bathrooms)
9 : bedrooms_(bedrooms), bathrooms_(bathrooms) {}
10//function to calculate the price of Hotel Room
11 virtual int get_price() {
12 return 50*bedrooms_ + 100*bathrooms_;
13 }
14// initialize the variable for bedroooms and bathrooms
15private:
16 int bedrooms_;
17 int bathrooms_;
18};
19//create an instance for hotel apartment
20class HotelApartment : public HotelRoom {
21public:

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected