Question: Hi! I would appreciate some help on this program. Thank you! You work for a concert promoter. Since some of the patrons of past events
Hi! I would appreciate some help on this program. Thank you!
You work for a concert promoter. Since some of the patrons of past events have been complaining about the moshers in the mosh pit the promoter has given you the job to determine the maximum number of moshers in the mosh pit so that a reserved area can be created for the moshers. The number of moshers that can fit into a mosh pit depends on the pit size, the average size of a mosher, the separation between the moshers, and the north, south, east, and west thickness of the mosh pit barricade to contain the moshers. Your program will need to get the following input from the user:
The length and width, in feet, of the mosh pit. Assume these are the maximum (outside) dimensions of the barricade.
The thickness of the north, south, east, and west sides of the barricade
The separation between moshers (and a barricade side if applicable)1
The average size of the mosher2
1 To get the space between moshers prompt the user for a separation value:
A separation of A or a means 2.5 foot distance between moshers
A separation of B or b means 1.5 foot distance between moshers
A separation of C or c means 0.5 foot distance between moshers
A separation of anything else means exit the program.
NOTE: Use a char variable type for the prompt response. Seehttp://www.cplusplus.com/reference/cctype/tolower/ (Links to an external site.)Links to an external site.
2 To get the average size of a mosher (assume all moshers in the mosh pit will be the same size):
A mosher size of L or l means each mosher takes up a 1.5 foot by 1.5 foot space
A mosher size of XL or xl means each mosher takes up a 2.5 foot by 2.5 foot space
A mosher size of XXL or xxl means each mosher takes up a 3.5 foot by 3.5 foot space
A mosher size of anything else means exit program.
NOTE: Use a string data type for the prompt response. Seehttp://stackoverflow.com/questions/313970/stl-string-to-lower-case (Links to an external site.)Links to an external site.
To ease your calculations assume that the moshers (depicted below) are initially arranged in rows and columns in a grid like fashion and that the distance between an end mosher and the barricade is the separation distance.
Shell:
Pageof 4
ZOOM
//////////////////////////////////////////////////////////////////////////
/////
// MoshPit.cpp : This is one shell of a program.
//////////////////////////////////////////////////////////////////////////
/////
#include "stdafx.h"
#include
#include
#include
#include
using namespace std;
//////////////////////////////////////////////////////////////////////////
/////
//
//////////////////////////////////////////////////////////////////////////
/////
class MoshPit
{
public:
MoshPit(); //Constructor
void GetMoshPitDimensions();
void GetMosherSeperation();
void GetMosherSize();
void CalculateMoshPit();
void DisplayResults();
int QuitProgram();
private:
// The class' data members go here....
};
//////////////////////////////////////////////////////////////////////////
/////
//
//////////////////////////////////////////////////////////////////////////
/////
MoshPit::MoshPit()
{
// Initialize the class' data members here....
}
//////////////////////////////////////////////////////////////////////////
/////
//
//////////////////////////////////////////////////////////////////////////
/////
void MoshPit::GetMosherSeperation()
{
// Member function that prompts the user for the "mosher seperation"
and
// store the results in the class' data member(s).
}
//////////////////////////////////////////////////////////////////////////
/////
//
//////////////////////////////////////////////////////////////////////////
/////
void MoshPit::GetMosherSize()
{
// Member function that prompts the user for the "size of the
mosher" and
// store the results in the class' data member(s).
}
//////////////////////////////////////////////////////////////////////////
/////
//
//////////////////////////////////////////////////////////////////////////
/////
void MoshPit::CalculateMoshPit()
{
// Member function that uses the classes private data members to
perform
// the mosh pit calculations.
}
//////////////////////////////////////////////////////////////////////////
/////
//
//////////////////////////////////////////////////////////////////////////
/////
int MoshPit::QuitProgram()
{
cout << "Quitting program..." << endl;
system("pause");
exit(1);
}
//////////////////////////////////////////////////////////////////////////
/////
//
//////////////////////////////////////////////////////////////////////////
/////
void MoshPit::GetMoshPitDimensions()
{
system("cls");
cout << "******************** Welcome to the Mosh Pit Calculator!
********************" << endl << endl << endl;
//// Prompt user for length of mosh pit
cout << "Please enter the Length (in feet) of the mosh pit: ";
////
cout << "Please enter the Width (in feet) of the mosh pit: ";
////
//// Prompt the user for the thickness of the barricade.
cout << "Please enter the thickness (in feet) of the top of the
North side of the barricade: ";
////
cout << "Please enter the thickness (in feet) of the top of the
South side of the barricade: ";
////
cout << "Please enter the thickness (in feet) of the top of the East
side of the barricade: ";
////
cout << "Please enter the thickness (in feet) of the top of the West
side of the barricade: ";
////
cout << endl;
}
//////////////////////////////////////////////////////////////////////////
/////
//
//////////////////////////////////////////////////////////////////////////
/////
void MoshPit::DisplayResults()
{
// Member function that uses the classes private data members to
display the results to the user
system("pause");
}
//////////////////////////////////////////////////////////////////////////
/////
//
//////////////////////////////////////////////////////////////////////////
/////
int main()
{
// Create an instance of the class.
MoshPit thePit;
// Notice that there is no exiting the loop here. Exiting the
program
// happens in "QuitProgram()"
while (true)
{
thePit.GetMoshPitDimensions();
thePit.GetMosherSeperation();
thePit.GetMosherSize();
thePit.CalculateMoshPit();
thePit.DisplayResults();
};
return 0;
}
Instructions:
The MoshPit program must be implemented as follows. A MoshPit class and a main function defined as follows:
MoshPit::MoshPit() - A constructor that initializes all of its data members.
void MoshPit::GetMoshPitDimensions() - Member function that prompts the user for the dimensions of the mosh pit and store the results in the class' data members. Notice the function signature takes no arguments and returns no values.
void MoshPit::GetMosherSeperation() - Member function that prompts the user for the "mosher seperation" and store the results in the class' data member(s). Notice the function signature takes no arguments and returns no values.
void MoshPit::GetMosherSize() - Member function that prompts the user for the "size of the mosher" and store the results in the class' data member(s). Notice the function signature takes no arguments and returns no values.
void MoshPit::CalculateMoshPit() - Member function that uses the classes private data members to perform the mosh pit calculations. Notice the function signature takes no arguments and returns no values.
void MoshPit::DisplayResults() - Member function that uses the classes private data members to display the results to the user. Notice the function signature takes no arguments and returns no values.
int MoshPit::QuitProgram() - Member function that is called when ever the program needs to terminate. Notice the function signature takes no arguments and returns an integer value.
int Main() - Non-member function used to instantiate the MoshPit class and call it's member functions.
Do not modify the function signatures and do not use global variables. Use member variables instead.
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
