Question

In probability class there are 140 students, with 90 of them being from Industrial engineering, 10...

In probability class there are 140 students, with 90 of them being from Industrial engineering, 10 from EEE, 10 from CoE, 10 from BME and 20 from CE departments. The professor picks a student randomly and asks for his department and then he writes down the student department. Simulate this scenario in C programming language.

0 0
Add a comment Improve this question Transcribed image text
Answer #1

Points to consider.

  1. We will find a random number from 1 to 140 and then we can divide the ranges for each of the departments based on the number of students in each.
  2. Then we need to print the department found.

Code:

#include<stdio.h>
#include<stdlib.h>
#include<time.h>
int main(){
   // Adding the seed to the random function
   srand(time(0));
   // Getting the random number
   int num = rand()%140 + 1;
   // For storing the dept
   char *dept;
   if(num <= 90){
       dept = "Industrial engineering";
   }else if(num <= 100){
       dept = "EEE";
   }else if(num <= 110){
       dept = "CoE";
   }else if(num <= 120){
       dept = "BME";
   }else{
       dept = "CE";
   }
   // Printing the randomly generated department
   printf("Department: %s", dept);
}


Output Snippet

That was a nice question to answer
Friend, If you have any doubts in understanding do let me know in the comment section. I will be happy to help you further.
Please like it if you think effort deserves like.
Thanks

Add a comment
Know the answer?
Add Answer to:
In probability class there are 140 students, with 90 of them being from Industrial engineering, 10...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • In a class of 125 students, 28 are computer science majors, 52 are mechanical engineering majors,...

    In a class of 125 students, 28 are computer science majors, 52 are mechanical engineering majors, 10 are civil engineers and the rest are general engineering majors.Assume students only have one major If a student is chosen at random what is the probability they are: Round your answers to 3 decimal places a clvil engineering major? o8 a civil engineering major or mechanical engineering major?496 a general engineering major? 280 not a computer science major? 776 Suppose six students from...

  • There are 20 students in a class. Each student gets a 10 question quiz that is randomly selected from a 40 question quiz bank. What is the probability that 2 out of the 20 students will get the same quiz?

    There are 20 students in a class. Each student gets a 10 question quiz that is randomly selected from a 40 question quiz bank. What is the probability that 2 out of the 20 students will get the same quiz?

  • "Annexure B" ASSIGNMENT 2 DESIGN BRIEF Due to increasing pedestrian traffic of students travelling from halls of residence to the engineering block at one of its devised a...

    "Annexure B" ASSIGNMENT 2 DESIGN BRIEF Due to increasing pedestrian traffic of students travelling from halls of residence to the engineering block at one of its devised a plan, which includes a new means of crossing a busy road safely and without causing traffic delay. A solution to protect student safety for crossing the busy road is to design and build a pedestrian bridge. This will eliminate traffic congestion and delays as well as eliminate conflict between pedestrians and motorists....

  • Mr. Big, the Pres asks you, "As a graduate of a TM (Transportation Management) class with an "A",...

    Mr. Big, the Pres asks you, "As a graduate of a TM (Transportation Management) class with an "A", what do you think about setting the speed for our tractors?" Give a written answer. Speed dlerences mean more interacuions hat could cause accidents,researcher says By LYNDON FINNEY Citing primarily safety issues, the American Trucking Associations last month petitioned the National Highway Traffic Safety Admin- istration to limit the maximum speed of large trucks at the time of manufacture to no more...

  • Industrial and Organizational Psychology questions

    Industrial-organizational psychologists are interested in all of the following except1. how to best diagnose clinical disorders and offer therapy to employees.2. how personality characteristics influence work behavior.3. how culture influences people's perceptions of their working environments.4. how people's work affects their home life.An organizational psychologist would be most likely concerned with1. studying the interaction between humans and technology.2. All of the these3. interviewing potential employees.4. helping people organize their schedules and daily planners.5. understanding the emotional and motivational side of...

  • Budgeting for an Academic Department at a State University: Can You Believe the Numbers? INTRODUCTION You...

    Budgeting for an Academic Department at a State University: Can You Believe the Numbers? INTRODUCTION You are the senior accounting faculty member in the business school and your dean, Dean Weller, is asking for help. She is very discouraged after a midyear budget meeting with the Vice President of Finance. The college's Department of Social Work has a large budget deficit, and because of this the VP is inclined towards closing the department entirely or closing its bachelor's program. The...

  • Read “Instituionalizing our Demise: America vs Multiculturalism” by Roger Kimball on pg 268 and “Reinventing America”...

    Read “Instituionalizing our Demise: America vs Multiculturalism” by Roger Kimball on pg 268 and “Reinventing America” Call for a new national indentity” by Elizabeth Martinez on pg 275. Create a double entry notebook for each reading selection It should be atleast five observation and responses. wric 268 PART 2 essay pro. exactly how and why their authors disagree. Instead of with parties in conflict as mediators do, you will nt of view designed to appeal to both sides, mediatn posing...

  • How can we assess whether a project is a success or a failure? This case presents...

    How can we assess whether a project is a success or a failure? This case presents two phases of a large business transformation project involving the implementation of an ERP system with the aim of creating an integrated company. The case illustrates some of the challenges associated with integration. It also presents the obstacles facing companies that undertake projects involving large information technology projects. Bombardier and Its Environment Joseph-Armand Bombardier was 15 years old when he built his first snowmobile...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT