main.cpp
#include
#include
#include \"SwimmingPool.h\"
using namespace std;
void printMainMenu();
void printPoolVolume();
void printGetPoolDimensions(bool);
void printHasDimensions();
void checkDimensions();
void printError();
void printPoolDimensions();
double editValue(double);
void printGetFillRate();
void printGetDrainRate();
void printAddWater();
void printDrainRate();
void printFillRate();
char printWantwer();
SwimmingPool pool;
int _response;
int _numResponses;
double _length;
double _width;
double _depth;
//double _currentwerVolume;
double _drainRate;
double _fillRate;
bool _end;
char _newValue[5];
int main()
{
int fillTime;
int drainTime;
double drained;
// Set output style and precision
cout << fixed << showpoint << setprecision(2);
// Main program loop
// ends when _end==true
while (!_end)
{
// Prints main option list
printMainMenu();
// Switch based on response
switch (_response)
{
// Sets pool dimensions
case 1:
if (pool.hasDimensions())
printHasDimensions();
else
{
printPoolDimensions();
printPoolVolume();
}
break;
// Prints pool dimensions
case 2:
printGetPoolDimensions(false);
system(\"pause\");
break;
// Prints fill rate
case 3:
printGetFillRate();
break;
// Prints drain rate
case 4:
printGetDrainRate();
break;
// Determine water need to fill pool to capacity
case 5:
checkDimensions();
if (!pool.hasWater())
cout << \"\ The pool is currently empty\";
else
{
cout << \" The pool currently has \"
<< pool.getwerVolume()
<< \" units\"
<< endl;
}
cout << \"\ \ Water needed: \"
<< pool.getFillAmount(pool.getwerVolume())
<< \" units of water\ \ \";
system(\"pause\");
break;
// Determine time required to fill pool at rate
case 6:
if (!pool.hasDimensions())
{
cout << \" Pool dimensions not yet entered.\ \";
printGetPoolDimensions(false);
}
if (pool.getFillRate() <= 0)
printGetFillRate();
cout << \"\ Time to fill pool: \"
<< pool.getFillTime()
<< endl
<< endl;
system(\"pause\");
break;
// Determine time required to drain pool at rate
case 7:
checkDimensions();
if (_drainRate <= 0)
printGetDrainRate();
if (!pool.hasWater())
{
char response = printWantwer();
while (response != \'y\' && response != \'n\')
{
printError();
response = printWantwer();
}
if (response == \'y\')
printAddWater();
else
break;;
}
cout << \"\ Time to drain pool: \"
<< pool.getDrainTime()
<< endl
<< endl;
system(\"pause\");
break;
case 8:
checkDimensions();
if (pool.getFillRate() <= 0)
printGetFillRate();
else
printFillRate();
cout << \"\ Enter fill time: \";
cin >> fillTime;
pool.setFillTime(fillTime);
pool.setwerVolume(pool.getwerVolume() + pool.fill());
cout << endl
<< pool.fill()
<< \" units of water were added to the pool\ \ \"
<< \" The pool now contains \"
<< pool.getwerVolume()
<< \" units of water\ \ \";
system(\"pause\");
break;
case 9:
checkDimensions();
if (pool.getDrainRate() <= 0)
printGetDrainRate();
else
printDrainRate();
cout << \"\ Enter drain time: \";
cin >> drainTime;
pool.setDrainTime(drainTime);
if (!pool.hasWater())
{
char response = printWantwe.
implemement the game.cpp by the header file given. And create main.c.pdffazilfootsteps
implemement the game.cpp by the header file given. And create main.cpp to make the program
work.
The game is called the game of life, https://en.wikipedia.org/wiki/Conway\'s_Game_of_Life
game.h:
#include // Provides ostream
#include // String operations
#include // Randomizer
namespace csci2312
{
using std::string;
using std::ostream;
using std::istream;
class Cell
{
friend class GameOfLife;
public:
static const char alive =\'o\'; // alive image
static const char dead = \'-\'; // dead image
// Default constructor sets the cell\'s state to false
Cell();
// Custom constructor sets the cell\'s state as per argument
Cell(bool state);
// Empty destructor
~Cell();
// Accessors have no intention to modify the object, so it is a good practice to make them
\'const\' functions
bool getState() const;
// Mutator to change cell\'s state
void setState(bool newState);
// Accessor to see the \'face\'
char getFace() const;
private:
bool state;
char face;
};
class GameOfLife
{
public:
static const unsigned int MAX_BOARD = 30;
GameOfLife();
GameOfLife(size_t boardSize);
~GameOfLife();
int seedBoard(string fileName);
void seedBoard(size_t seeds);
void run();
void run(unsigned int numberOfIterations);
// ADVANCED
// A const(!) accessor method that returns a handle to the private currentLife array.
// The return type must also be \'const\' because we return a pointer to a static array, and
these are fixed
// It is just an example. It is not needed if we have a friend operator.
const Cell(*getCurrentLife() const )[MAX_BOARD+2] { return currentLife; };
///////////////////////////////////////////////////////
// friend operator can access private members of GameOfLife
friend ostream& operator << (ostream& out, const GameOfLife& board);
friend istream& operator >> (istream& in, const GameOfLife& board);
private:
bool executeRules(unsigned int countAlive, bool currentState);
// With \"Halo\" approach we need a bigger board
Cell currentLife[MAX_BOARD + 2][MAX_BOARD + 2];
Cell nextLife[MAX_BOARD + 2][MAX_BOARD + 2];
// ADVANCED
// Example how to declare variable cl as a pointer/handle to our array of Cells of size
HALO_BOARD
// The accessor method getCurrentLife() above uses the same syntax for the return type
const Cell(*cl)[MAX_BOARD + 2] = currentLife;
////////////////////////////////////////////////////////
size_t boardSize; // Board size requested in the constructor
};
// NON-MEMBER OUTPUT FUNCTIONS
// Display cell\'s state with alive/dead face
ostream& operator << (ostream& out, const Cell& cell);
}
Solution
Answer:
#include
#include
#include
#include
using namespace std;
void copy(int input1[52][102], int input2[52][102])
{
for(int j = 0; j < 52; j++)
{
for(int i = 0; i < 102; i++)
input2[j][i] = input1[j][i];
}
}
void lifegame(int input[52][102], char option)
{
int support[52][102];
copy(input, support);
for(int j = 1; j < 51; j++)
{
for(int i = 1; i < 101; i++)
{
if(option == \'m\')
{
int increment = 0;
increment = input[j-1][i] +
input[j-1][i-1] +
input[j][i-1] .
ood evening people. Ive been working on this code that sends a bur.pdfaroramobiles1
ood evening people. I\'ve been working on this code that sends a burst on the client side as well
as the private fifo name over a struct, to a server which will process several clients and the burst
time that will be sent back to the client through the private fifo.
The issue is that once I enter the burst on the client side, it won\'t send the proper burst to the
server, which in turn it will read the private fifo name but not the burst, since there is no burst
(and the server has a set burst entered by the user), the actual burst will become a giantnumber.
I\'m attaching my code hoping than maybe another pair of eyes can see where I am getting my
mistake and help me to correct it. Thanks
client:
my input for the client:
server:
the input and outcome from the server:
at this point I canceled the program with a ctrl + C to cancel the recurring burst in reversive
count.
Again any help or suggestion is well received. Thanks
Solution
client:
#include
#include
#include
#include
#include
#include
#include
#include
typedef struct values {
char name[30];
int arrivalTime;
int burst; //used for both the initial size of the process and to send the completion time
} Process; /*Datatype of the elements in the queue*/
int main( int argc, char *argv[] ){
Process process;
int fdIN; //to write to character server
int fdOUT; //to read from character server
int clientID;
clientID = getpid();
sprintf(process.name, \"FIFO_%d\", clientID);
printf(\"\ FIFO name is %s \", process.name);
if((mkfifo(process.name, 0666)<0 && errno != EEXIST))
{
perror(\"Can\'t create private FIFO\ \");
exit(-1);
}
printf(\"\ Enter burst: \ \")
scanf(\"%d\", &process.burst);
if((fdIN=open(\"commFIFO\", O_WRONLY))<0) //writting into fifo
printf(\"cant open fifo to write\");
write(fdIN, &process, sizeof(process));
if((fdOUT=open(process.name, O_RDONLY))<0) //reading from fifo
printf(\"cant open fifo to read\");
read(fdOUT, &process, sizeof(process));
printf(\"\ arrival time: %d \ \", process.arrivalTime);
unlink (\"commFIFO\");
unlink (process.name);
close(fdIN);
close(fdOUT);
}
SERVER:
#include
#include
#include
#include
#include
#include
#include
#include
//Inbox/Outbox structure
typedef struct values {
char name[30];
int arrivalTime;
int burst; //used for both the initial size of the process and to send the completion time
} Process;
//Node definition
typedef struct node{ /*Nodes stored in the linked list*/
struct values request;
struct node *next;
} Node;
//Queue Definition
typedef struct queue{ /*A struct facilitates passing a queue as an argument*/
Node *head; /*Pointer to the first node holding the queue\'s data*/
Node *tail; /*Pointer to the last node holding the queue\'s data*/
int sz; /*Number of nodes in the queue*/
} Queue;
int size( Queue *Q ){
return Q->sz;
}
int isEmpty( Queue *Q ){
if( Q->sz == 0 ) return 1;
return 0;
}
void enqueue( Queue *Q, struct values elem ){
Node *v = (Node*)malloc(sizeof(Node));/*Allocate memory for the Node*/
if( !v ){
printf(\"ERROR: Insufficien.
#define ENABLE_COMMANDER
#define ENABLE_REPORTER
#include <cctype> // for toupper()
#include <cstdlib> // for EXIT_SUCCESS and EXIT_FAILURE
#include <cstring> // for strerror()
#include <cerrno> // for errno
#include <deque> // for deque (used for ready and blocked queues)
#include <fstream> // for ifstream (used for reading simulated process programs)
#include <iostream> // for cout, endl, and cin
#include <sstream> // for stringstream (for parsing simulated process programs)
#include <sys/wait.h> // for wait()
#include <unistd.h> // for pipe(), read(), write(), close(), fork(), and _exit()
#include <vector> // for vector (used for PCB table)
using namespace std;
class Instruction {
public:
char operation;
int intArg;
string stringArg;
};
class Cpu {
public:
vector<Instruction> *pProgram;
int programCounter;
int value;
int timeSlice;
int timeSliceUsed;
};
enum State {
STATE_READY,
STATE_RUNNING,
STATE_BLOCKED,
STATE_END
};
class PcbEntry {
public:
int processId;
int parentProcessId;
vector<Instruction> program;
unsigned int programCounter;
int value;
unsigned int priority;
State state;
unsigned int startTime;
unsigned int timeUsed;
};
// The number of valid priorities.
#define NUM_PRIORITIES 4
// An array that maps priorities to their allotted time slices.
static const unsigned int PRIORITY_TIME_SLICES[NUM_PRIORITIES] = {
1,
2,
4,
8
};
unsigned int timestamp = 0;
Cpu cpu;
// For the states below, -1 indicates empty (since it is an invalid index).
int runningState = -1; // The index of the running process in the PCB table.
// readyStates is an array of queues. Each queue holds PCB indices for ready processes
// of a particular priority.
deque<int> readyStates[NUM_PRIORITIES];
deque<int> blockedState; // A queue fo PCB indices for blocked processes.
deque<int> deadState;
// In this implementation, we'll never explicitly clear PCB entries and the
// index in the table will always be the process ID. These choices waste memory,
// but since this program is just a simulation it the easiest approach.
// Additionally, debugging is simpler since table slots and process IDs are
// never re-used.
vector<PcbEntry *> pcbTable;
double cumulativeTimeDiff = 0;
int numTerminatedProcesses = 0;
// Sadly, C++ has no built-in way to trim strings:
string &trim(string &argument)
{
string whitespace(" \t\n\v\f\r");
size_t found = argument.find_last_not_of(whitespace);
if (found != string::npos) {
argument.erase(found + 1);
argument.erase(0, argument.find_first_not_of(whitespace));
} else {
argument.clear(); // all whitespace
}
return argument;
}
bool createProgram(const string &filename, vector<Instruction> &program)
{
ifstream file;
int lineNum = 0;
program.clear();
file.open(filename.c_str());
if (!file.is_open()) {
cout << "Error opening file " << filename << ...
implemement the game.cpp by the header file given. And create main.c.pdffazilfootsteps
implemement the game.cpp by the header file given. And create main.cpp to make the program
work.
The game is called the game of life, https://en.wikipedia.org/wiki/Conway\'s_Game_of_Life
game.h:
#include // Provides ostream
#include // String operations
#include // Randomizer
namespace csci2312
{
using std::string;
using std::ostream;
using std::istream;
class Cell
{
friend class GameOfLife;
public:
static const char alive =\'o\'; // alive image
static const char dead = \'-\'; // dead image
// Default constructor sets the cell\'s state to false
Cell();
// Custom constructor sets the cell\'s state as per argument
Cell(bool state);
// Empty destructor
~Cell();
// Accessors have no intention to modify the object, so it is a good practice to make them
\'const\' functions
bool getState() const;
// Mutator to change cell\'s state
void setState(bool newState);
// Accessor to see the \'face\'
char getFace() const;
private:
bool state;
char face;
};
class GameOfLife
{
public:
static const unsigned int MAX_BOARD = 30;
GameOfLife();
GameOfLife(size_t boardSize);
~GameOfLife();
int seedBoard(string fileName);
void seedBoard(size_t seeds);
void run();
void run(unsigned int numberOfIterations);
// ADVANCED
// A const(!) accessor method that returns a handle to the private currentLife array.
// The return type must also be \'const\' because we return a pointer to a static array, and
these are fixed
// It is just an example. It is not needed if we have a friend operator.
const Cell(*getCurrentLife() const )[MAX_BOARD+2] { return currentLife; };
///////////////////////////////////////////////////////
// friend operator can access private members of GameOfLife
friend ostream& operator << (ostream& out, const GameOfLife& board);
friend istream& operator >> (istream& in, const GameOfLife& board);
private:
bool executeRules(unsigned int countAlive, bool currentState);
// With \"Halo\" approach we need a bigger board
Cell currentLife[MAX_BOARD + 2][MAX_BOARD + 2];
Cell nextLife[MAX_BOARD + 2][MAX_BOARD + 2];
// ADVANCED
// Example how to declare variable cl as a pointer/handle to our array of Cells of size
HALO_BOARD
// The accessor method getCurrentLife() above uses the same syntax for the return type
const Cell(*cl)[MAX_BOARD + 2] = currentLife;
////////////////////////////////////////////////////////
size_t boardSize; // Board size requested in the constructor
};
// NON-MEMBER OUTPUT FUNCTIONS
// Display cell\'s state with alive/dead face
ostream& operator << (ostream& out, const Cell& cell);
}
Solution
Answer:
#include
#include
#include
#include
using namespace std;
void copy(int input1[52][102], int input2[52][102])
{
for(int j = 0; j < 52; j++)
{
for(int i = 0; i < 102; i++)
input2[j][i] = input1[j][i];
}
}
void lifegame(int input[52][102], char option)
{
int support[52][102];
copy(input, support);
for(int j = 1; j < 51; j++)
{
for(int i = 1; i < 101; i++)
{
if(option == \'m\')
{
int increment = 0;
increment = input[j-1][i] +
input[j-1][i-1] +
input[j][i-1] .
ood evening people. Ive been working on this code that sends a bur.pdfaroramobiles1
ood evening people. I\'ve been working on this code that sends a burst on the client side as well
as the private fifo name over a struct, to a server which will process several clients and the burst
time that will be sent back to the client through the private fifo.
The issue is that once I enter the burst on the client side, it won\'t send the proper burst to the
server, which in turn it will read the private fifo name but not the burst, since there is no burst
(and the server has a set burst entered by the user), the actual burst will become a giantnumber.
I\'m attaching my code hoping than maybe another pair of eyes can see where I am getting my
mistake and help me to correct it. Thanks
client:
my input for the client:
server:
the input and outcome from the server:
at this point I canceled the program with a ctrl + C to cancel the recurring burst in reversive
count.
Again any help or suggestion is well received. Thanks
Solution
client:
#include
#include
#include
#include
#include
#include
#include
#include
typedef struct values {
char name[30];
int arrivalTime;
int burst; //used for both the initial size of the process and to send the completion time
} Process; /*Datatype of the elements in the queue*/
int main( int argc, char *argv[] ){
Process process;
int fdIN; //to write to character server
int fdOUT; //to read from character server
int clientID;
clientID = getpid();
sprintf(process.name, \"FIFO_%d\", clientID);
printf(\"\ FIFO name is %s \", process.name);
if((mkfifo(process.name, 0666)<0 && errno != EEXIST))
{
perror(\"Can\'t create private FIFO\ \");
exit(-1);
}
printf(\"\ Enter burst: \ \")
scanf(\"%d\", &process.burst);
if((fdIN=open(\"commFIFO\", O_WRONLY))<0) //writting into fifo
printf(\"cant open fifo to write\");
write(fdIN, &process, sizeof(process));
if((fdOUT=open(process.name, O_RDONLY))<0) //reading from fifo
printf(\"cant open fifo to read\");
read(fdOUT, &process, sizeof(process));
printf(\"\ arrival time: %d \ \", process.arrivalTime);
unlink (\"commFIFO\");
unlink (process.name);
close(fdIN);
close(fdOUT);
}
SERVER:
#include
#include
#include
#include
#include
#include
#include
#include
//Inbox/Outbox structure
typedef struct values {
char name[30];
int arrivalTime;
int burst; //used for both the initial size of the process and to send the completion time
} Process;
//Node definition
typedef struct node{ /*Nodes stored in the linked list*/
struct values request;
struct node *next;
} Node;
//Queue Definition
typedef struct queue{ /*A struct facilitates passing a queue as an argument*/
Node *head; /*Pointer to the first node holding the queue\'s data*/
Node *tail; /*Pointer to the last node holding the queue\'s data*/
int sz; /*Number of nodes in the queue*/
} Queue;
int size( Queue *Q ){
return Q->sz;
}
int isEmpty( Queue *Q ){
if( Q->sz == 0 ) return 1;
return 0;
}
void enqueue( Queue *Q, struct values elem ){
Node *v = (Node*)malloc(sizeof(Node));/*Allocate memory for the Node*/
if( !v ){
printf(\"ERROR: Insufficien.
#define ENABLE_COMMANDER
#define ENABLE_REPORTER
#include <cctype> // for toupper()
#include <cstdlib> // for EXIT_SUCCESS and EXIT_FAILURE
#include <cstring> // for strerror()
#include <cerrno> // for errno
#include <deque> // for deque (used for ready and blocked queues)
#include <fstream> // for ifstream (used for reading simulated process programs)
#include <iostream> // for cout, endl, and cin
#include <sstream> // for stringstream (for parsing simulated process programs)
#include <sys/wait.h> // for wait()
#include <unistd.h> // for pipe(), read(), write(), close(), fork(), and _exit()
#include <vector> // for vector (used for PCB table)
using namespace std;
class Instruction {
public:
char operation;
int intArg;
string stringArg;
};
class Cpu {
public:
vector<Instruction> *pProgram;
int programCounter;
int value;
int timeSlice;
int timeSliceUsed;
};
enum State {
STATE_READY,
STATE_RUNNING,
STATE_BLOCKED,
STATE_END
};
class PcbEntry {
public:
int processId;
int parentProcessId;
vector<Instruction> program;
unsigned int programCounter;
int value;
unsigned int priority;
State state;
unsigned int startTime;
unsigned int timeUsed;
};
// The number of valid priorities.
#define NUM_PRIORITIES 4
// An array that maps priorities to their allotted time slices.
static const unsigned int PRIORITY_TIME_SLICES[NUM_PRIORITIES] = {
1,
2,
4,
8
};
unsigned int timestamp = 0;
Cpu cpu;
// For the states below, -1 indicates empty (since it is an invalid index).
int runningState = -1; // The index of the running process in the PCB table.
// readyStates is an array of queues. Each queue holds PCB indices for ready processes
// of a particular priority.
deque<int> readyStates[NUM_PRIORITIES];
deque<int> blockedState; // A queue fo PCB indices for blocked processes.
deque<int> deadState;
// In this implementation, we'll never explicitly clear PCB entries and the
// index in the table will always be the process ID. These choices waste memory,
// but since this program is just a simulation it the easiest approach.
// Additionally, debugging is simpler since table slots and process IDs are
// never re-used.
vector<PcbEntry *> pcbTable;
double cumulativeTimeDiff = 0;
int numTerminatedProcesses = 0;
// Sadly, C++ has no built-in way to trim strings:
string &trim(string &argument)
{
string whitespace(" \t\n\v\f\r");
size_t found = argument.find_last_not_of(whitespace);
if (found != string::npos) {
argument.erase(found + 1);
argument.erase(0, argument.find_first_not_of(whitespace));
} else {
argument.clear(); // all whitespace
}
return argument;
}
bool createProgram(const string &filename, vector<Instruction> &program)
{
ifstream file;
int lineNum = 0;
program.clear();
file.open(filename.c_str());
if (!file.is_open()) {
cout << "Error opening file " << filename << ...
Starting with the system calll "getrusage", this returns synchronous, process-level information, mainly max RSS used. This talk describes the output from getrusage, the rusage formatting utility in ProcStats, and several examples of using it to examine time and memory use.
Optional first & final outputs to give baseline and total status, differencing avoids extraneous output, and user messages allow arbitrary stat's and tracking content.
The combination makes this nice for tracking both long-lived and shorter, more intensive processing.
Start with the inclusion of libraries#include iostream .docxMARRY7
// Start with the inclusion of libraries
#include <iostream> //The library of io functions
#include <fstream> //The library of external stream functions
#include <cstdlib> //The library for external errors
#include <string> //The library for string functions
#include <cmath> //The library of C math functions
#include <iomanip> //Allows setting widths, etc. for I/O
#include <stdlib.h>
#include <stdio.h>
#include<vector>
using namespace std;
// Define all of the prototypes for functions used in the program
// Counts the number of unique letters seen
int countunique(int *array, int size);
// Creates the input file and formats it for use by the cipher section.
void createinput(string ifile, string ofile);
// Creates the encoded input file
void createcipher(int key, string ifile, string ofile);
// Finds and counts the number of digrams
int digram(int *pointer, string ifile);
// Counts the letter frequency in the encoded input file
int lettercount(int*, string ifile, string ofile);
// Finds the highest count in the singlton (or any other) array
int singleton(int*, int size);
// Trims an input file to the right size starting at an offset
void trimfile(string ifile, string ofile, int offset, int size);
// Begin the main function for testing
int main(int argc, char* argv[])
{
int count = 0;
int second = 0;
int singlefreq[26];
int *single = singlefreq;
int delta;
int loop; //The loop counter for arguments
int final = 0;
int totalcnt;
int key = -1; //Sets the key value
int len = 0; //The length to investigate for testing
int off; //Holds the offset into the file
double m; //Holds the metric error value
char loopletter;
float percent;
string ifile1 = "";
string ofile1 = "";
string deflt = "c:\\dissertation\\ShiftandSubcipherC++files\\clean.txt";
string ifile2 = "";
string ofile2 = ""; //Holds selected file path names
string cmdarg; //Holds the command line argument
string stop = "l"; //Gives the stop condition, assumes l
string reportfile = "c:\\dissertation\\test\\report.txt";
ofstream outs; //Declare an output stream for reporting
int digramc[676]; //Set up the digram array
int *two = digramc; //Point to the digram array
int dicount = 0; //Holds the count of the number of digrams
int total = 0; //Counts the total number of letters seen for analysis
for (loop = 1; loop<argc; loop++) //Decide if we have arguments or must use defaults
{
if (!argv[1])
{
// cout << "No argument found.\n";
ifile1 = deflt;
}
else
{
cmdarg = argv[loop];
if (cmdarg == "-k")
{
loop++;
key = atoi(argv[loop]);
cout << "key = " << key << endl;
}
if (cmdarg == "-l")
{
loop++;
len = atoi(argv[loop]);
cout << "Run for " << len << " characters.\n";
}
if (cmdarg == "-m")
{
loop++;
m = atof(argv[loop]);
cout << "Run until and error of " << m << "\n";
}
if (cmdarg == "-off")
{
loop++;
off = atoi(argv[loop]);
cout << ...
[C++] The Curiously Recurring Template Pattern: Static Polymorphsim and Expre...Francesco Casalegno
••• Exploit the full potential of the CRTP! •••
In this presentation you will learn:
▸ what is the curiously recurring template pattern
▸ the actual cost (memory and time) of virtual functions
▸ how to implement static polymorphism
▸ how to implement expression templates to avoid loops and copies
Hi,Please fidn the Answer.Sorting,h is Header .pdfanandf0099
Hi,
Please fidn the Answer.
//////////////////Sorting,h is Header file which contians all Function decalartion
#include
#include // std::cout
#include // std::shuffle
#include // std::array
#include // std::default_random_engine
#include
using namespace std;
class Sorting
{
private:
int num;
public:
Sorting::Sorting() {
};
///Buble Sort Input array and n Number of Elemnets
void BubbleSorting(int array[], int n);
void SelectionSorting(int array[], int n);
void ShuffleArray(int array[], int n);
void DisplayArray(int array[], int n);
void displayMenu();
int choice;
};
//////////////////////////Sorting.cpp is class fuction Which Implemnets the Function
#include \"Sorting.h\"
#include
using namespace std;
///Sorting the Array Using Bubble Sort...
void Sorting::BubbleSorting(int Array[],int n)
{
int temp = 0;
cout << \"\ ------------ BUBBLE SORT ------------ \ \ \";
for (int i = 1; iArray[j + 1])
{
temp = Array[j];
Array[j] = Array[j + 1];
Array[j + 1] = temp;
}
}
cout << \"\ ------------ RESULTS BUBBLE SORT ------------ \ \ \";
DisplayArray(Array, n);
}
//////SelectionSorting input Array and n is number of Elemnets//////////////////////
void Sorting::SelectionSorting(int Array[], int n)
{
int i, n, p, k, min, loc, temp;
for (p = 1; p <= n - 1; p++) // Loop for Pass
{
min = Array[p]; // Element Selection
loc = p;
for (k = p + 1; k <= n; k++) // Finding Min Value
{
if (min > Array[k])
{
min = Array[k];
loc = k;
}
}
temp = Array[p]; // Swap Selected Element and Min Value
Array[p] = Array[loc];
Array[loc] = temp;
}
cout << \"\ ------------ RESULTS SELECTION SORT ------------ \ \ \";
DisplayArray(Array, n);
}
//////SelectionSorting input Array and n is number of Elemnets//////////////////////
///exchange each element with a randomly chosen element. It\'s possible that an element will be
exchanged with itself, but there is no problem with that
void Sorting::ShuffleArray(int Array[], int n)
{
cout << \"\ ------------ ShuffleArray SORT ------------ \ \ \";
for (int i = 0; i
#include \"Sorting.h\"
using namespace std;
int main()
{
bool SelectionOn = true;
Sorting Sorting;
int choice;
int n = 10;
int *Arry;
while (SelectionOn != false) {
cout << \"*******************************\ \";
cout << \" 1 - Enter User Input Array of Elements.\ \";
cout << \" 2 - Display User Input.\ \";
cout << \" 3 - Shuffle User Input the Elements i.\ \";
cout << \" 4 - Bubble Sorting.\ \";
cout << \" 5 - Selection Sorting.\ \";
cout << \" 6 - Exit.\ \";
cout << \" 7 - Display Menu Again. \ \";
cout << \" Enter your choice and press return: \";
cin >> choice;
switch (choice)
{
case 1:
cout << \"Enter User Input Array of Elements\ \";
cout << \"Enter No. of Elements=\";
cin >> n;
Arry = new int[n];
cout << \"\ Enter Elements=\ \";
for (int i = 1; i <= n; i++)
{
cin >> Arry[i];
}
break;
case 2:
cout << \"DISPLAY OF ARRAY\ \";
if (Arry != NULL)
{
Sorting.DisplayArray(Arry, n);
}
else
{
cout << \"ENTER ELEMENTS TO ARRAY BY SELCTING CHOICE 1\ \";
}
break;
case 3:
cout << \"SHUFFLE OF A.
This what Im suppose to do and this is what I have so far.In thi.pdfkavithaarp
This what I\'m suppose to do and this is what I have so far.
In this assignment you are to create an interactive line command driven C++ program that allows
a user to do the following:
Create a bank account by supplying a user id and password
Login using this id and password
Quit the program
Upon successful login, the user will be presented with a menu to do one or more of the following
actions:
Withdraw money
Deposit money
Request balance
Quit the program
Ensure that you remove any unnecessary punctuation from monetary input (for example, all $ or
other currency symbols should be removed prior to processing, do NOT display an error message
to the user for characters which can be removed from the input string without changing the
intended value).
Format all monetary outputs on the display Currency (e.g. $ 25,928.43) with all decimal places
containing digits.
The User ID and password fields may be any combination of characters which are:
Visible when displayed on the screen (no control characters0
Normally accessible from a standard US keyboard
#include
#include
#include
using namespace std;
class Howard_COP2513_F1601 {
public:
char userInput = \'?\';
char userInput2 = \'?\';
string id = \"carl\";
string password = \"jones\";
string ID = \"?\";
string PASSWORD = \"?\";
double DEPOSIT = 0.00;
double WITHDRAW = 0.00;
double OLDBALANCE = 0.00;
double NEWBALANCE = 0.00;
void bankOption() {
cout << \"Please select an option: \" << endl;
cout << \"l -> Login \" << endl;
cout << \"c -> Create New Account \" << endl;
cout << \"q -> Quit \" << endl;
cin >> userInput;
if (userInput == \'l\' || \'L\') {
login();
}
else if (userInput == \'c\' || \'C\') {
createAcnt();
}
else if (userInput == \'q\' || \'Q\') {
quit();
}
}
void moneyOption() {
cout << \"d -> Deposit Money \" << endl;
cout << \"w -> Withdraw Money \" << endl;
cout << \"r -> Request Balance\" << endl;
cin >> userInput2;
if (userInput2 == \'d\' || \'D\') {
dMoney();
}
else if (userInput2 == \'w\' || \'W\') {
wMoney();
}
else if (userInput2 == \'r\' || \'R\') {
rBalance();
}
}
int login() {
cout << \"Please enter your user id: \" << endl;
cin >> ID;
cout << \"Please enter your password: \" << endl;
cin >> PASSWORD;
if (id != ID && password != PASSWORD) {
cout << \"Access Granted - \" << ID << endl;
}
else {
cout << \"******** \" << \"LOGIN FAILED! \" << \"********\" << endl;
bankOption();
}
moneyOption();
return 0;
}
int createAcnt() {
cout << \"Please enter your user name: \" << endl;
cin >> ID;
cout << \"Please enter your password: \" << endl;
cin >> PASSWORD;
bankOption();
return 0;
}
int quit() {
cout << \"Thanks for banking with COP2513.F16,\";
system(\"pause\");
return 0;
}
int dMoney() {
cout << \"Amount of deposit: \" << endl;
cin >> DEPOSIT;
OLDBALANCE = NEWBALANCE;
NEWBALANCE = OLDBALANCE + DEPOSIT;
moneyOption();
return 0;
}
int wMoney() {
cout << \"Amount of withdrawal: \" << endl;
cin >> WITHDRAW;
OLDBALANCE = NEWBALANCE;
NEWBALANCE = OLDBALANCE - WITHDRAW;
moneyOption();
return 0;.
C, D, and E are wrong and involve random constants. Thisnarrows it d.pdfarasanlethers
C, D, and E are wrong and involve random constants. Thisnarrows it down to A and B; it is A
because the negative sign meansthat energy is being given off when it (SO2) forms.
I hope you found this helpful, please rate! :)
I hope you found this helpful, please rate! :)
Solution
C, D, and E are wrong and involve random constants. Thisnarrows it down to A and B; it is A
because the negative sign meansthat energy is being given off when it (SO2) forms.
I hope you found this helpful, please rate! :)
I hope you found this helpful, please rate! :).
More Related Content
Similar to main.cpp #include iostream #include iomanip #include S.pdf
Starting with the system calll "getrusage", this returns synchronous, process-level information, mainly max RSS used. This talk describes the output from getrusage, the rusage formatting utility in ProcStats, and several examples of using it to examine time and memory use.
Optional first & final outputs to give baseline and total status, differencing avoids extraneous output, and user messages allow arbitrary stat's and tracking content.
The combination makes this nice for tracking both long-lived and shorter, more intensive processing.
Start with the inclusion of libraries#include iostream .docxMARRY7
// Start with the inclusion of libraries
#include <iostream> //The library of io functions
#include <fstream> //The library of external stream functions
#include <cstdlib> //The library for external errors
#include <string> //The library for string functions
#include <cmath> //The library of C math functions
#include <iomanip> //Allows setting widths, etc. for I/O
#include <stdlib.h>
#include <stdio.h>
#include<vector>
using namespace std;
// Define all of the prototypes for functions used in the program
// Counts the number of unique letters seen
int countunique(int *array, int size);
// Creates the input file and formats it for use by the cipher section.
void createinput(string ifile, string ofile);
// Creates the encoded input file
void createcipher(int key, string ifile, string ofile);
// Finds and counts the number of digrams
int digram(int *pointer, string ifile);
// Counts the letter frequency in the encoded input file
int lettercount(int*, string ifile, string ofile);
// Finds the highest count in the singlton (or any other) array
int singleton(int*, int size);
// Trims an input file to the right size starting at an offset
void trimfile(string ifile, string ofile, int offset, int size);
// Begin the main function for testing
int main(int argc, char* argv[])
{
int count = 0;
int second = 0;
int singlefreq[26];
int *single = singlefreq;
int delta;
int loop; //The loop counter for arguments
int final = 0;
int totalcnt;
int key = -1; //Sets the key value
int len = 0; //The length to investigate for testing
int off; //Holds the offset into the file
double m; //Holds the metric error value
char loopletter;
float percent;
string ifile1 = "";
string ofile1 = "";
string deflt = "c:\\dissertation\\ShiftandSubcipherC++files\\clean.txt";
string ifile2 = "";
string ofile2 = ""; //Holds selected file path names
string cmdarg; //Holds the command line argument
string stop = "l"; //Gives the stop condition, assumes l
string reportfile = "c:\\dissertation\\test\\report.txt";
ofstream outs; //Declare an output stream for reporting
int digramc[676]; //Set up the digram array
int *two = digramc; //Point to the digram array
int dicount = 0; //Holds the count of the number of digrams
int total = 0; //Counts the total number of letters seen for analysis
for (loop = 1; loop<argc; loop++) //Decide if we have arguments or must use defaults
{
if (!argv[1])
{
// cout << "No argument found.\n";
ifile1 = deflt;
}
else
{
cmdarg = argv[loop];
if (cmdarg == "-k")
{
loop++;
key = atoi(argv[loop]);
cout << "key = " << key << endl;
}
if (cmdarg == "-l")
{
loop++;
len = atoi(argv[loop]);
cout << "Run for " << len << " characters.\n";
}
if (cmdarg == "-m")
{
loop++;
m = atof(argv[loop]);
cout << "Run until and error of " << m << "\n";
}
if (cmdarg == "-off")
{
loop++;
off = atoi(argv[loop]);
cout << ...
[C++] The Curiously Recurring Template Pattern: Static Polymorphsim and Expre...Francesco Casalegno
••• Exploit the full potential of the CRTP! •••
In this presentation you will learn:
▸ what is the curiously recurring template pattern
▸ the actual cost (memory and time) of virtual functions
▸ how to implement static polymorphism
▸ how to implement expression templates to avoid loops and copies
Hi,Please fidn the Answer.Sorting,h is Header .pdfanandf0099
Hi,
Please fidn the Answer.
//////////////////Sorting,h is Header file which contians all Function decalartion
#include
#include // std::cout
#include // std::shuffle
#include // std::array
#include // std::default_random_engine
#include
using namespace std;
class Sorting
{
private:
int num;
public:
Sorting::Sorting() {
};
///Buble Sort Input array and n Number of Elemnets
void BubbleSorting(int array[], int n);
void SelectionSorting(int array[], int n);
void ShuffleArray(int array[], int n);
void DisplayArray(int array[], int n);
void displayMenu();
int choice;
};
//////////////////////////Sorting.cpp is class fuction Which Implemnets the Function
#include \"Sorting.h\"
#include
using namespace std;
///Sorting the Array Using Bubble Sort...
void Sorting::BubbleSorting(int Array[],int n)
{
int temp = 0;
cout << \"\ ------------ BUBBLE SORT ------------ \ \ \";
for (int i = 1; iArray[j + 1])
{
temp = Array[j];
Array[j] = Array[j + 1];
Array[j + 1] = temp;
}
}
cout << \"\ ------------ RESULTS BUBBLE SORT ------------ \ \ \";
DisplayArray(Array, n);
}
//////SelectionSorting input Array and n is number of Elemnets//////////////////////
void Sorting::SelectionSorting(int Array[], int n)
{
int i, n, p, k, min, loc, temp;
for (p = 1; p <= n - 1; p++) // Loop for Pass
{
min = Array[p]; // Element Selection
loc = p;
for (k = p + 1; k <= n; k++) // Finding Min Value
{
if (min > Array[k])
{
min = Array[k];
loc = k;
}
}
temp = Array[p]; // Swap Selected Element and Min Value
Array[p] = Array[loc];
Array[loc] = temp;
}
cout << \"\ ------------ RESULTS SELECTION SORT ------------ \ \ \";
DisplayArray(Array, n);
}
//////SelectionSorting input Array and n is number of Elemnets//////////////////////
///exchange each element with a randomly chosen element. It\'s possible that an element will be
exchanged with itself, but there is no problem with that
void Sorting::ShuffleArray(int Array[], int n)
{
cout << \"\ ------------ ShuffleArray SORT ------------ \ \ \";
for (int i = 0; i
#include \"Sorting.h\"
using namespace std;
int main()
{
bool SelectionOn = true;
Sorting Sorting;
int choice;
int n = 10;
int *Arry;
while (SelectionOn != false) {
cout << \"*******************************\ \";
cout << \" 1 - Enter User Input Array of Elements.\ \";
cout << \" 2 - Display User Input.\ \";
cout << \" 3 - Shuffle User Input the Elements i.\ \";
cout << \" 4 - Bubble Sorting.\ \";
cout << \" 5 - Selection Sorting.\ \";
cout << \" 6 - Exit.\ \";
cout << \" 7 - Display Menu Again. \ \";
cout << \" Enter your choice and press return: \";
cin >> choice;
switch (choice)
{
case 1:
cout << \"Enter User Input Array of Elements\ \";
cout << \"Enter No. of Elements=\";
cin >> n;
Arry = new int[n];
cout << \"\ Enter Elements=\ \";
for (int i = 1; i <= n; i++)
{
cin >> Arry[i];
}
break;
case 2:
cout << \"DISPLAY OF ARRAY\ \";
if (Arry != NULL)
{
Sorting.DisplayArray(Arry, n);
}
else
{
cout << \"ENTER ELEMENTS TO ARRAY BY SELCTING CHOICE 1\ \";
}
break;
case 3:
cout << \"SHUFFLE OF A.
This what Im suppose to do and this is what I have so far.In thi.pdfkavithaarp
This what I\'m suppose to do and this is what I have so far.
In this assignment you are to create an interactive line command driven C++ program that allows
a user to do the following:
Create a bank account by supplying a user id and password
Login using this id and password
Quit the program
Upon successful login, the user will be presented with a menu to do one or more of the following
actions:
Withdraw money
Deposit money
Request balance
Quit the program
Ensure that you remove any unnecessary punctuation from monetary input (for example, all $ or
other currency symbols should be removed prior to processing, do NOT display an error message
to the user for characters which can be removed from the input string without changing the
intended value).
Format all monetary outputs on the display Currency (e.g. $ 25,928.43) with all decimal places
containing digits.
The User ID and password fields may be any combination of characters which are:
Visible when displayed on the screen (no control characters0
Normally accessible from a standard US keyboard
#include
#include
#include
using namespace std;
class Howard_COP2513_F1601 {
public:
char userInput = \'?\';
char userInput2 = \'?\';
string id = \"carl\";
string password = \"jones\";
string ID = \"?\";
string PASSWORD = \"?\";
double DEPOSIT = 0.00;
double WITHDRAW = 0.00;
double OLDBALANCE = 0.00;
double NEWBALANCE = 0.00;
void bankOption() {
cout << \"Please select an option: \" << endl;
cout << \"l -> Login \" << endl;
cout << \"c -> Create New Account \" << endl;
cout << \"q -> Quit \" << endl;
cin >> userInput;
if (userInput == \'l\' || \'L\') {
login();
}
else if (userInput == \'c\' || \'C\') {
createAcnt();
}
else if (userInput == \'q\' || \'Q\') {
quit();
}
}
void moneyOption() {
cout << \"d -> Deposit Money \" << endl;
cout << \"w -> Withdraw Money \" << endl;
cout << \"r -> Request Balance\" << endl;
cin >> userInput2;
if (userInput2 == \'d\' || \'D\') {
dMoney();
}
else if (userInput2 == \'w\' || \'W\') {
wMoney();
}
else if (userInput2 == \'r\' || \'R\') {
rBalance();
}
}
int login() {
cout << \"Please enter your user id: \" << endl;
cin >> ID;
cout << \"Please enter your password: \" << endl;
cin >> PASSWORD;
if (id != ID && password != PASSWORD) {
cout << \"Access Granted - \" << ID << endl;
}
else {
cout << \"******** \" << \"LOGIN FAILED! \" << \"********\" << endl;
bankOption();
}
moneyOption();
return 0;
}
int createAcnt() {
cout << \"Please enter your user name: \" << endl;
cin >> ID;
cout << \"Please enter your password: \" << endl;
cin >> PASSWORD;
bankOption();
return 0;
}
int quit() {
cout << \"Thanks for banking with COP2513.F16,\";
system(\"pause\");
return 0;
}
int dMoney() {
cout << \"Amount of deposit: \" << endl;
cin >> DEPOSIT;
OLDBALANCE = NEWBALANCE;
NEWBALANCE = OLDBALANCE + DEPOSIT;
moneyOption();
return 0;
}
int wMoney() {
cout << \"Amount of withdrawal: \" << endl;
cin >> WITHDRAW;
OLDBALANCE = NEWBALANCE;
NEWBALANCE = OLDBALANCE - WITHDRAW;
moneyOption();
return 0;.
C, D, and E are wrong and involve random constants. Thisnarrows it d.pdfarasanlethers
C, D, and E are wrong and involve random constants. Thisnarrows it down to A and B; it is A
because the negative sign meansthat energy is being given off when it (SO2) forms.
I hope you found this helpful, please rate! :)
I hope you found this helpful, please rate! :)
Solution
C, D, and E are wrong and involve random constants. Thisnarrows it down to A and B; it is A
because the negative sign meansthat energy is being given off when it (SO2) forms.
I hope you found this helpful, please rate! :)
I hope you found this helpful, please rate! :).
AnswerOogenesis is the process by which ovum mother cells or oogo.pdfarasanlethers
Answer:
Oogenesis is the process by which ovum mother cells or oogonia gives rise to mature ovum- the
female gametes. The process takes place in the outermost layer- the germinal epithelium of the
ovary.
Meiotic Events in oogenesis:
Initially before birth, the oogonium undergoes mitotic divisions so as to increase its number. This
process takes place during the embryonic growth phase. No further addition to this number takes
place after birth. In the human embryo, the thousand or so oogonia divide rapidly from the
second to the seventh month of gestation to form roughly 7 million germ cells. After the seventh
month though, there is a sharp decline in the number of these newly formed cells. These
remaining cells are the ones entering the reductional division of meiosis (meiosis-1). These cells
enters into meiosis-1 but they are unable to advance through Prophase-1 of meiosis. These cells
are arrested in the diplotene sub-stage of Prophase-1 and they are maintained at this stage until
puberty. These cells are now known as primary oocytes. Even the primary oocytes continue to
die during this phase. Roughly only about 400 oocytes mature during the reproductive life of a
female periodically. At the onset of puberty, specific hormonal cues re-initiate the process of
meiosis.
During adolescence, the GnRH or gonadotropin releasing hormones released from the
hypothalamus signals the anterior pituitary to release hormones like LH & FSH which lifts the
cell cycle arrest in these cells and assists them in resuming meiosis. The primary oocytes
completes meiosis-1 and gives rise to a tiny polar body and another larger secondary oocyte with
greater content of cytoplasm ( unequal cell division). In some organisms , the polar bodies may
again divide to form 2 polar bodies while it dies off in case of humans. The secondary oocyte
thus produced advances through Meiosis-2 ( equational division) but halts at meiosis-2. The
secondary oocyte is released from the follicle and it travels towards the fallopian tube. The
immature secondary oocyte can re-enter cell cycle and complete the remaining sub-stages of
meiosis-2 only if union with a sperm takes place. The secondary oocyte progresses through
meiosis-2 giving rise to another polar body and a female pro-nucleus which unites with the
sperm and gives rise to the zygote or the fertilized egg. Thus begins the process of embryonic
development.
Developmental process in oogenesis:
Oogonia are formed from the primoridial germ cells of the ovary by mitotic cell division. By
growth & maturation oogonia increase in size and become primary oocytes. During this phase,
synthesis of food and factors required for further differentiation are synthesized. During the
growth phase, the primary oocytes gets surrounded by specialized cells of the ovary known as
follicle cells. Once they are fully formed, cavities are formed and these gets filled with their own
secretion. At this stage, it is known as Graafian follicle. Oocyte collects .
AnswerB) S. typhimuium gains access to the host by crossing the.pdfarasanlethers
Answer:
B) S. typhimuium gains access to the host by crossing the intestinal epithelium inside M cells
The M cells are found in the gut-associated lymphoid tissue (GALT) of the Peyer\'s patches and
in the mucosa-associated lymphoid tissue (MALT) of other parts of the gastrointestinal tract.
These cells are known to initiate mucosal immunityresponses on the apical membrane of the M
cells and allow for transport of microbes and particles across the epithelial cell layer from the gut
lumen to the lamina propria where interactions with immune cells can take place. M cells have
the unique ability to take up antigen from the lumen of the small intestine via endocytosis,
phagocytosis, or transcytosis.
Solution
Answer:
B) S. typhimuium gains access to the host by crossing the intestinal epithelium inside M cells
The M cells are found in the gut-associated lymphoid tissue (GALT) of the Peyer\'s patches and
in the mucosa-associated lymphoid tissue (MALT) of other parts of the gastrointestinal tract.
These cells are known to initiate mucosal immunityresponses on the apical membrane of the M
cells and allow for transport of microbes and particles across the epithelial cell layer from the gut
lumen to the lamina propria where interactions with immune cells can take place. M cells have
the unique ability to take up antigen from the lumen of the small intestine via endocytosis,
phagocytosis, or transcytosis..
Answer question1,2,4,5Ion–dipole interactionsAffinity of oxygen .pdfarasanlethers
Answer question
1,2,4,5Ion–dipole interactionsAffinity of oxygen towards cationsDipole–dipole
interactionsHydrationAffinity of hydrogen towards anionsHydrogen bonding
Solution
Answer question
1,2,4,5Ion–dipole interactionsAffinity of oxygen towards cationsDipole–dipole
interactionsHydrationAffinity of hydrogen towards anionsHydrogen bonding.
A Letter to myself!Hi to myself!Now that I am an Engineer with a.pdfarasanlethers
A Letter to myself!
Hi to myself!
Now that I am an Engineer with a certified degree, as an Engineer I aspire to do some wonderful
things for myself and society. As I studied the Civil Engineering and about the wonders that it
has created for the well being of the society and the world, it amused me and inpired me to
become an Engineer. I want to design the bridges, tunnels, skyscrappers and dams which
wouldn\'t fail and please to the eyes. In history we have seen the engineering disasters such as
the Tacoma Washington bridge disaster, in which the wind loads were ignored while designing.
We learned from such disasters and improved our bridge by incorporating the wind and other
loads such as earthquake loads. There has been a revolution in the Civil Engineering field since
the advent of the cement and reinforced concrete. Initially we could only design low strength
concrete but now with the help of the admixtures and air-entraining agents we can design a mix
of strength greater than 70 MPa.
Empire State Building was constructed in 1932 and remained the tallest skyscraper till 1967,
until we learn to create the taller structures. Now we know that Burj Khalifa is the tallest
standing structure in the world with a height almost double of that of Empire state building.
Empire state building is now at 9th in the ranking of the tallest structure. Similarl trends can be
observed in the design of the bridges, tunnels and dams.
What we learn from all this history is that, there is never a full stop to the impovement of the
design of the structures. In present world, we still have many problems, such as the
environmental issues related with the use and production of the cement, which is responsible for
the production of a large proportion of the green house gases. There is a need to find the better
alternative of the cement. We still can\'t construct the earthquake proof buildings, and there
always will be a need for improvement in this field. More than one million people die each year
in the road crashes, many of which occur due to the poor design and construction, there is a need
of the better Intelligent Traffic Systems(ITS.)
I see that there is a lot to be improved in the current engineering field, so I will find the best
opportunity to serve my techniques and skills to work in any of the abovementioned fields.
Thank You!
Solution
A Letter to myself!
Hi to myself!
Now that I am an Engineer with a certified degree, as an Engineer I aspire to do some wonderful
things for myself and society. As I studied the Civil Engineering and about the wonders that it
has created for the well being of the society and the world, it amused me and inpired me to
become an Engineer. I want to design the bridges, tunnels, skyscrappers and dams which
wouldn\'t fail and please to the eyes. In history we have seen the engineering disasters such as
the Tacoma Washington bridge disaster, in which the wind loads were ignored while designing.
We learned from such disasters and .
Particulars Amount ($) Millons a) Purchase consideratio.pdfarasanlethers
Particulars Amount ($) Millons a) Purchase consideration paid 6.3 b) Net Assets
Aquired: Land 1.2 Buildings 2.9 Inventory 1.7 Liabilities -1 4.8 (a) - (b)
Good Will 1.5
Solution
Particulars Amount ($) Millons a) Purchase consideration paid 6.3 b) Net Assets
Aquired: Land 1.2 Buildings 2.9 Inventory 1.7 Liabilities -1 4.8 (a) - (b)
Good Will 1.5.
while determining the pH the pH of the water is n.pdfarasanlethers
while determining the pH the pH of the water is not considered actually when salts
are added to water it dissciated to form H+ ions leading to increase in H+ ion concentration and
decrease in pH
Solution
while determining the pH the pH of the water is not considered actually when salts
are added to water it dissciated to form H+ ions leading to increase in H+ ion concentration and
decrease in pH.
Quantum Numbers and Atomic Orbitals By solving t.pdfarasanlethers
Quantum Numbers and Atomic Orbitals By solving the Schrödinger equation (Hy
= Ey), we obtain a set of mathematical equations, called wave functions (y), which describe the
probability of finding electrons at certain energy levels within an atom. A wave function for an
electron in an atom is called an atomic orbital; this atomic orbital describes a region of space in
which there is a high probability of finding the electron. Energy changes within an atom are the
result of an electron changing from a wave pattern with one energy to a wave pattern with a
different energy (usually accompanied by the absorption or emission of a photon of light). Each
electron in an atom is described by four different quantum numbers. The first three (n, l, ml)
specify the particular orbital of interest, and the fourth (ms) specifies how many electrons can
occupy that orbital. Principal Quantum Number (n): n = 1, 2, 3, …, 8 Specifies the energy of
an electron and the size of the orbital (the distance from the nucleus of the peak in a radial
probability distribution plot). All orbitals that have the same value of n are said to be in the same
shell (level). For a hydrogen atom with n=1, the electron is in its ground state; if the electron is in
the n=2 orbital, it is in an excited state. The total number of orbitals for a given n value is n2.
Angular Momentum (Secondary, Azimunthal) Quantum Number (l): l = 0, ..., n-1. Specifies the
shape of an orbital with a particular principal quantum number. The secondary quantum number
divides the shells into smaller groups of orbitals called subshells (sublevels). Usually, a letter
code is used to identify l to avoid confusion with n: l 0 1 2 3 4 5 ... Letter s p d f g h ... The
subshell with n=2 and l=1 is the 2p subshell; if n=3 and l=0, it is the 3s subshell, and so on. The
value of l also has a slight effect on the energy of the subshell; the energy of the subshell
increases with l (s < p < d < f). Magnetic Quantum Number (ml): ml = -l, ..., 0, ..., +l. Specifies
the orientation in space of an orbital of a given energy (n) and shape (l). This number divides the
subshell into individual orbitals which hold the electrons; there are 2l+1 orbitals in each subshell.
Thus the s subshell has only one orbital, the p subshell has three orbitals, and so on. Spin
Quantum Number (ms): ms = +½ or -½. Specifies the orientation of the spin axis of an electron.
An electron can spin in only one of two directions (sometimes called up and down). The Pauli
exclusion principle (Wolfgang Pauli, Nobel Prize 1945) states that no two electrons in the same
atom can have identical values for all four of their quantum numbers. What this means is that no
more than two electrons can occupy the same orbital, and that two electrons in the same orbital
must have opposite spins. Because an electron spins, it creates a magnetic field, which can be
oriented in one of two directions. For two electrons in the same orbital, the spins must be
opposite to each oth.
They are molecules that are mirror images of each.pdfarasanlethers
They are molecules that are mirror images of each other. They have the same basic
structure, but are rearranged in such a way that it is impossible to turn one into the other by
simple rotation.
Solution
They are molecules that are mirror images of each other. They have the same basic
structure, but are rearranged in such a way that it is impossible to turn one into the other by
simple rotation..
Well u put so many type of compounds here.Generally speakingi) t.pdfarasanlethers
Well u put so many type of compounds here.
Generally speaking
i) the materials or compounds or biological compounds which contains acidic protons [ the
protons which can be replaceable by the addition of base]
ii) compounds containing double bonds i.e. unsaturation
iii) compounds containing polar functional groups like aldehyde , ketones , esters etc
do react dramatically with the addition of acids or bases.
eg. materials :- inorganic acid / bases
biological system :- porphyrene system [contains replaceable hydrogen atoms]
Solution
Well u put so many type of compounds here.
Generally speaking
i) the materials or compounds or biological compounds which contains acidic protons [ the
protons which can be replaceable by the addition of base]
ii) compounds containing double bonds i.e. unsaturation
iii) compounds containing polar functional groups like aldehyde , ketones , esters etc
do react dramatically with the addition of acids or bases.
eg. materials :- inorganic acid / bases
biological system :- porphyrene system [contains replaceable hydrogen atoms].
Ventilation is the process of air going in and out of lungs. Increas.pdfarasanlethers
Ventilation is the process of air going in and out of lungs. Increased ventilation elevates the
oxygen level in arterial blood. It also alters the pH of blood, calcium level affecting the nerves,
muscles etc.
Solution
Ventilation is the process of air going in and out of lungs. Increased ventilation elevates the
oxygen level in arterial blood. It also alters the pH of blood, calcium level affecting the nerves,
muscles etc..
A1) A living being or an individual is known as an organism and it i.pdfarasanlethers
A1) A living being or an individual is known as an organism and it is a member of a species. A
species is a group of organisms that contains a set of specialized characteristics which distinguish
them from other organisms. The number of variety of species occurring in a community is
known as the species diversity. Species diversity has two important components-species richness
and species evenness. The species richness is the number of different species present in a
community. For example, a biological community like a coral reef contains large number of
species existing within the community and exhibits the high species richness. In contrast a forest
community containing limited number of specific plants exhibits low species richness. More
number of species present in an ecosystem represent its health because of the absence of factors
like nutrient depletion, competition, predation and extinction of species.
A2) New species arrive in habitat by geographical isolation and by immigration. The island
closer to the main land becomes a big source of immigration and have higher immigration rate
and contains higher species richness. The island distant from the main land has low immigration
rates because the species have to travel a lot to reach the island. Thus, these two factors influence
the species richness on the islands.
A3) A species chooses a specific habitat depending on availability of resources like nutrients and
other biotic factors. A diverse ecosystem with great variety of producer species producing more
plant biomass supports a great variety of a consumer species. The greater species richness in an
ecosystem makes it more productive, stable and sustainable. The greater species richness
promotes the food web and biotic interactions within the ecosystems resulting in greater
sustainability and enables to withstand the environmental disturbances like drought.
A4)
Native species are those that live in a specific ecosystem. Other species that migrate or
accidentally introduced in to another ecosystem are called as non native species or invasive or
exotic species.
The species that indicate or intimate the early warning of the damage to a community or an
ecosystem are known as indicator species. Birds are very good biological indicators as they can
predict the environmental changes rapidly.
The habitat loss by species is due to human activitites which introduce a species into a new
geographic location. For example, wild African honey bees known as killer bees were imported
to Brazil and caused damaged to native honey bees. Human activities like heavy utilization of
chemical pesticides is declining the populations of bird species. Butter flies are also good
indicator species as they are associated with several plant species making them vulnerable to
habitat loss and fragmentation due to heavy chemical fertilizers and pesticide usage. These
activities make the species to find new habitat to colonize and survive.
Solution
A1) A living being or .
there are laws and regulations that would pertain to an online breac.pdfarasanlethers
there are laws and regulations that would pertain to an online breach of 10,000 patient records
with identifiable data such as ssn and payment history ie HIPAA (health insurance portability
and accountability act ) is a fedral law that provides baseline privacy and security standards for
medical information and the us department health and human services is the fedral agency
incharge of creating rules that implement HIPAA and also enforcing HIPAA and this security
rule ie it protects only electronic medical records and it also applies to covered entities and there
are three types of covered entities ie health care providers get paid to provide health care doctors
, dentists , nursing homes ,hospitals, urgent medical care etc and the health care in order to
provide health care in exchange for payment . health plans play the cost of medical care like
health insurance companies .health care clearing houses process information so that it can be
transmitted in standard format between covered entities for eg they take the important
information from doctor and put it in standard code format that can be used for insurance
purposes . a bussiness associate acts as subcontractors as they creates , receives , maintains or
transmits the protected health information on behalf of covered entity and the responsibility of
bussiness associates that they make sure that they should protect patient health records according
to HIPAA standards.HIPAA privacy rules applies to protect health information which includes
all individual identifiable health information which includes patient health records about past
present and future and there mental health records and treatment provided to persons and their
payments and they also includes names , date of birth and addresses and phone no and social
securit numbers and they also protect the conversations between patient and doctors have the
same privacy . there are some violation rules if any wrong happens then individual can file case
against them according to HIPAA rules .
therefore the security of the data will continue to grow importance as health care industries move
towards greater implementation of electronic health records . personal electronic health records
devices , independent consent management tools and privacy preserving datamining and
statistical disclosure limitations and pesudonymization in this phase they replace the patient
names by providing with patient ids that can be linked to their original identities and it protects
individual identities .whereas in independent consent management tools relies on health trust as
they store health related data if researchers want to search health data they should first contact
health trusts where as personl electronic devices requires personal computer to manage their
health information . these are the rules and laws to protect patients records and data and their
payments .
Solution
there are laws and regulations that would pertain to an online breach of 10,000 pat.
The false statement among the given list is “Territoriality means ho.pdfarasanlethers
The false statement among the given list is “Territoriality means holding space, while
preemption means defending space.”
The actual meaning of territoriality means, defending space in which exclusion of aggressive
behaviour occurs, and preemption means holding space.
Solution
The false statement among the given list is “Territoriality means holding space, while
preemption means defending space.”
The actual meaning of territoriality means, defending space in which exclusion of aggressive
behaviour occurs, and preemption means holding space..
The current article is discussing about the role of SOX4 geneprotei.pdfarasanlethers
The current article is discussing about the role of SOX4 gene/protein in the metastasis, and
tumourogenesis.
Introduction:-
SOX 4 is the transcription factor produces Sox4 protein in humans,which regulates the
embryonic development and it directly invovles in the apoptosis regulation leading to the
tumourogenesis. The malfunction of the gene results in the decreement of parathyroid hormone
production so that bone desoption occurs.
In the current study explain importance of the SOX 4 gene, the interdigital tissue is lysed by the
apoptosis by the expression of SOX4 protein, so in the carcinoma cells, if we knock down of this
gene causes the decreeased cell proliferation and induced apoptosis by activating caspases 3 and
7.
It causes various carcinoma like example : Intra hepatitic metastatisis tissue, prostate cancer,lung
cancer, colorectal cancer, breast cancer, myeloma,pineoblastoma, bladder cancer , gastric cancer.
these all types are due high expression of SOX 4 gene(upregulation or over production).
Solution
The current article is discussing about the role of SOX4 gene/protein in the metastasis, and
tumourogenesis.
Introduction:-
SOX 4 is the transcription factor produces Sox4 protein in humans,which regulates the
embryonic development and it directly invovles in the apoptosis regulation leading to the
tumourogenesis. The malfunction of the gene results in the decreement of parathyroid hormone
production so that bone desoption occurs.
In the current study explain importance of the SOX 4 gene, the interdigital tissue is lysed by the
apoptosis by the expression of SOX4 protein, so in the carcinoma cells, if we knock down of this
gene causes the decreeased cell proliferation and induced apoptosis by activating caspases 3 and
7.
It causes various carcinoma like example : Intra hepatitic metastatisis tissue, prostate cancer,lung
cancer, colorectal cancer, breast cancer, myeloma,pineoblastoma, bladder cancer , gastric cancer.
these all types are due high expression of SOX 4 gene(upregulation or over production)..
The major similarities between rocks and minerals are as follows1.pdfarasanlethers
The major similarities between rocks and minerals are as follows:
1. Both of them are geological substances which exists on earth.
2. Both are solid, inorganic and naturally-occuring substances.
However, these are different in following ways:
1. Rocks are classified by geological processes whereas minerals are classified by chemical
processes.
2. Rocks do not play any role in biological processes whereas minerals play definitive role.
3. Sometivmes, fosil remains are found embeded inside rocks while minerals don\'t have fossils.
Solution
The major similarities between rocks and minerals are as follows:
1. Both of them are geological substances which exists on earth.
2. Both are solid, inorganic and naturally-occuring substances.
However, these are different in following ways:
1. Rocks are classified by geological processes whereas minerals are classified by chemical
processes.
2. Rocks do not play any role in biological processes whereas minerals play definitive role.
3. Sometivmes, fosil remains are found embeded inside rocks while minerals don\'t have fossils..
Pipelining understandingPipelining is running multiple stages of .pdfarasanlethers
Pipelining understanding:
Pipelining is running multiple stages of the same process in parallel in a way that efficiently uses
all the available hardware while respecting the dependencies of each stage upon the previous
stages. In the laundry example, the stages are washing, drying, and folding. By starting a wash
stage as soon as the previous wash stage is moved to the dryer, the idle time of the washer is
minimized. Notice that the wash stage takes less time than the dry stage, so the wash stage must
remain idle until the dry stage finishes: the steady state throughput of the pipeline is limited by
the slowest stage in the pipeline. This can be mitigated by breaking up the bottleneck stage into
smaller sub-stages. For those less concerned with laundry-based examples, consider a video
game. The CPU computes the keyboard/mouse input each frame and moves the camera
accordingly, then the GPU takes that information and actually renders the scene; meanwhile, the
CPU has already begun calculating what\'s going to happen in the next frame.
How Pipelining will done:
In class, we mentioned that interpreting each computer instruction is a four step process: fetching
the instruction, decoding it and reading the register, executing it, and recording the results. Each
instruction may take 4 cycles to complete, but if our throughput is one instruction each cycle,
then we would like to perform, on average, $n$ instructions every $n$ cycles. To accomplish
this, we can split up an instruction\'s work into the 4 different steps so that other pieces of
hardware work to decode, execute, and record results while the CPU performs the fetch. The
latency to process each instruction is fixed at 4 cycles, so by processing a new instruction every
cycle, after four cycles, one instruction has been completed and three are \"in progress\" (they\'re
in the pipeline). After many cycles the steady state throughput approaches one completed
instruction every cycle.
An assembly line in a auto manufacturing plant is another good example of a pipelined process.
There are many steps in the assembly of the car, each of which is assigned a stage in the pipeline.
Typically the depth of these pipelines is very large: cars are pretty complex, so there need to be a
lot of stages in the assembly line. The more stages, the longer it takes to crank the system up to a
steady state. The larger the depth, the more costly it is to turn the system around: A branch
misprediction in an instruction pipeline would be like getting one of the steps wrong in the
assembly line: all the cars affected would have to go back to the beginning of the assembly line
and be processed again.
OnLive Example[Realtime]:
OnLive is a company that allows gamers to play video games in the cloud. The games are run on
one of the company\'s server farms, and video of the game is sent back to your computer. The
idea is that even the lamest of computers can run the most highly intensive games because all the
computer does .
12). Choose the letter designation that represent homozygous recessi.pdfarasanlethers
12). Choose the letter designation that represent homozygous recessive genotypte?
c. ee
As there are always two letters in the genotype because one code for the trait come from materal
and other code for the trait comes from paternal oraganism, so every organism has two codes (
letters ). The two lowercase letters in the genotype referred as homozygous recessive genotype(
ee). The term pure may also used in place of homozygous.
13). Daughter nuclei form from each parent cell during
a. Telophase I and telophase II
In both at each pole, a daughter nucleus with nuclear membrane( from ER) and nucleolus( from
SAT chromosome) is formedand also there is disappearance of astral rays and spindle fibres.
14). The diploid human cell has _ chromosomes.
- 46
The diploid number is abbreviated as 2n because of the presence of twice the amount of
chromosomes as a haploid cell. The haploid cell has a total of 23 chromosomes while the diploid
cell has 46 chromosomes.
15). Choose all that are true about genes
- genes are located on chromosomes
- genes are units of inheritence about heritable trait
- genes are arranged in a linear sequence on a chromosome
- each gene has its own location,in one type of chromosome
16).Mendal theory of independent assortment states that
a. genes for different traits are randomly distributed to gametes during meiosis.
17). Pairs of homologus chromosomes exist
a. during meiosis I
It is a special type of division in which chromosomes duplicate only once, but cell divides twice.
So one parental cell produces 4 daughter cells.
18). Alternate forms of genes are called_
- alleles
19). The physical appearance of an individual is referrred to as its
b. Phenotype
20). The genetic make- up of an individual is referred to as its
a.Genotype
21). Why the sexual reproduction benefit for the organism?
all of these are true.
22). The various forms of particular gene are called
b. alleles
Solution
12). Choose the letter designation that represent homozygous recessive genotypte?
c. ee
As there are always two letters in the genotype because one code for the trait come from materal
and other code for the trait comes from paternal oraganism, so every organism has two codes (
letters ). The two lowercase letters in the genotype referred as homozygous recessive genotype(
ee). The term pure may also used in place of homozygous.
13). Daughter nuclei form from each parent cell during
a. Telophase I and telophase II
In both at each pole, a daughter nucleus with nuclear membrane( from ER) and nucleolus( from
SAT chromosome) is formedand also there is disappearance of astral rays and spindle fibres.
14). The diploid human cell has _ chromosomes.
- 46
The diploid number is abbreviated as 2n because of the presence of twice the amount of
chromosomes as a haploid cell. The haploid cell has a total of 23 chromosomes while the diploid
cell has 46 chromosomes.
15). Choose all that are true about genes
- genes are located on chromosomes
- genes are units of inheriten.
Welcome to TechSoup New Member Orientation and Q&A (May 2024).pdfTechSoup
In this webinar you will learn how your organization can access TechSoup's wide variety of product discount and donation programs. From hardware to software, we'll give you a tour of the tools available to help your nonprofit with productivity, collaboration, financial management, donor tracking, security, and more.
Ethnobotany and Ethnopharmacology:
Ethnobotany in herbal drug evaluation,
Impact of Ethnobotany in traditional medicine,
New development in herbals,
Bio-prospecting tools for drug discovery,
Role of Ethnopharmacology in drug evaluation,
Reverse Pharmacology.
We all have good and bad thoughts from time to time and situation to situation. We are bombarded daily with spiraling thoughts(both negative and positive) creating all-consuming feel , making us difficult to manage with associated suffering. Good thoughts are like our Mob Signal (Positive thought) amidst noise(negative thought) in the atmosphere. Negative thoughts like noise outweigh positive thoughts. These thoughts often create unwanted confusion, trouble, stress and frustration in our mind as well as chaos in our physical world. Negative thoughts are also known as “distorted thinking”.
Instructions for Submissions thorugh G- Classroom.pptxJheel Barad
This presentation provides a briefing on how to upload submissions and documents in Google Classroom. It was prepared as part of an orientation for new Sainik School in-service teacher trainees. As a training officer, my goal is to ensure that you are comfortable and proficient with this essential tool for managing assignments and fostering student engagement.
The Indian economy is classified into different sectors to simplify the analysis and understanding of economic activities. For Class 10, it's essential to grasp the sectors of the Indian economy, understand their characteristics, and recognize their importance. This guide will provide detailed notes on the Sectors of the Indian Economy Class 10, using specific long-tail keywords to enhance comprehension.
For more information, visit-www.vavaclasses.com
Palestine last event orientationfvgnh .pptxRaedMohamed3
An EFL lesson about the current events in Palestine. It is intended to be for intermediate students who wish to increase their listening skills through a short lesson in power point.
2. int drainTime;
double drained;
// Set output style and precision
cout << fixed << showpoint << setprecision(2);
// Main program loop
// ends when _end==true
while (!_end)
{
// Prints main option list
printMainMenu();
// Switch based on response
switch (_response)
{
// Sets pool dimensions
case 1:
if (pool.hasDimensions())
printHasDimensions();
else
{
printPoolDimensions();
printPoolVolume();
}
break;
// Prints pool dimensions
case 2:
printGetPoolDimensions(false);
system("pause");
break;
// Prints fill rate
case 3:
printGetFillRate();
break;
// Prints drain rate
case 4:
printGetDrainRate();
break;
3. // Determine water need to fill pool to capacity
case 5:
checkDimensions();
if (!pool.hasWater())
cout << " The pool is currently empty";
else
{
cout << " The pool currently has "
<< pool.getwerVolume()
<< " units"
<< endl;
}
cout << " Water needed: "
<< pool.getFillAmount(pool.getwerVolume())
<< " units of water ";
system("pause");
break;
// Determine time required to fill pool at rate
case 6:
if (!pool.hasDimensions())
{
cout << " Pool dimensions not yet entered. ";
printGetPoolDimensions(false);
}
if (pool.getFillRate() <= 0)
printGetFillRate();
cout << " Time to fill pool: "
<< pool.getFillTime()
<< endl
<< endl;
system("pause");
break;
// Determine time required to drain pool at rate
case 7:
4. checkDimensions();
if (_drainRate <= 0)
printGetDrainRate();
if (!pool.hasWater())
{
char response = printWantwer();
while (response != 'y' && response != 'n')
{
printError();
response = printWantwer();
}
if (response == 'y')
printAddWater();
else
break;;
}
cout << " Time to drain pool: "
<< pool.getDrainTime()
<< endl
<< endl;
system("pause");
break;
case 8:
checkDimensions();
if (pool.getFillRate() <= 0)
printGetFillRate();
else
printFillRate();
cout << " Enter fill time: ";
cin >> fillTime;
pool.setFillTime(fillTime);
pool.setwerVolume(pool.getwerVolume() + pool.fill());
cout << endl
5. << pool.fill()
<< " units of water were added to the pool "
<< " The pool now contains "
<< pool.getwerVolume()
<< " units of water ";
system("pause");
break;
case 9:
checkDimensions();
if (pool.getDrainRate() <= 0)
printGetDrainRate();
else
printDrainRate();
cout << " Enter drain time: ";
cin >> drainTime;
pool.setDrainTime(drainTime);
if (!pool.hasWater())
{
char response = printWantwer();
while (response != 'y' && response != 'n')
{
printError();
response = printWantwer();
cout << " Response is "
<< response;
}
if (response == 'y')
printAddWater();
else
break;
}
drained = pool.drain();
cout << endl
<< " "
<< drained
<< " units of water were removed from the pool "
6. << " The pool now contains "
<< pool.getwerVolume()
<< " units of water ";
system("pause");
break;
case 10:
_end = true;
break;
default:
printError();
break;
}
}
return EXIT_SUCCESS;
}
void printMainMenu()
{
_numResponses = 6;
cout << " Type the number cooresponding to the task you would like to complete: "
<< " 1) Set pool dimensions "
<< " 2) Print pool dimensions "
<< " 3) Set fill rate "
<< " 4) Set drain rate "
<< " Print fill and drain rates "
<< " Add water to pool "
<< " Remove water from pool "
<< " 5) Determine water needed to fill pool to capacity "
<< " Determine time required to: "
<< " 6) fill pool "
<< " 7) drain pool "
<< " For a specific amount of time: "
<< " 8) fill pool "
<< " 9) drain pool "
<< " 10) Exit Program "
<< " Choice: ";
cin >> _response;
8. void printHasDimensions()
{
_numResponses = 2;
cout << " The pool already has dimensions"
<< endl
<< endl
<< "1) Create new dimensions"
//<< endl
//<< "2) Edit current dimensions"
<< endl
<< "2) Return to main menu"
<< endl
<< "Response: ";
cin >> _response;
switch (_response)
{
case 1:
printGetPoolDimensions(false);
break;
//case 2:
// // Print pool dimensions prompt with existing values
// printGetPoolDimensions(true);
// break;
case 2:
printMainMenu();
break;
default:
printError();
printHasDimensions();
break;
}
}
// Function that prints an error when invalid option entered at menu
void printError()
{
cout << "a" // make an error sound
10. cout << " Enter the drain rate: ";
cin >> _drainRate;
pool.setDrainRate(_drainRate);
}
void printAddWater()
{
double currentwerVolume;
cout << " How much water would you like to add? "
<< " Response: ";
cin >> currentwerVolume;
if (currentwerVolume > pool.getVolume())
{
currentwerVolume = pool.getVolume();
cout << " You entered more than the pool could hold ("
<< pool.getVolume()
<< ") but I fixed that for you. ";
}
pool.setwerVolume(currentwerVolume);
}
void printDrainRate()
{
cout << " Drain rate is currently: "
<< pool.getDrainRate()
<< endl
<< endl;
}
void printFillRate()
{
cout << " Fill rate is currently: "
<< pool.getFillRate()
<< endl
<< endl;
}
char printWantwer()
{
char response;
11. cout << " The pool has no water to drain! "
<< " Would you like to add water?"
<< endl
<< endl
<< " Response: ";
cin >> response;
return response;
}
SwimmingPool.h
#pragma once
class SwimmingPool
{
public:
SwimmingPool();
SwimmingPool(double, double, double);
SwimmingPool(double, double, double, double, double);
void setLength(double);
void setWidth(double);
void setDepth(double);
void setDrainRate(double);
double getDrainRate();
void setFillRate(double);
double getFillRate();
void setFillTime(int);
void setDrainTime(int);
void setwerVolume(double);
double getVolume();
double getwerVolume();
double getFillAmount(double);
int getDrainTime();
int getFillTime();
double drain();
double fill();
double fill(int);
bool hasDimensions();
12. bool hasWater();
private:
double _length;
double _width;
double _depth;
double _fillRate;
double _drainRate;
int _fillTime;
int _drainTime;
double _volume;
double _waterVolume;
};
SwimmingPool.cpp
#include "SwimmingPool.h"
using namespace std;
// Default constructor
SwimmingPool::SwimmingPool()
{
_length = 0;
_width = 0;
_depth = 0;
}
// Basic constructor defined with member initialization
SwimmingPool::SwimmingPool (double l, double w, double d) :_length(l), _width(w),
_depth(d)
{
// Assign to the instance variables the arguments passed to constructo
_volume = _length * _width * _depth;
}
// Full Constructor
SwimmingPool::SwimmingPool(double length, double width, double depth, double fillRate,
double drainRate)
{
// Assign to the instance variables the arguments passed to constructor
14. void SwimmingPool::setFillTime(int t)
{
_fillTime = t;
}
void SwimmingPool::setDrainTime(int t)
{
_drainTime = t;
}
// Member function to calculate volume
double SwimmingPool::getVolume()
{
// No need to check values of instance variables
// Return the volume
return _length * _width * _depth;
}
void SwimmingPool::setwerVolume(double v)
{
_waterVolume = v;
}
double SwimmingPool::getwerVolume()
{
return _waterVolume;
}
// Returns amount of water needed to fill an empty or partially filled pool
double SwimmingPool::getFillAmount(double currentwerVolume)
{
return getVolume() - currentwerVolume;
}
// Returns time needed to completely or partially drain the pool
int SwimmingPool::getDrainTime()
{
return (int)(_waterVolume/_drainRate);
}
// Returns the time need to completely or partially drain the pool
int SwimmingPool::getFillTime()
{
15. return (int)(getVolume()/_fillRate);
}
// Drain the pool for a specified time period
// Returns adjusted water volume
double SwimmingPool::drain()
{
double waterDrained = _drainRate * _drainTime;
_waterVolume -= waterDrained;
if (_waterVolume < 0)
_waterVolume = 0;
return waterDrained;
}
double SwimmingPool::fill()
{
_waterVolume += _fillRate * _fillTime;
return _waterVolume;
}
// Fill the pool for a specified time period
// Returns adjusted water volume
double SwimmingPool::fill(int time)
{
return 0;
}
bool SwimmingPool::hasDimensions()
{
if (_length > 0 && _width > 0 && _depth > 0)
return true;
else
return false;
}
bool SwimmingPool::hasWater()
{
if (_waterVolume > 0)
return true;
else
17. int main()
{
int fillTime;
int drainTime;
double drained;
// Set output style and precision
cout << fixed << showpoint << setprecision(2);
// Main program loop
// ends when _end==true
while (!_end)
{
// Prints main option list
printMainMenu();
// Switch based on response
switch (_response)
{
// Sets pool dimensions
case 1:
if (pool.hasDimensions())
printHasDimensions();
else
{
printPoolDimensions();
printPoolVolume();
}
break;
// Prints pool dimensions
case 2:
printGetPoolDimensions(false);
system("pause");
break;
// Prints fill rate
case 3:
printGetFillRate();
break;
18. // Prints drain rate
case 4:
printGetDrainRate();
break;
// Determine water need to fill pool to capacity
case 5:
checkDimensions();
if (!pool.hasWater())
cout << " The pool is currently empty";
else
{
cout << " The pool currently has "
<< pool.getwerVolume()
<< " units"
<< endl;
}
cout << " Water needed: "
<< pool.getFillAmount(pool.getwerVolume())
<< " units of water ";
system("pause");
break;
// Determine time required to fill pool at rate
case 6:
if (!pool.hasDimensions())
{
cout << " Pool dimensions not yet entered. ";
printGetPoolDimensions(false);
}
if (pool.getFillRate() <= 0)
printGetFillRate();
cout << " Time to fill pool: "
<< pool.getFillTime()
<< endl
<< endl;
19. system("pause");
break;
// Determine time required to drain pool at rate
case 7:
checkDimensions();
if (_drainRate <= 0)
printGetDrainRate();
if (!pool.hasWater())
{
char response = printWantwer();
while (response != 'y' && response != 'n')
{
printError();
response = printWantwer();
}
if (response == 'y')
printAddWater();
else
break;;
}
cout << " Time to drain pool: "
<< pool.getDrainTime()
<< endl
<< endl;
system("pause");
break;
case 8:
checkDimensions();
if (pool.getFillRate() <= 0)
printGetFillRate();
else
printFillRate();
cout << " Enter fill time: ";
20. cin >> fillTime;
pool.setFillTime(fillTime);
pool.setwerVolume(pool.getwerVolume() + pool.fill());
cout << endl
<< pool.fill()
<< " units of water were added to the pool "
<< " The pool now contains "
<< pool.getwerVolume()
<< " units of water ";
system("pause");
break;
case 9:
checkDimensions();
if (pool.getDrainRate() <= 0)
printGetDrainRate();
else
printDrainRate();
cout << " Enter drain time: ";
cin >> drainTime;
pool.setDrainTime(drainTime);
if (!pool.hasWater())
{
char response = printWantwer();
while (response != 'y' && response != 'n')
{
printError();
response = printWantwer();
cout << " Response is "
<< response;
}
if (response == 'y')
printAddWater();
else
break;
}
drained = pool.drain();
21. cout << endl
<< " "
<< drained
<< " units of water were removed from the pool "
<< " The pool now contains "
<< pool.getwerVolume()
<< " units of water ";
system("pause");
break;
case 10:
_end = true;
break;
default:
printError();
break;
}
}
return EXIT_SUCCESS;
}
void printMainMenu()
{
_numResponses = 6;
cout << " Type the number cooresponding to the task you would like to complete: "
<< " 1) Set pool dimensions "
<< " 2) Print pool dimensions "
<< " 3) Set fill rate "
<< " 4) Set drain rate "
<< " Print fill and drain rates "
<< " Add water to pool "
<< " Remove water from pool "
<< " 5) Determine water needed to fill pool to capacity "
<< " Determine time required to: "
<< " 6) fill pool "
<< " 7) drain pool "
<< " For a specific amount of time: "
<< " 8) fill pool "
23. cin.seekg(0, cin.beg);
cin.getline(_newValue, 5);
return atof(_newValue);
}
void printHasDimensions()
{
_numResponses = 2;
cout << " The pool already has dimensions"
<< endl
<< endl
<< "1) Create new dimensions"
//<< endl
//<< "2) Edit current dimensions"
<< endl
<< "2) Return to main menu"
<< endl
<< "Response: ";
cin >> _response;
switch (_response)
{
case 1:
printGetPoolDimensions(false);
break;
//case 2:
// // Print pool dimensions prompt with existing values
// printGetPoolDimensions(true);
// break;
case 2:
printMainMenu();
break;
default:
printError();
printHasDimensions();
break;
}
}
24. // Function that prints an error when invalid option entered at menu
void printError()
{
cout << "a" // make an error sound
// print error
<< " You entered an invalid response, please try again"
<< endl
<< endl;
}
void printPoolDimensions()
{
cout << " Pool Dimensions "
<< " Length: "
<< _length
<< endl
<< " Width: "
<< _width
<< endl
<< " Depth: "
<< _depth
<< endl
<< endl;
printPoolVolume();
}
void checkDimensions()
{
if (!pool.hasDimensions())
{
cout << " Pool dimensions not yet entered. ";
printGetPoolDimensions(false);
}
}
void printGetFillRate()
{
cout << " Enter the fill rate: ";
cin >> _fillRate;
25. pool.setFillRate(_fillRate);
}
void printGetDrainRate()
{
cout << " Enter the drain rate: ";
cin >> _drainRate;
pool.setDrainRate(_drainRate);
}
void printAddWater()
{
double currentwerVolume;
cout << " How much water would you like to add? "
<< " Response: ";
cin >> currentwerVolume;
if (currentwerVolume > pool.getVolume())
{
currentwerVolume = pool.getVolume();
cout << " You entered more than the pool could hold ("
<< pool.getVolume()
<< ") but I fixed that for you. ";
}
pool.setwerVolume(currentwerVolume);
}
void printDrainRate()
{
cout << " Drain rate is currently: "
<< pool.getDrainRate()
<< endl
<< endl;
}
void printFillRate()
{
cout << " Fill rate is currently: "
<< pool.getFillRate()
<< endl
<< endl;
26. }
char printWantwer()
{
char response;
cout << " The pool has no water to drain! "
<< " Would you like to add water?"
<< endl
<< endl
<< " Response: ";
cin >> response;
return response;
}
SwimmingPool.h
#pragma once
class SwimmingPool
{
public:
SwimmingPool();
SwimmingPool(double, double, double);
SwimmingPool(double, double, double, double, double);
void setLength(double);
void setWidth(double);
void setDepth(double);
void setDrainRate(double);
double getDrainRate();
void setFillRate(double);
double getFillRate();
void setFillTime(int);
void setDrainTime(int);
void setwerVolume(double);
double getVolume();
double getwerVolume();
double getFillAmount(double);
int getDrainTime();
int getFillTime();
27. double drain();
double fill();
double fill(int);
bool hasDimensions();
bool hasWater();
private:
double _length;
double _width;
double _depth;
double _fillRate;
double _drainRate;
int _fillTime;
int _drainTime;
double _volume;
double _waterVolume;
};
SwimmingPool.cpp
#include "SwimmingPool.h"
using namespace std;
// Default constructor
SwimmingPool::SwimmingPool()
{
_length = 0;
_width = 0;
_depth = 0;
}
// Basic constructor defined with member initialization
SwimmingPool::SwimmingPool (double l, double w, double d) :_length(l), _width(w),
_depth(d)
{
// Assign to the instance variables the arguments passed to constructo
_volume = _length * _width * _depth;
}
// Full Constructor
29. double SwimmingPool::getFillRate()
{
return _fillRate;
}
void SwimmingPool::setFillTime(int t)
{
_fillTime = t;
}
void SwimmingPool::setDrainTime(int t)
{
_drainTime = t;
}
// Member function to calculate volume
double SwimmingPool::getVolume()
{
// No need to check values of instance variables
// Return the volume
return _length * _width * _depth;
}
void SwimmingPool::setwerVolume(double v)
{
_waterVolume = v;
}
double SwimmingPool::getwerVolume()
{
return _waterVolume;
}
// Returns amount of water needed to fill an empty or partially filled pool
double SwimmingPool::getFillAmount(double currentwerVolume)
{
return getVolume() - currentwerVolume;
}
// Returns time needed to completely or partially drain the pool
int SwimmingPool::getDrainTime()
{
return (int)(_waterVolume/_drainRate);
30. }
// Returns the time need to completely or partially drain the pool
int SwimmingPool::getFillTime()
{
return (int)(getVolume()/_fillRate);
}
// Drain the pool for a specified time period
// Returns adjusted water volume
double SwimmingPool::drain()
{
double waterDrained = _drainRate * _drainTime;
_waterVolume -= waterDrained;
if (_waterVolume < 0)
_waterVolume = 0;
return waterDrained;
}
double SwimmingPool::fill()
{
_waterVolume += _fillRate * _fillTime;
return _waterVolume;
}
// Fill the pool for a specified time period
// Returns adjusted water volume
double SwimmingPool::fill(int time)
{
return 0;
}
bool SwimmingPool::hasDimensions()
{
if (_length > 0 && _width > 0 && _depth > 0)
return true;
else
return false;
}
bool SwimmingPool::hasWater()