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

  Write a java program in a netbeans project

Write a Java program in a NetBeans project

  Tracer for java

Implementation of a tracer of Java objects and the tracer can be invoked from any point of a Java program, accepting an object as argument.

  Creates pet objects from data read from the keyboard

The assignment is to write a program that creates Pet objects from data read from the keyboard. Store these objects into an instance of ArrayList.

  Which drags html list items to and from a javascript array

Write a program which drags html list items to and from a javascript array.

  Program that allows a user to input coordinates

In Java make a program that allows a user to input coordinates as to make a Hexagon via an array, and my professor has set the standards of: Write a class Polygon which draws a hexagon for a set of numbers given by the user.

  Write java program which simulates flipping of coin

Write a Java program which simulates flipping of coin 1000 times and prints total number of heads and tails. You should create a class.

  Write program in java for total amount of customer-s order

Write down program in Java which would ask for clerk to enter total amount of customer's order. Program will then compute seven percent (7%) sales tax.

  Own file to test your program

Create your own file to test your program. Your job is to set up the input and output files to have the program read from a file and write to a file. Here is a basic program that will accomplish what is desired

  Develop a gui based java program

Designing and developing a College Registration program

  Java program use breadth-first search closest broadcast

Write the java program which will use breadth-first search (which you implement as part of your program) to determine the closest broadcast vertex for each vertex in graph.

  Sorted list adt and the binary search tree adt

Explain the differences between our specifications of the Sorted List ADT and the Binary Search Tree ADT.

  Compute the temperature in centigrade

Compute the temperature in Centigrade - Display the temperatures in both Centrigrade and Fahrenheit with appropriate labels, using the + operator to concatenate the labels with the variables

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