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, 22.06.2019 19:30
Once the data center routes to the destination server that hosts the website, what's the next step in the internet process? user’s browser renders html code from destination server into web page request goes through router/model and isp request routed to nameserver and datacenter
Answers: 2
question
Computers and Technology, 23.06.2019 03:00
State 7 common key's for every keyboard
Answers: 1
question
Computers and Technology, 23.06.2019 11:00
What are the possible consequences of computer hacking? what is computer piracy? describe some examples. what are the effects of computer piracy? what are the possible consequences of computer piracy? what is intentional virus setting? describe some examples. what are the effects of intentional virus setting? what are the possible consequences of intentional virus setting? what is invasion of privacy? describe some examples. what are the effects of invasion of privacy? what are the possible consequences of invasion of privacy? what is an acceptable use policy and what is the purpose of the acceptable use policy what is intellectual property and how can you use it?
Answers: 1
question
Computers and Technology, 24.06.2019 12:00
Which spreadsheet operation does a look function perform?
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, 19.12.2020 23:10
question
Mathematics, 19.12.2020 23:10
Questions on the website: 13722367