You have been asked to develop an application that accepts a sentence from the user and calculates and displays the number of vowels, consonants and spaces in that sentence. The application should run once and then ask the user if they would like to run it again. NB. The only acceptable characters are space, vowels and consonants. You are not expected to code for this. It is relevant only when testing the application. Your application should be developed using instantiable classes and should make use of the JOptionPane class for input and output. Save your instantiable class as Counting.java
Given below is the code for the question. Please do rate the answer
if it helped. Thank you.
Counting.java
------
import javax.swing.JOptionPane;
public class Counting {
private String sentence;
private int vowels;
private int consonants;
private int spaces;
public Counting(String s) {
sentence = s;
countVowels();
countConsonants();
countSpaces();
}
public String getStats() {
String s = "Vowels: " + vowels +
"\n"
+"Consonants: " + consonants + "\n"
+ "Spaces: " + spaces;
return s;
}
private void countVowels() {
vowels = 0;
for(int i = 0; i <
sentence.length(); i++) {
char c =
sentence.charAt(i);
if(c == 'a' || c
== 'e' || c == 'i' || c == 'o' || c == 'u' ||
c == 'A' || c == 'E' || c ==
'I' || c == 'O' || c == 'U')
vowels++;
}
}
private void countConsonants() {
consonants = 0;
for(int i = 0; i <
sentence.length(); i++) {
char c =
sentence.charAt(i);
if(!(c == 'a' ||
c == 'e' || c == 'i' || c == 'o' || c == 'u' ||
c == 'A' || c == 'E' || c ==
'I' || c == 'O' || c == 'U' ||
c == ' ' || c == '\t' || c ==
'\n'))
consonants++;
}
}
private void countSpaces() {
spaces = 0;
for(int i = 0; i <
sentence.length(); i++) {
char c =
sentence.charAt(i);
if(c == ' ' || c
== '\t' || c == '\n')
spaces++;
}
}
public static void main(String[] args) {
String input =
JOptionPane.showInputDialog("Enter a sentence");
Counting c = new
Counting(input);
JOptionPane.showMessageDialog(null, c.getStats());
}
}


You have been asked to develop an application that accepts a sentence from the user and...
PYTHON PROGRAM Write an application that accepts a sentence as input from the user and displays all of the words in the sentence that have an odd number of letters in them
Develop a VB.Net application that gets input from the user about the radius of a circle, calculates the diameter, circumference, and area of the circle, and displays the results in three textboxes. The three textboxes should be disabled for user input. A logic flow and the form that implements the flow are required for this problem.
You have been asked to develop a mobile phone application that allows users to inventory items in their home for insurance purposes (in case of theft or fire.) Users can create categories and subcategories of items (Electronics, Computers, Furniture, etc.) and then list items within each category. The software should allow the user to create a description of the item, take a photo, and input the purchase price. Other information may be required of specific types of objects (a TV...
(2 bookmarks) In JAVA You have been asked to write a program that can manage candidates for an upcoming election. This program needs to allow the user to enter candidates and then record votes as they come in and then calculate results and determine the winner. This program will have three classes: Candidate, Results and ElectionApp Candidate Class: This class records the information for each candidate that is running for office. Instance variables: first name last name office they are...
In Java please
Only use methods in the purpose.
Thank you
The purpose of this assignment is to help you learn Java identifiers, assignments, input/output nested if and if/else statements, switch statements and non-nested loops. Purpose Question 2-String variables/Selection & loops. (8.5 points) Write a complete Java program which prompts the user for a sentence on one line where each word is separated by one space, reads the line into one String variable using nextline), converts the string into Ubbi...
This exercise guides you through the process of converting an Area and Perimeter application from a procedural application to an object-oriented application. Create and use an object 1. Open the project named ch04_ex2_Area and Perimeter that’s stored in the ex_starts folder. Then, review the code for the Main class. 2. Create a class named Rectangle and store it in the murach.rectangle package. 3. In the Rectangle class, add instance variables for length and width. The, code the get and set...
Java project: A Bank Transaction System For A Regional Bank User Story A regional rural bank CEO wants to modernize banking experience for his customers by providing a computer solution for them to post the bank transactions in their savings and checking accounts from the comfort of their home. He has a vision of a system, which begins by displaying the starting balances for checking and savings account for a customer. The application first prompts the user to enter the...
You are to write a basic fitness application, in C++, that allows the user of the application to manually edit “diet” and “exercise” plans. For this application you will need to create three classes: DietPlan, ExercisePlan, and FitnessAppWrapper. Diet Plan Attributes: The class DietPlan is used to represent a daily diet plan. Your class must include three data members to represent your goal calories (an integer), plan name (a std::string), and date for which the plan is intended (a std::string)....
Java Lab Exam Example You are asked to develop a Library system demo for the librarian. The system should allow the following functions: 1. Check-in Books a. The system will request users to input the following fields information about books i. Title ii. Price iii. Number of copies to be checked in b. Notes and hints: i. There should have no limit of how many books to be checked in at a time. ii. You can use JOptionPanel or any...
In this project you will create a console C++ program that will have the user to enter Celsius temperature readings for anywhere between 1 and 365 days and store them in a dynamically allocated array, then display a report showing both the Celsius and Fahrenheit temperatures for each day entered. This program will require the use of pointers and dynamic memory allocation. Getting and Storing User Input: For this you will ask the user how many days’ worth of temperature...