Solution for above problem:
#include <iostream>
using namespace std;
class House{
private:
double r1_width;
double r1_depth;
double r1_unusable;
int r1_inout;
int r1_window;
double r2_width;
double r2_depth;
double r2_unusable;
int r2_inout;
int r2_window;
double r3_width;
double r3_depth;
double r3_unusable;
int r3_inout;
int r3_window;
// Contructor for initializing the object
public :
House(double w1,double d1,double u1,int inout1,int window1,double
w2,double d2,double u2,int inout2,int window2,double w3,double
d3,double u3,int inout3,int window3){
this->r1_width = w1;
this->r1_depth = d1;
this->r1_unusable = u1;
this->r1_inout = inout1;
this->r1_window = window1;
this->r2_width = w2;
this->r2_depth = d2;
this->r2_unusable = u2;
this->r2_inout = inout2;
this->r2_window = window2;
this->r3_width = w3;
this->r3_depth = d3;
this->r3_unusable = u3;
this->r3_inout = inout3;
this->r3_window = window3;
}
// Function for calculating the usual size of the home
public:
double sizeCalculation(){
double usualSize=0;
usualSize =
(this->r1_width*this->r1_depth)-this->r1_unusable+(this->r2_width*this->r2_depth)-this->r2_unusable+(this->r3_width*this->r3_depth)-this->r3_unusable;
if(r1_inout==1){
usualSize=usualSize-0.8;
}
if(r2_inout==1){
usualSize=usualSize-0.8;
}
if(r3_inout==1){
usualSize=usualSize-0.8;
}
return(usualSize);
}
// Function for calculating the air quality
string airQualityCheck(){
double usualSize =
(this->r1_width*this->r1_depth)-this->r1_unusable+(this->r2_width*this->r2_depth)-this->r2_unusable+(this->r3_width*this->r3_depth)-this->r3_unusable;
int window =
this->r3_window+this->r2_window+this->r1_window;
if(window>0){
usualSize = usualSize/window;
}
if(usualSize>20){
return("poor");
}else if(usualSize<11){
return("good");
}else if(usualSize>11 && usualSize<20){
return("acceptable");
}
}
};
int main()
{
House h1(5.2,4,0.6,1,1,2,2.6,0.1,0,1,6,7,1.3,1,3);
cout<<h1.sizeCalculation(); // Call for sizeCalculation
function.
cout<<" "<<h1.airQualityCheck(); // Call for
airQualityCheck function.
return 0;
}
Screenshot for code :
Screenshot for output:
c++ please Assignment Write a program that calculates the quality of a home composed of three...
C++ Assignment Write a program that calculates the total weight of one vehidle and one cargo vehicle. For both vehicles, the user will give the base weight of the vehicle, the passenger capacity of the vehicle, and ONLY FOR the cargo vehicle, the cargo weight capacity all as integers. Then, the user will give passenger information for BOTH vehicles as first the number of passengers and weights of each passenger (e.g., 2 60 80 means two passengers of weight 60...
Please help me to write a c++ program that will Implement a HotelRoom class, with private data members: the room number, room capacity (representing the maximum number of people the room can accommodate), the occupancy status (0 or the number of occupants in the room), the daily room rate. Member functions include: • a 4-argument constructor that initializes the four data members of the object being created (room number, room capacity, room rate, occupancy status) to the constructor's arguments. The...
Complete the code in C#. Part 1 is one program. Part 2 is another program. They're seperate programs, but use part 1 to figure out part 2. Part! Create a new console application named Demojobs. Write a program for Harold's Home Services. The program should instantiate an array of job objects and demonstrate their methods. The Job class contains four data fields-description (for example "wash windows), time in hours to complete (for example 3.5), per-hour rate charged (for example, $25.00),...
%%%%% c++ assignment %%%%%% ///////// please test your program and check for errors. //////// you should use the file bellow For this assignment you will write a program that creates a tree of "plants". Each plant is the result of an exeperiment. I have provided the main driver program that is responsible for running each of the experiments but you will need to create a tree for storing the results. The objective of this assignment is to learn how to...
Assignment Overview In Part 1 of this assignment, you will write a main program and several classes to create and print a small database of baseball player data. The assignment has been split into two parts to encourage you to code your program in an incremental fashion, a technique that will be increasingly important as the semester goes on. Purpose This assignment reviews object-oriented programming concepts such as classes, methods, constructors, accessor methods, and access modifiers. It makes use of...
Please write below code in C++ using Visual Studio. Write program that uses a class template to create a set of items. The program should: 1. add items to the set (there shouldn't be any duplicates) • Example: if your codes is adding three integers, 10, 5, 10, then your program will add only two values 10 and 5 • Hint: Use vectors and vector functions to store the set of items 2. Get the number of items in the...
How to solve this Problem in C++ . The Problem Write program that uses a class template to create a set of items. The program should: 1. add items to the set (there shouldn't be any duplicates) Example: if your codes is adding three integers, 10, 5, 10, then your program will add only two values 10 and 5 Hint: Use vectors and vector functions to store the set of items 2. Get the number of items in the set...
Write a program in C++ that uses a class template to create a set of items. . . The Problem Write program that uses a class template to create a set of items. The program should: 1. add items to the set (there shouldn't be any duplicates) Example: if your codes is adding three integers, 10, 5, 10, then your program will add only two values 10 and 5 Hint: Use vectors and vector functions to store the set of...
what would be the solution code to this problem in c++? The Problem Write program that uses a class template to create a set of items. The program should: 1. add items to the set (there shouldn't be any duplicates) • Example: if your codes is adding three integers, 10, 5, 10, then your program will add only two values 10 and 5 Hint: Use vectors and vector functions to store the set of items 2. Get the number of...
For this c++ assignment, Overview write a program that will process two sets of numeric information. The information will be needed for later processing, so it will be stored in two arrays that will be displayed, sorted, and displayed (again). One set of numeric information will be read from a file while the other will be randomly generated. The arrays that will be used in the assignment should be declared to hold a maximum of 50 double or float elements....