Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Background: Oh, that Krusty! Krusty wants to turn as much of a profit as possible. So, he hired an eminent scientist, Prof. Frink 1 ,

Background: Oh, that Krusty! Krusty wants to turn as much of a profit as possible. So, he hired an eminent scientist, Prof. Frink1, to determine a mathematical model that will generate numbers that somehow relate to his profits from Krusty Burger based on two variables. These variables are the number of different animal parts used in a burger, and the number of different types of animals (from which these parts are extracted) used in the burgers. In the foregoing formula, these are denoted as x and y, respectively.2

f(X,Y) = X * e-Y2/X

Specifications: Your program is to use several functions to implement this program. You will have functions to:

Greet the user.

Prompt the user and read in values to be used in the calculations of Krusty's Profit Maximizer. This can be done in several ways; we leave it up to you to decide the method. But however you do it, you will need to input integers from the user for a lower and upper bound for both functional values (x and y in the formula below).

A function that calculates the values of Krusty's profit function. This function will have two parameters representing the inputs to the program by the user, and it will return a single value computed in accordance with the above Krusty function.

A function that will output in table format (no horizontal or vertical lines necessary in this table) the values of the Maximizer function. It will call the function that computes these profit values.

Sign off the running of the program.

Have your program loop, requesting new inputs by the user. You can devise a way for the program to terminate (specific inputs, "wanna quit (y/n)", or some other way; it's up to you.)

Details: The devil is the in details....except in this case. You are now allowed to use the cmath library. You get access to this with a

#include

pre-processor command.

Also, for your output, you will produce a table of values but this table doesn't have to have vertical or horizontal line separators. Please use the "magic code" we gave you in assignment #3 that formats numerical output with exactly 2 decimal points. That will make your output look pretty. You don't need to know any other special output formatting code to make the table.

To make it clear what we're looking for in output, suppose the user inputs for x the lower bound of 1 and upper bound of 3, and lower for y of 4 and upper bound of 7, your output should have values for f(x,y) for integer values of x incremented from 1 to 3 and y from 4 to 7.

f(1,4) f(1,5) f(1,6) f(1,7)

f(2,4) f(2,5) f(2,6) f(2,7)

f(3,4) f(3,5) f(3,6) f(3,7)

Remember: When writing your code, be sure to:

Use meaningful variable names.

Use proper spacing for indentations.

Use constant variable declarations where appropriate.

Include the comment block at the head of your file.

Comment code that needs it.

Be literate in your welcoming/signing-off messages and prompts and output.

Make the output pretty and user-friendly.

Note: Don't underestimate the time that it will take to write this program!

When you submit the submit script will compile and execute your program in the process. This means that you will be the "user" of the program for that few minutes. Now, in order that the grader isn't driven crazy by a multitude of inputs/outputs, you will ALL input the same values so that he has uniform output to grade. They are:

enter lower bound of 2 and upper bound of 7 for the number of animal parts

enter lower bound of 1 and upper bound of 4 for the number of animals

do again

enter lower bound of 3 and upper bound of 8 for the number of animal parts

enter lower bound of 4 and upper bound of 5 for the number of animals

quit

ALSO, you are to include in your submission a .txt file in which you will compose in Kings English an interpretation of the output of your program. You will receive extra points3 for doing this in rhyme. In any case, you will receive more credit for more thorough and humorous prose.

Im having issues, sadly I am at a loss as to how I am supposed to code the profit calculation. Thanks for any help in advance.

#include

#include

using namespace std;

//Declrations of Functions

void greeting(); //Outputs a greeting message

int upper(int upper); //Upper bound

int lower(int lower); //Lower bound

int proftCalculation(int profit); //Profit Calculation

void tableOutput(); //Outputs into a table format

void signOff(); //Outputs a sign off message

//Main function description

int main()

{

greeting();

int upper = upper(upper);

int lower = lower(lower);

profitCalculation();

tableOutput();

signOff();

return 0;

}

//Description and coding of each function

void greeting()

{

cout << "Welcome to Krusty's Profit Calculator!" << endl;

cout << " " << endl;

return;

}

int upper(int upper) //Upper bound input

{

int upper;

cout << "Input an upper bound." << endl;

cin >> upper;

cout << " " << endl;

return upper;

}

int lower(int lower) //Lower bound input

{

int lower;

cout << "Input a lower bound." << endl;

cin >> lower;

cout << " " << endl;

return lower;

}

int profitCalculator(int profit) //Profit Calculation

{

int profit;

return profit;

}

void tableOutput() //Output of all relavent info in table format

{

cout << "" << endl;

cout << "" << endl;

cout << "" << endl;

return;

}

void signOff()

{

cout << "Thanks for using Krusty's Profit Calculator!" << endl;

return;

}

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Relational Database And SQL

Authors: Lucy Scott

3rd Edition

1087899699, 978-1087899695

More Books

Students also viewed these Databases questions