subject

2. Lab2B: We are going to use a stack and a queue to simulate a line of people waiting to get the latest and greatest candy bars that have just been loaded into the vending machine. The people are standing in a FIFO queue, but the candy is in a LIFO stack. • Write a void method that: i. Receives the candyBars stack and the customers queue as parameters ii. Remove one item from candyBar and one item from customers, and prints them on the same line (with labels) iii. Repeat the above action until the structures are empty • In the main method: i. Create a stack of Strings named candyBars ii. Create a queue of Strings named customers iii. Read lines from the text file, Lab2B. txt, until there is no more data (The number of lines I test with will be different than the ones in your text file.) 1. Each text file line has a candy name and a customer name 2. Add the candy name into the candyBar stack 3. Add the customer name into the customers queue iv. Print the candyBar stack v. Print the customers queue vi. Call your void method sending the stack and queue as parameters. 3. Lab2C: This program will create a work with a map structure • Create a map structure with a name (String) as the key and an age (Integer) as the value. • Fill the map by reading the values in from a text file (Lab2C. txt). Each line in the text file will have a name and an age. • Print the map • Ask the user to enter a name and determine if that name is in the map. Print a statement to say if it is or not. • Ask the user for an age and count how many times that age appears in the map. Print the count with a label.

ansver
Answers: 2

Another question on Computers and Technology

question
Computers and Technology, 23.06.2019 17:00
The camera still is bad even with the new iphone xr and especially in low light it is even worst because you can see the pixels more if its in low light. if all you apple customers want apple to fix this then lets fill there feedback with complaints about the
Answers: 1
question
Computers and Technology, 25.06.2019 07:00
What statement would cause polarization
Answers: 1
question
Computers and Technology, 25.06.2019 12:00
What is the difference between paper size and page margins in word
Answers: 1
question
Computers and Technology, 25.06.2019 14:30
How can i cancel my subscription in
Answers: 1
You know the right answer?
2. Lab2B: We are going to use a stack and a queue to simulate a line of people waiting to get the la...
Questions
question
Mathematics, 14.02.2021 05:20
question
Mathematics, 14.02.2021 05:20
question
Chemistry, 14.02.2021 05:20
Questions on the website: 13722360