Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 1029951
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T12:37:33+00:00 2026-05-16T12:37:33+00:00

i am writing an event driven simulation program. i have 3 subclasses that inherit

  • 0

i am writing an event driven simulation program. i have 3 subclasses that inherit 1 base class. i need to generate those three randomly and each subclass will go through different event path (sorry its a bit hard to describe what i meant), ill give an example:

let say we have a car park simulation at a mall, we have the base class Vehicle, and subclasses Car, Motorbike, TruckContainer. the Car and Motorbike is just going to park for a period of time(random) and leave while TruckContainer need to park only for unloading and loading the container and leave, the number of container will decide how long the truck will park.

how can i create those 3 objects randomly, let say 5-10 car will enter the car park in 1minute, 1-3 motorbike in 10minute, and only 1-2 truck container in a day?

thank you

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-16T12:37:33+00:00Added an answer on May 16, 2026 at 12:37 pm

    This might lead u there

    VehicleControl::VehicleControl() {
    mapOfFreq["Car"] = 6;     // based on 10 per 60 sec
    mapOfFreq["Bike"] = 200;
    .....
    }
    
    vehicle* VehicleControl::getVehicle() {
    time_t t = time();
      if (t - mapOfCreatedTime["Car"] > mapOfFreq["Car"]) {
        mapOfCreatedTime["Car"] = t;
        return new Car();
       }
     ........
     }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am writing an event for button.In that ,i have used swingworker in the
I'm writing a topic-based publish/subscribe system in C++. My generic Event class has three
I'm writing an event-driven publish/subscribe application with NodeJS and Redis. I need an example
I am writing an event delegating plugin that takes 4 params: context = String
I have a pictureBox1 paint event. In the paint event im writing to a
I'm writing a Perl script that reads data from the infamous /dev/input/event* and I
Is there anyway to encorporate Dragon NaturallySpeaking into an event driven program? My boss
Is it possible to implement event driven program in PHP? Something like javascript. As
I've got an event-driven network server program. This program accepts connections from other processes
I am writing C# application that need to print data to POS STAR printer

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.