Question: both in java please........ 1. n this exercise, you will be counting the number of letters, digits, whitespaces and special characters in a user specified

both in java please........

1. n this exercise, you will be counting the number of letters, digits, whitespaces and special characters in a user specified file. Any character that is not a letter, a digit, or a whitespace should be considered a special character. To complete this program: Using a suitable message, prompt for and read the name of a file from the user and store it in a String Determine if the file exists using the appropriate methods, and if it does not repeatedly prompt the user for a correct filename until you receive one. Inside a loop of your choice, read in one line at a time and test each character in that line o If the character is a letter, a digit, or a whitespace update the appropriate counters o If the character is none of those, update the counter for the special characters Close the file once you are done reading from it Using a suitable message, output the counts of each of the types of character

2.

If you remember your high school biology, DNA is made up of four different nucleotides: adenine (A), thymine (T), guanine (G), and cytosine (C). When DNA is transcribed for the creation of proteins it is converted into RNA which is made up of almost the same nucleotides except that thymine is converted into Uracil (U). For example, the DNA sequence ATGCGCTAG would be converted into AUGCGCUAG in RNA. For this exercise, you will be writing a program that converts DNA into RNA and then storing the new sequence in a new file. To complete this program: Using a suitable message, prompt for and read the name of a file containing a DNA sequence from the user and store it in a String Determine if the file exists using the appropriate methods, and if it does not repeatedly prompt the user for a correct filename until you receive one. Read in the entire DNA sequence from the file to a String and then close the file Determine whether the DNA sequence contains only A,C,G, and T or if it contains other characters o If the DNA sequence contains any characters that are not A,C,G,T your program should inform the user and halt the program

using the appropriate String class method, generate and store a new version of the DNA String, in which all Ts are swapped out for Us o This new String is the RNA version o You may want to examine the String class documentation to see if methods already exist that will swap out all occurrences of one character with a new character for a given String Write the new RNA sequence to the file RNA.txt

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!