Question
It should be similar like this. import javax.swing.JOptionPane; public class Project0 { public static int upperCase = 0; public static int lowerCase = 0; public
It should be similar like this.
import javax.swing.JOptionPane;
public class Project0 { public static int upperCase = 0; public static int lowerCase = 0; public static int numberCount = 0; public static void main(String[] args) { // ask type in a sentence String sentence = JOptionPane.showInputDialog("Enter a sentence: (type STOP to quit)");
// executing till the user types "STOP". while (!"STOP".equalsIgnoreCase(sentence) && sentence != null) {
//scan the string and count the number of upper case letters, lower case letters and digits for (char c : sentence.toCharArray()) { if (Character.isUpperCase(c)){ upperCase++; } else if (Character.isLowerCase(c)){ lowerCase++; } else if (Character.isDigit(c)){ numberCount++; } }
Plz write the whole program
Write a Java prog ram that will 1. Ask the user to type in a sentence, using a JOptionPane.showlnputDialog) 2. The program will examine each letter in the string and count how many time the upper-case letter 'E' appears, and how many times the lower-case letter'e' appears. The key here is to use the charAt method in class String 3. Using a JOptionPane.showMessageDialog), tell the user how many upper and lower case e's were in the string Repeat this process until the user types the word "Stop". (Check out the method equalslgnoreCase in class String to cover all upper/lower case possibilities of the word "STOP") 4. Input Message ? Please enter a sentence Number of lower case e's: 4 Every tree is not an Elm, Emilie Number of upper case e's: 3 OK Cancel OKStep by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started