Objective: Continue familiarization with basic File I/O and simple func- tions.
ID: 3855273 • Letter: O
Question
Objective: Continue familiarization with basic File I/O and simple func- tions. All input is to be read from a file and all output is to be written to a file. Note: Built-in character analysis functions (isdigit), islower), etc.) may not be used Part 0 Standard Header Put your standard output information in a function named ShowHeader () Note: Same as previous assignments Part 1 Character Analysis Write a program that reads in characters from a file and displays the char acteristics of the character, e.g., lower case, etc Specifically, test if the character » is a letter » test if it is lower case or upper case » if the character is a letter, test if it is a vowel or consonant » is a digit. » if the character is a digit, test if the value is odd or even » is a punctuation character. o is a logical operator symbol Write a short function for most operations in the list above. If a character is a letter, then it is either upper or lower case, so we only need to write one function to test the case of the character. Do not use the built-in functions Note: there are no input/output operations in the functions Deliverables: . Program-fully documented » Input-the input file read by your program. ·Output-Neatly formatted and documented . Program design sheet-In addition to your program, input file, and the output, attach a page showing a rough design of your program Suggestion: Develop your program piecewise. For example, make sure you can read your data from a file, then move to the next part (e.g., processing letters or digits).Explanation / Answer
Hi,
Please use below java code-
import java.util.Scanner;
class Practice
{
public static void main(String[] args)
{
Scanner in = new Scanner(System.in);
System.out.println("Input a letter");
String line = in.nextLine();
char c = line.charAt(0);
if( Character.isDigit(c))
System.out.printf("%s Is a digit",c);
else if (Character.isLetter(c))
System.out.printf(" %s Is a Letter",c);
else if(c >= 97 && c <= 123)
{
System.out.println("Lower Case");
}
else if(m >= 65 && m <= 96)
{
System.out.println("Upper Case");
}
if (c='a' || c='e' || c='i' || c='o' || c='u')) {
System.out.println("Vowel");
}
else {
System.out.println("Not Vowel");
}
char [] punctuation = {'.' , ',' , ';' , ':', '?' , '!' , '"' , ''' , ')' , '('};
int i;
for (i = 0; i < punctuation.length;i++){
for(int j = 0; j < word.length(); j++){
if(c == punctuation[i]){
System.out.println("Punctuation character");
}
}
}
if (c.match("[()=;{}[\]+\-*/&!%^|<>']")) {
System.out.println("Logical operator");
}
}
}
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.