title-img


Hotel Prices C++

In this challenge, the task is to debug the existing code to successfully execute all provided test files. The given code defines two classes HotelRoom and HotelApartment denoting respectively a standard hotel room and a hotel apartment. An instance of any of these classes has two parameters: bedrooms and bathrooms denoting respectively the number of bedrooms and the number of bathrooms in the room. The prices of a standard hotel room and hotel apartment are given as: Hotel Room: 5

View Solution →

Cpp exception handling C++

In this challenge, the task is to debug the existing code to successfully execute all provided test files. You are required to extend the existing code so that it handles std::invalid_argument exception properly. More specifically, you have to extend the implementation of process_input function. It takes integer n as an argument and has to work as follows: 1. It calls function largest_proper_divisor(n). 2. If this call returns a value without raising an exception, it should print in

View Solution →

Overloading Ostream Operator C++

The task is to overload the << operator for Person class in such a way that for p being an instance of class Person the result of: std::cout << p << " " << <some_string_value> << std::endl; produces the following output: first_name=<first_name>,last_name=<last_name> <some_string_value> where: <first_name> is the value of p's first_name_ <last_name> is the value of p's last_name_ <some_string_value> is an arbitrary std::string value Input Format The input is rea

View Solution →

Merge the Tools! Python

Consider the following: 1. A string, s, of length where s=c0,c1.....cn-1. 2. An integer, k, where k is a factor of n. We can split s into n/k subsegments where each subsegment, ti, consists of a contiguous block of k characters in s. Then, use each ti to create string ui such that: 1. The characters in ui are a subsequence of the characters in ti. 2. Any repeat occurrence of a character is removed from the string such that each character in ui occu

View Solution →

Messages Order C++

In real life applications and systems, a common component is a messaging system. Thea idea is that a sender sends messages to the recipient. The messages might be sent for example over the network. However, some network protocols don't guarantee to preserve the order of sent messages while they are received by the recipient. For example, if someone sends a text messages hello, hi and what's up, they might be received in the order what's up, hello, hi. In many systems the expected behavior is to

View Solution →