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 program that takes into account a pre given array

Problem: A program that takes into account a pregiven array and prompts the user to enter a return per minute value.

  Calculates average of three exams for each student

The program reads the grades for students, calculates average of three exams for each student, and puts out to another file (called Summarygrades.txt) Student ID average and letter grade: example below,

  Create a class named gamer that has a field for name

Create a class named Gamer that has a field for name(string) and a field for points(int).

  Generate a set of 75 random integers in the range -26 to + 4

Write a program that will generate a set of 75 random integers in the range -26 to + 42. The program

  Include a main function that will solicit

Include a main function that will solicit a DNA sequence string from the user, call the genes function to obtain all the genes in the sequence and print each one on the console display

  Execute the next line which is enter your last name

C++ in VS and I'm trying to run the following program. As soon as I put in my name after the 2nd cout statement, the program ends.

  Write a program that asks the user to enter the monthly cost

Write a program that asks the user to enter the monthly costs for the following expenses incurred from operating his or her automobile: loan payment, insurance, gas, oil, tires, and maintenance. The program should then display the total monthly cost ..

  Write a program to calculate a person''s net pay

Write a program to calculate a person's net pay after subtracting federal income tax.The program should ask the user to enter the person's name, social security number, gross pay, and the number of dependents.

  Object oriented programming paradigm is better choice

Explain why object oriented programming paradigm is considered better choice than structured programming paradigm. Does it reflect our "natural" way of thinking or do you find it artificial?

  The fibonacci sequence

In the novel "The DaVinci Code", a scrambled version 13, 3, 2, 21, 1, 1, 8, 5 of the first eight Fibonacci numbers appear as one of the clues left by murdered museum curator Jacques Sauniere. In this assignment, we will do something related to t..

  Use a define statement to create a constant

Follow these specifications: Use a define statement to create a constant that will hold your student number. You should have separate string variables for your first and last name; name these first_name and last_name.

  Write a program that finds the equivalent series

Write a program that finds the equivalent series and parallel resistance for a collection of resistor values. Your program should scan first the number of resistors and then the resistor values. Then compute the equivalent series resistance for all r..

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