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

  A store with a bag of groceries

write C++ statements that remove all the items from storeBag and place them into one of two new bags, as follows: Place all occurrences of bread and eggs into fragileBag, and all other items into groceryBag. When you are done, storeBag should be empt..

  Two types of sporting teams

Select two types of sporting teams and de?ne subclasses for them. These classes shouldinherit from a base team class such as that created in Exercise 1. Include uniquecharacteristics about the sport.

  Write a program that accepts as input, without prompts

Write a program that accepts as input, without prompts, a series of short values, terminated by end of file. The program outputs one line:

  The method takes an array

The method takes an array of integers and returns true if there exists any item in the array that satisfies a specified condition. For instance, the following code fragment:

  Create a customer profile class.

a. Create a CustomerProfile class. Each CustomerProfile contains a last name, phone number, and bit fields indicating whether the customer:

  Write a pseudocode statement

Assume that a program has two string variables named str1 and str2. Write a pseudocode statement that assigns an all uppercase version of str1 to the str2 variable. is str.add(str1,str2) part of it?

  Output the even numbers from 1 to 10 in ascending order

Output the even numbers from 1 to 10 in ascending order, then the odd numbers from 10 to 1 in descending order: 2 4 6 8 10 9 7 5 3 1. in C++

  Computes the final price for a sales transaction

Create a C program that contains a function that computes the final price for a sales transaction and return that value to a calling method.

  Contacts class that contains an array

Create a Friend class that contains a first name, last name, a birthday, and a telephone number. Create a Contacts class that contains an array of Friend as well as the owner's name and cell phone Number.

  Local diner that allows customers to see the diner''s menu

Design a program to be used for a small local diner that allows customers to see the diner's menu and then make their meal selections using the program.The program will also calculate and print an itemized bill.

  Search for the value needle in the array

Search for the value needle in the array range given by [hay_begin ... hay_end), using the Linear Search algorithm. This function will return a pointer to the needle value if it is found, or a null pointer if needle is not found.

  Program that will calculate the heat transfer of a substance

write a program that will calculate the heat transfer of a substance (water) given three different shapes. The user has to be able to input the type of shape, so that the computer can calculate area, and plug it back in to the equation for heat trans..

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