Method summarizesequences that takes a string as a parameter

Assignment Help JAVA Programming
Reference no: EM13166353

  1. What is the difference between throwing an exception and catching an exception? Provide an answer in two to three sentences.
  2. Implement the method getSequence that takes a Scanner as a parameter. It should read Strings one line at a time from the Scanner and store them in an ArrayList<String> until it reaches a line with a single '.' character on it. It should then return the array list to the calling program.
    public static ArrayList<String> getSequence(Scanner in)
    
  3. Now implement the method summarizeSequences that takes a String as a parameter. This method should open the file named by this String, and read a sequence from that file into an array list using the getSequence method you wrote above. It should then display on a single line the first, last, and middle String in the sequence (if the list is even, the position of the "middle" String is the size of the list divided by 2). Make sure you catch and handle the possible IOException exceptions.
    public static void summarizeSequences(String fileName)
    
  4. Now implement the method writeSequenceReverse that takes a PrintWriter and an ArrayList<String> as parameters. This method shouldwrite the Strings in the ArrayList to the PrintWriter in reverse order and then write a line with a single '.' on it.
    public static void writeSequenceReverse(PrintWriter out,
    ArrayList<String> list)
  5. Now implement a method reverseSequences that takes two Strings as parameters. The first String is the name of an input file containing String values and the second is the name of an output file to write the reverse sequences to. The method should read sequences from the input file one sequence at a time using getSequence and then write them out to the output file. Do not forget to close the output file when the method is finished. Make sure you catch and handle the possible IOException exceptions.
    public static void reverseSequences(String inputFile, 
    String outputFile)

Reference no: EM13166353

Questions Cloud

Calculate the heat of combustion of propane : burning 480 cm3 of propane measured at r.t.p,caused the temperture of 250 cm3 of water to increase by 42.5 celsius. calculate the heat of combustion of propane.
Identify and correct the errors : Identify and correct the erros in the following program. void nPrintln(string message, int n){int n=1;for (int i=0; i int main (){nPrintln(5, "Welcome to C++!");}
Constructor that accepts a file name as its argument : Write a class with a constructor that accepts a file name as its argument. Assume the file contains a series of numbers, each written on a separate line. The class should read the contents of the file into an array, and then displays the following..
Estimate the radius of the molecules : The critical constants of ethane are Pc = 48.20 atm, Vc = 148 (cm^3)/mol, and Tc = 305.4 K. Calculate the van der Waals parameters of the gas, and estimate the radius of the molecules.
Method summarizesequences that takes a string as a parameter : Now implement the method summarizeSequences that takes a String as a parameter. This method should open the file named by this String, and read a sequence from that file into an array list using the getSequence method you wrote above
Writing return statement in a value returning function : What would be wrong with not writing returnstatement in a value returing function? Can you have a returnstatement in a void function? Does the return statement in the following function cause syntax error?
What are the data entities of this enterprise : Consider a student club or organization in which you are a member. What are the data entities of this enterprise? List and define each entity
Sketch a normal.probability plot to check the normality : If it is a t test, sketch a normal.probability plot to check the normality of the population.6. State the null and alternative hypothesis.7. Decide on the significance level, alpha.
A stack data structure that uses a linked list for storing : In Python, implement a stack data structure that uses a linked list for storing its elements. In particular, you will need to implement the following three functions: 1. top(): This function returns the element that is at the top of the stack, but it..

Reviews

Write a Review

JAVA Programming Questions & Answers

  Define get and set functions and two constructors

Create a class called Building. It will have one data member of type string (used for a postal address). Define get and set functions and two constructors.

  Java program for real estate agent

Write down java program for real estate agent. Program must perform the following tasks: ask users for average house price for the each of past 5 years for single family residence of 1500 square feet.

  Develop class which implements interface

Let the ADT called SquareMatrix. (The matrix can be represented by 2-D array of ints w/ n rows and n columns.) Write specification for ADT as Java interface. Develop the class which implements interface.

  Program that initializes an array with ten random integers

Write a JAVA program that initializes an array with ten random integers and then prints four lines of output, containing

  Displays every perfect number from 1 through 1000

Write an application that displays every perfect number from 1 through 1000. A perfect number is one that equals the sum of all the numbers that divide evenly into it.

  One search function

One search function will use a sentinel to mark the end of the array. The other search function will use an array length (maximum legal index into the array) to determine when to exit the search loop. Both functions must return true when the searc..

  Develop view for order number and order total in file

Develop a view named OrdTot. It comprises of order number and order total for each order currently on file. Order total is the sum of number ordered.

  Describe the steps to program development

What is the function of parseFloat and parseInt and what will be result if we send "abcd" through a prompt() input and pass it through parseInt()?

  Prepare executable program and a dictionary program

Prepare executable program and a dictionary Program.

  Create a java program

UserApp and PrettyPrintUtility multiple times (supplying different TransData test file names), the AutoTesterUtility PROGRAM will be the driver program.

  Given a sequence of 10 integers

Write a program given that given a sequence of 10 integers, find out and delete the maximum and minimum number, then compute the average of the rest.

  User enter a series of numbers

Design a java program with a loop that lets the user enter a series of numbers. The user should enter - 99 to signal the end of the series. After all the numbers have been enter been entered, the program should display the largest and smallest number..

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd