1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
Dafna11 [192]
4 years ago
6

Write a method that uses a stack to determine if a string has an amount divisible by 3 of a letter that is given as a parameter

to the method.
Examples: Input String and Character => output
"zookeeper" and ‘o’ => false
"zookeeper" and ‘z’ => false
"zookeeper" and ’s’ => true
"zookeeper" ‘e’ => true

Computers and Technology
1 answer:
Radda [10]4 years ago
3 0

Answer:

Check the explanation

Explanation:

CODE IN JAVA:

StackDemo.java file:

import java.util.Stack ;

public class StackDemo {

  public static boolean checkStringAmount(String s, char ch) {

      Stack<Character> stack = new Stack<>();

     

      for(int i = 0 ; i < s.length(); i++) {

          if(s.charAt(i) == ch) {

              stack.push(ch);

          }

      }

      return stack.size() % 3 == 0 ;

  }

  public static void main(String[] args) {

     

      System.out.println("checkStringAmount(\"zookeeper\", 'o') : " + checkStringAmount("zookeeper", 'o'));

      System.out.println("checkStringAmount(\"zookeeper\", 'z') : " + checkStringAmount("zookeeper", 'z'));

      System.out.println("checkStringAmount(\"zookeeper\", 's') : " + checkStringAmount("zookeeper", 's'));

      System.out.println("checkStringAmount(\"zookeeper\", 'e') : " + checkStringAmount("zookeeper", 'e'));

  }

}

Kindly check the attached image below to see the Code Output.

You might be interested in
Video digitization is the process of
Nonamiya [84]

Answer:

converting analog information into binary form, which can be more easily edited and shared

Explanation:

Digitization is conversion of data into digital format. Data is converted into small piece of storing unit called bits.  

Video digitization is the process of analog to digital conversion of video-graphic information. Analog signal is sampled based on its amplitude at uniformly distributed time period and then converted into binary data(bits) which is called digital data.

5 0
3 years ago
Read 2 more answers
PLS ANSWER ASAP!!!! <br><br> In three to five sentences, explain the function of utilities.
il63 [147K]

Answer:

In economics, utility function is an important concept that measures preferences over a set of goods and services. Utility represents the satisfaction that consumers receive for choosing and consuming a product or service.  Utility function is widely used in the rational choice theory to analyze human behavior.

Explanation:

7 0
3 years ago
Many interpretations of Hamlet exist, from long to short, from serious to humorous, and each calls attention to different aspect
madam [21]

Answer:

This video presents only the most important points in the plot:

the appearance of Hamlet's father's ghost

Claudius's efforts to determine the cause of Hamlet's strange behavior

Hamlet's soliloquy

Hamlet's rudeness to Ophelia, which leaves her heart-broken

the staging of the play, after which Hamlet is certain of Claudius's guilt

the scene in which Hamlet loses an opportunity to kill Claudius

the scene in which Hamlet rebukes his mother and then accidentally kills Polonius

Claudius's plan to kill Hamlet, which he shares with Laertes

the scene in the graveyard, in which Hamlet holds Yorick's skull

the scuffle between Laertes and Hamlet when Ophelia is buried

the duel between Laertes and Hamlet, followed by Gertrude's death, Hamlet's killing of Claudius, and Hamlet's death

The quick succession of events in this video seems to suggest that the sequence of events in the play is rather unlikely.

The major themes of the play, such as appearance versus reality, moral corruption, the complexity of action, and the mystery of death are not evident in this adaptation. Other important aspects of the play that the video does not address are the question of Hamlet's madness, his internal conflict, and his inaction. The video ignores characterization in Hamlet and the treatment of philosophical ideas throughout the play.

PLATO answer

Explanation:

PLATO said so

6 0
4 years ago
Each Google My Business location has a unique ID that applies changes to the right listing.
Soloha48 [4]

Answer:

The correct answer to the following question will be option c. Store Code.

Explanation:

A store code will be the unique ID which can uniquely identify any location of that store.

  • Any random number or name can be the store code.
  • A store code in each Google My Business (GMB) will only be viewable to the person who is managing that locations arround the store.
  • Any costumer doesn't have possibility to see it.

Hence, Option C is the right answer.

6 0
3 years ago
Wireshark capture files, like the DemoCapturepcap file found in this lab, have a __________ extension, which stands for packet c
grin007 [14]

Answer:

The answer is ".pcapng"

Explanation:

Wireshark format includes a "dump" with data packets, which is collected over a channel and sometimes a common folder to store, that data in the PCAP Next Iteration file system.

  • The .pcapng stands for the file system, this file system compatible with the recorded data transmission packet. It includes several data blocks.
  • It is quite robust, but it should not be helped by the other devices. Wireshark allows the libpcap system as well.
5 0
3 years ago
Other questions:
  • Why MUST you request your DSO signed I-20 ship as soon as it is ready and who is responsible to request the I-20
    8·1 answer
  • Create a java program that creates two files. Fill each file with 100 random integer numbers between 1 and 20.
    13·1 answer
  • Jeremy is the team leader of the employees planning to display the company’s new product at a big convention. He needs to be sur
    6·2 answers
  • Which of the following is not anadvantage of simulation?
    14·1 answer
  • You are working with a worksheet on which cell B3 is selected. You hold down the Ctrl key and the Shift key and click cell B6. W
    7·1 answer
  • landon starts his computer and gets message, hard drive is not found. He was watching a movie the previous night, what might the
    6·1 answer
  • Empty parentheses following a function name in a function definition indicate that the function does not require any parameters
    7·1 answer
  • Describe how computers are used to access, retrieve, organize, process, maintain, interpret, and evaluate data and information.
    13·1 answer
  • Can Anyone Send Me The Correct Code To This ?<br><br> ITS JAVA
    12·1 answer
  • Networks that are designed to connect similar computers that share data and software with each other are called:_______
    15·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!