Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

computer simulation i need histogram graph to plotting the results in a histogram to check if answer is correct based on the question and c

computer simulation

i need histogram graph to plotting the results in a histogram to check if answer is correct based on the question and c code below i dint want c code i need histogram graph plz everyone sending me codes

A baker is trying to figure out how many dozens of bagels to bake each day. Customers order a number of dozens bagels each. Bagels sell for 8.40 TL per dozen. They cost 5.80 TL. per dozen to make. All bagels not sold at the end of the day are sold at half price to a local grocery store.

Based on a long-run simulation, how many dozen (to the negrest dozen) bagels should be baked each day for given probability distributions p(r) and g(r) rethosenting the pm for the number of customers per day, and the number of dozens cach customer buys?

You are asked to assume one of the options given below:

(a) p(n) and q(r) are uniformly

#include

#include

#include

#define w 55

#define selling_price_per_dozen 8.4

#define cost_per_dozen 5.8

// Function to generate a random value from the probability distribution p(n)

int generate_customers()

{

// Generate a random value between 11 and 50 inclusive

return 11 + rand() % (w - 30);

}

// Function to generate a random value from the probability distribution q(n)

int generate_dozens_per_customer()

{

// Generate a random value between 1 and 10 inclusive

return 1 + rand() % 55;

}

int main()

{

// Seed the random number generator with the current time

srand(time(NULL));

// Initialize the total profit to 0

float total_profit = 0;

// Run the simulation for 1000 days

for (int i = 0; i

{

// Generate the number of customers and the number of dozens per customer

int customers = generate_customers();

int dozens_per_customer = generate_dozens_per_customer();

// Calculate the total number of bagels sold

int total_bagels_sold = (customers * dozens_per_customer) * 12;

// Calculate the total revenue

float total_revenue = total_bagels_sold * selling_price_per_dozen;

// Calculate the cost of making the bagels

float cost_of_making_bagels = total_bagels_sold * cost_per_dozen;

// Calculate the profit for the day

float profit = total_revenue - cost_of_making_bagels;

// Add the profit for the day to the total profit

total_profit += profit;

}

// Calculate the average profit over the simulation

float average_profit = total_profit / 1000;

// Print the average profit

printf("Average profit: %.2f TL ", average_profit);

return 0;

}

image text in transcribed
(b) p(n) and q(n) are given as p(n)={101,0,n=11,12,,10otherwise,q(n)={55n,0.n=1,2,,10otherwise

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

Database Design For Mere Mortals

Authors: Michael J Hernandez

4th Edition

978-0136788041

More Books

Students also viewed these Databases questions

Question

Discuss the value of adult learning theory to HRD interventions

Answered: 1 week ago

Question

Conduct a task analysis for a job of your choosing

Answered: 1 week ago