Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Need help filling in the areas, unsure of how to do the code, JAVA. I've highlited what needs completing. import java.util.Stack ; /** Practices using

Need help filling in the areas, unsure of how to do the code, JAVA. I've highlited what needs completing. 

import java.util.Stack ; /** Practices using the Stack from the Java API. */ public class StackApiTester { public static void main(String[] args) { Stack stack = new Stack() ; stack.push("horse") ; stack.push("cat") ; stack.push("dog") ; stack.push("cow") ; stack.push("mouse") ; System.out.println(stack.pop()) ; System.out.println(stack.pop()) ; System.out.println(stack.pop()) ; System.out.println(stack.peek()) ; System.out.println("stack is empty? " + stack.isEmpty()) ; System.out.println(stack.pop()) ; System.out.println("stack is empty? " + stack.isEmpty()) ; System.out.println(stack.pop()) ; System.out.println("stack is empty? " + stack.isEmpty()) ; //-----------Start below here. To do: approximate lines of code = 8 // 1. make a stack that holds integers ; //2. push in the integers from 1 to 100 that are divisible by 3 ; //3. print the size ; //4. while stack not empty ; //5. let value hold pop ; //6. if value divisible by 9 then print it. //-----------------End here. Please do not remove this comment. Reminder: no changes outside the todo regions. } } 

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

More Books

Students also viewed these Databases questions

Question

Describe the seven standard parts of a letter.

Answered: 1 week ago

Question

Explain how to develop effective Internet-based messages.

Answered: 1 week ago

Question

Identify the advantages and disadvantages of written messages.

Answered: 1 week ago