Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

I am trying to create a letter counter program that simply counts occurences of a character in a string. I am unsure why the code

I am trying to create a letter counter program that simply counts occurences of a character in a string. I am unsure why the code is not compiling. If you could just fix and explain, it would be much appreciated.

import java.util.*;

public class LetterCounterPC5 { public static void main(String{} args) { //variable declaration int count = 0; String inputstring; String str; char character; //create a scanner class Scanner keyboard = new Scanner(System.in); //user enters string System.out.println("Enter a string"); //read string inputstring = keyboard.nextLine(); //user enters char System.out.println("Enter a character"); //read char str = keyboard.nextLine(); character=str.charAt(0); //loop to find frequency of char in string for(int i=0; i

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

Introduction To Constraint Databases

Authors: Peter Revesz

1st Edition

1441931554, 978-1441931559

More Books

Students also viewed these Databases questions

Question

List terms to find a. b. n2 72

Answered: 1 week ago

Question

3. Do you have any digital marketing experience?

Answered: 1 week ago

Question

Types of physical Maps?

Answered: 1 week ago

Question

Explain Intermediate term financing in detail.

Answered: 1 week ago

Question

Types of cultural maps ?

Answered: 1 week ago

Question

Discuss the various types of leasing.

Answered: 1 week ago

Question

=+2 How can the effectiveness of global virtual teams be improved?

Answered: 1 week ago

Question

=+1 What are the major issues related to international T&D?

Answered: 1 week ago