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 02:30
Experimental data that is expressed using numbers is said to be
Answers: 1
question
Computers and Technology, 23.06.2019 08:30
Based on your knowledge of a good network, describe what you think is a perfect network would be. what kind of information and resources could users share on this network. what would the network administrator do? what kind of communication would be used?
Answers: 1
question
Computers and Technology, 25.06.2019 05:30
Why are weather forecasts more reliable now compared of hundred years ago
Answers: 1
question
Computers and Technology, 25.06.2019 05:30
Your mother is sure that you were driving too fast because she knows a. when you arrived and the direction you came from. b. how long it took you to get home and how far you traveled. c. what time you left and how long it took you to get home. d. the direction you were driving and how far you traveled.
Answers: 2
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, 18.07.2019 16:00
question
Social Studies, 18.07.2019 16:00
Questions on the website: 13722360