[Solved] SOLVED:Laboratory Week 6

30 $

File Name: SOLVED:Laboratory_Week_6.zip
File Size: 226.08 KB

SKU: [Solved] SOLVED:Laboratory Week 6 Category: Tag:

Or Upload Your Assignment Here:


Task One: DebuggingRectangleBlock.cpp and RoomService.cpp contain various errors; syntax, logicaland/or with respect to the sample output. Copy the files to your own workingdirectory and fix all bugs so the programs can be compiled and run correctly.The correct output for RectangleBlock.cpp should be:Rectangle…Dimensions are 4 by 5Area is 20Block…Height 6Dimensions are 4 by 5Volume is 120The correct output for RoomService.cpp should be:Room service order:steak dinner $19.99room service service fee $4 to room #1202Total is $23.99Task two: OverloadingDefine a class Set in a file Set.h with private data member elements (an integerpointer) and size (integer) of the set. Define suitable member functions and overloadbinary operators +, -, and &. Define an overloading input operator () to getelements from keyboard for a Set object, define an overloading output operator (<<)to print elements of a Set object. Don’t forget to define a destructor.We define the operator + for two sets as UNION (The set of UNION has all (nonrepeated)elements in both sets);We define the operator – for two sets as MINUS (The set of MINUS has all theelements in the first set but not in the second set);We define the operator & for two sets as INTERSECTION (The set ofINTERSECTION has only the elements in the first set and also belongs to the secondset).See the examples for more details.Implement Set member functions and input / output operators in a file Set.cpp.Write a main() function in testSet.cpp to test the overloaded operators (+, -, &,and <<).When we run the program, the results may look like the following (red data meaninputs from keyboard):Input number of elements for a set: 5Input elements: 2 10 8 7 21Input number of elements for a set: 3Input elements: 6 3 10Set s1 = {2, 10, 8, 7, 21}Set s2 = {6, 3, 10}UNION: s3 = s1 + s2 = {2, 10, 8, 7, 21, 6, 3}MINUS: s3 = s1 – s2 = {2, 8, 7, 21}INTERSECTION: s3 = s1 & s2 = {10}

Reviews

There are no reviews yet.

Only logged in customers who have purchased this product may leave a review.

Shopping Cart
[Solved] SOLVED:Laboratory Week 6
30 $