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

  Recursive factorial program

Write a class Array that encapsulates an array and provides bounds-checked access. Create a recursive factorial program that prompts the user for an integer N and writes out a series of equations representing the calculation of N!.

  Hunt the wumpus game

Reprot on Hunt the Wumpus Game has Source Code listing, screen captures and UML design here and also, may include Javadoc source here.

  Create a gui interface

Create GUI Interface in java programing with these function: Sort by last name and print all employees info, Sort by job title and print all employees info, Sort by weekly salary and print all employees info, search by job title and print that emp..

  Plot pois on a graph

Write a JAVA program that would get the locations of all the POIs from the file and plot them on a map.

  Write a university grading system in java

University grading system maintains number of tables to store, retrieve and manipulate student marks. Write a JAVA program that would simulate a number of cars.

  Wolves and sheep: design a game

This project is designed a game in java. you choose whether you'd like to write a wolf or a sheep agent. Then, you are assigned to either a "sheep" or a "wolf" team.

  Build a graphical user interface for displaying the image

Build a graphical user interface for displaying the image groups (= cluster) in JMJRST. Design and implement using a Swing interface.

  Determine the day of the week for new year''s day

This assignment contains a java project. Project evaluates the day of the week for New Year's Day.

  Write a java windowed application

Write a Java windowed application to do online quiz on general knowledge and the application also displays the quiz result.

  Input pairs of natural numbers

Java program to input pairs of natural numbers.

  Create classes implement java interface

Interface that contains a generic type. Create two classes that implement this interface.

  Java class, array, link list , generic class

These 14 questions covers java class, Array, link list , generic class.

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