Define and implement structures in c

Assignment Help C/C++ Programming
Reference no: EM13328317

Analyze a basic set of requirements for a problem

Compose C language programs

Create basic test cases for a program

Apply arrays, strings, and pointers

Summarize differences between array notation and pointer notation

Apply pointer arithmetic

Apply basic string handling library functions

Define and implement structures in C

Summarize the operations of a linked list

Describe the operations of a queue including: enqueue ( ), dequeue ( ), printQueue ( )

Overview & Requirements:

Note: parts of this assignment were inspired by Deitel and Deitel's Supermarket Simulation problem. We've all had the pleasant experience of standing in line at the grocery store. As I'm standing in line I'm always trying to figure out if I chose the line with the fastest service. In most cases, I fail miserably. Let's write a program to simulate two lines in a grocery store, which will allow us to better understand how to select the fastest line.

For this assignment you will need to simulate two lines using queues. This will require that you develop enqueue ( ) (insert), dequeue ( ) (delete), and printQueue ( ) operations for a queue. Although you will instantiate two queues, each one of these will consist of the same kind of queue nodes. Define a queue node in the following manner:

typedef struct queueNode
{
int customerNumber; // Unique identifier; starts at 1; after 24 hours should be reset to 1
int serviceTime; // Random time; varies between express and normal lanes; units in minutes
int totalTime; // totalTime = serviceTime + sum of serviceTimes of customers in line before this customer; units in minutes

struct queueNode *pNext;
} QueueNode;

One of your queues will represent the express lane and the other a normal lane. You will randomly generate arrival times and service times of customers into each lane. The express lane has customers arrive every one to five minutes, and customers arrive every three to eight minutes in the normal lane. Service times vary from one to five minutes, and three to eight minutes, for express and normal lane customers, respectively. As customers arrive into each line print out a message indicating in which line each customer arrives, along with the overall corresponding arrival time and customer number. When customers have finished checking out, print out a message indicating which line the customer was in, along the corresponding customer number and totalTime in the line. Allow for the simulation to run for n number of minutes, where n is inputted by the user.

The general program flow is as follows:

1. Generate a random number between 1 - 5 and 3 - 8 for express and normal lanes, respectively. This represents the arrival time of the first customer into each lane. Set the variable for total time elapsed to 0.

2. As customers arrive into each line, randomly generate a service time for each. Start processing the customers in the lanes based on service time. Randomly generate the arrival time of the next customer into each line. Elapsed time should be updated by one unit.

3. As each minute elapses, a new customer may arrive and/or another customer may be done checking out. Display the appropriate messages as described above.

4. For every 10 minutes, print out the entire queue for each line

5. Repeat steps 2 through 4 for n minutes of simulation.

Reference no: EM13328317

Questions Cloud

Calculate the work done on the suitcase by the force : A luggage handler pulls a 20.0-kg suitcase up a ramp inclined at 24.0° above the horizontal by a force of magnitude 148 N that acts parallel to the ramp. Calculate the work done on the suitcase by the force
What is the speed of the block after it leaves the spring : A 1.00-kg block of ice is placed against a horizontal spring that has force constant k = 175 N/m and is compressed 0.021 m. What is the speed of the block after it leaves the spring
What are penalties for committing these crimes : What might the profile (with emphasis on sociological and psychological theories) be for a cybercriminal who commits this type of cybercrime?
Explain how many electrons could occupy a subshell : How many electrons could occupy a subshell with the following quantum numbers? A) n=5, l=4, B) n=2, l=0, ml=0
Define and implement structures in c : Define and implement structures in C and summarize the operations of a linked list - Generate a random number between 1 - 5 and 3 - 8 for express and normal lanes, respectively. This represents the arrival time of the first customer into each lane.
Find out the balanced cell reaction : A galvanic cell is constructed with a silver-silver chloride electrode, and a nickel strip immersed in a beaker containing 1.56 x 10-2 M solution of NiCl2. Determine the balanced cell reaction and calculate the potential of the cell. Enter in Volt..
Explain how many orbitals are there in a atom : How many orbitals are there in a atom with the following combinations of quantum numbers? A). n=3 l=1 B). n=4 l=2 ml=2
How to calculate the value of e cell : Calculate the value of E cell for the following reaction 2Fe2+(aq) + Cd2+(aq) ? 2Fe3+(aq) + Cd(s)
Write a paper describing project management lifecycle : Write a paper describing Project management lifecycle and Systems Delivery lifecycle.Your paper must contain two well-formed paragraphs (a topic sentence supported by three to four additional sentences).

Reviews

Write a Review

C/C++ Programming Questions & Answers

  Create program that uses functions and reference parameters

Create program that uses functions and reference parameters, and asks user for the outside temperature.

  Write a program using vectors and iterators

Write a program using vectors and iterators that allows a user to maintain a personal list of DVD titles

  Write the code required to analyse and display the data

Calculate and store the average for each row and column. Determine and store the values for the Average Map.

  Write a webservices application

Write a webservices application that does a simple four function calculator

  Iimplement a client-server of the game

Iimplement a client-server version of the rock-paper-scissors-lizard-Spock game.

  Model-view-controller

Explain Model-View-Controller paradigm

  Design a nested program

How many levels of nesting are there in this design?

  Convert celsius temperatures to fahrenheit temperatures

Write a C++ program that converts Celsius Temperatures to Fahrenheit Temperatures.

  Evaluate and output the value in the given base

Write C program that will input two values from the user that are a Value and a Base with which you will evaluate and output the Value in the given Base.

  Design a base class shape with virtual functions

Design a base class shape with virtual functions

  Implementation of classes

Implementation of classes Chart and BarChart. Class barChart chould display a simple textual representation of the data

  Technical paper: memory management

Technical Paper: Memory Management, The intent of this paper is to provide you with an in depth knowledge of how memory is used in executing, your programs and its critical support for applications.

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd