Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

import java.util.*; public class PoD { public static void main( String [] args ) { Scanner in = new Scanner( System.in ); LinkedList cardDeck =

image text in transcribedimage text in transcribed

import java.util.*; public class PoD { public static void main( String [] args ) { Scanner in = new Scanner( System.in ); LinkedList cardDeck = new LinkedList(); // START WORK HERE **************************************************** /* Build a card deck by placing cards based on NUMBER_OF_MOVES lines of input: 1. If input is of the form: TOP,9 Spades insert "9 Spades" on the top of the deck 2. If input is of the form: BOTTOM,5 Diamonds insert "5 Diamonds" at the bottom of the deck 3. If input is of the form "TAKE,top" or "TAKE,bottom" then remove a card from the top or bottom, respectively, of the deck. */ final int NUMBER_OF_MOVES = Integer.parseInt(in.nextLine()); // END WORK HERE **************************************************** System.out.println(cardDeck); in.close(); System.out.print("END OF OUTPUT"); } }
Today you are going to use a LinkedList to build a deck of cards. The linked list cardDeck has been declared for you. Now you must fill the card deck with cards as described below Details Download the ZIP files named FilesNeeded.zip for use in IntelliJ. When you are happy with your solution, upload the files into the src folder and run. You are going to finish off PoD.java to finish building the card deck. Input Input consists first of an integer number of moves needed to build the card deck (read in for you). Following that, moves will be of the form below I. If input is of the form TOP,9 Spades. insert Spades on the top of the deck 2. If input is of the form: BOTTOM,5 Diamonds. insert "5 Diamonds at the bottom of the deck 3. If input is of the form TAKE, top or TAKE,bottom, then remove a card from the top or bottom, respectively, of the deck. Processing For each line of input, you should add cards to the card deck as described Output Output will be handled for you and will display the contents of the card deck

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Hands On Database

Authors: Steve Conger

1st Edition

013610827X, 978-0136108276

More Books

Students also viewed these Databases questions

Question

Define Administration?

Answered: 1 week ago

Question

Define Decision making

Answered: 1 week ago