Write a Java program that checks the properness of a given variable name. More specifically, your program should specify whether a user-entered variable name is
You don’t need to check for an uppercase letter for the first letter in the second word, third word, etc.
Sample session:
This program checks the properness of a proposed Java variable name. Enter a variable name (q to quit): streetAddress2 Good! Enter a variable name (q to quit): street address2 Illegal. Enter a variable name (q to quit): StreetAddress2 Good! Enter a variable name (q to quit): 2ndStreetAddress Illegal. Enter a variable name (q to quit): street$address$2 Legal, but uses poor style. Enter a variable name (q to quit): q
PLEASE GIVE IT A THUMBS UP

import java.util.*;
class A{
public static void main(String[] args) {
Scanner sc = new
Scanner(System.in);
System.out.println("This program
checks the properness of a proposed Java variable name.");
while(true){
System.out.print("Enter a variable name (q to quit): ");
String s =
sc.nextLine();
if(s.equals("q"))
break;
if(s.contains("
") || (s.charAt(0)>='0' && s.charAt(0)<='9'))
{
System.out.println("Illegal");
continue;
}
int
flag=0;
for(int
i=0;i<s.length();i++){
if(((s.charAt(i)>='a' &&
s.charAt(i)<='z') || (s.charAt(i)>='A' &&
s.charAt(i)<='Z') || (s.charAt(i)>='0' &&
s.charAt(i)<='9'))==false)
{
System.out.println(" Legal,
but uses poor style");
flag=1;
break;
}
}
if(flag==1)
continue;
System.out.println("Good!");
}
}
}
![1 2 3 5 6 7 8 import java.util.; class A{ public static void main(String[] args) { Scanner sc = new Scanner(System.in); Syste](http://img.homeworklib.com/questions/13208220-fd54-11eb-8200-6115e0d027ef.png?x-oss-process=image/resize,w_560)
Write a Java program that checks the properness of a given variable name. More specifically, your...
– Palindrome Game Please write a Java program to verify whether a given word is a palindrome. You must stop your program when the user enters ‘@’ character as the word. You may write a recursive program to solve this game, but you don’t have to. You may use a stack and/or a queue to solve this game, but you don’t have to. You must run 3 test cases for your program. Your test case #1 must look as follows:...
Your task for this project is to write a parser for a customer form. You need to develop a Java application using Parboiled library. Your program should include a grammar for the parser and display the parse tree with no errors. Remember that your fifth and sixth assignments are very similar to this project and you can benefit from them. The customer form should include the following structure: First name, middle name (optional), last name Street address, city, state (or...
Write a Java program that that capitalizes all first letters of the words in the given String. All other symbols should be intact. If a word does not start with a letter, it should remain intact as well. Assume that the parameter String can only contain spaces and alphanumeric characters. Example: Input: “100 234 jus 23 jskl” Output: “100 234 Jus23 jskl”
**IN JAVAAssignment 10.1 [95 points]The WordCruncher classWrite the Java code for the class WordCruncher. Include the following members:A default constructor that sets the instance variable 'word' to the string "default".A parameterized constructor that accepts one String object as a parameter and stores it in the instance variable. The String must consist only of letters: no whitespace, digits, or punctuation. If the String parameter does not consist only of letters, set the instance variable to "default" instead. (This restriction will make...
Write a Java Program that performs the following functionalities: and you can use if statements, cases, and string methods Enter a new main sentence Find a String Find all incidents of a String Find and Replace a String Replace all the incidents of a String Count the number of words Count a letter’s occurrences Count the total number of letters Delete all the occurrences of a word Exit The program will display a menu with each option above, and then...
Write a program that inputs a string from the user representing a password, and checks its validity. A valid password must contain: -At least 1 lowercase letter (between 'a' and 'z') and 1 uppercase letter (between 'A' and 'Z'). -At least 1 digit (between '0' and '9' and not between 0 and 9). At least 1 special character (hint: use an else to count all the characters that are not letters or digits). -A minimum length 6 characters. -No spaces...
JAVA Write a program that prompts the user to enter a year and the first three letters of a month name (with the first letter in uppercase) and displays the number of days in the month. If the input for month is incorrect, display a message as shown in the following sample run. SAMPLE RUN 1: Enter a year: 2001 Enter a month: Jan Jan 2001 has 31 days SAMPLE RUN 2: Enter a year: 2016 Enter a month: Feb...
I have to use java programs using netbeans. this
course is introduction to java programming so i have to write it in
a simple way using till chapter 6 (arrays) you can use (loops ,
methods , arrays)
You will implement a menu-based system for Hangman Game. Hangman is a popular game that allows one player to choose a word and another player to guess it one letter at a time. Implement your system to perform the following tasks: Design...
Write a Java program to do the following with your name. This can all be done in the main() method. 1. Create a String variable called myName and assign your personal name to it. Use proper capitalization for a legal name. I.e. String myName = "Billy Bob"; 2. Load myName with the upper case version of itself and display the result. 3. Load myName with the lower case version of itself and display the result. 4. Capitalize the first letter...
(Java) HELP! Create a program that will ask the user to enter their first name and their favorite number. Ask the user if they would like the information repeated back to them. If they type "Y" display the answers back to them. If they type anything else, display the word "Goodbye". An example of what your output window should look like is below. The system-generated output is in red. The user-provided input is in green. (Your actual program will only...