1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
m_a_m_a [10]
3 years ago
14

import java.io\.\*; import java.nio.file\.\*; public class TestFileReader { public static void main(String[] args) { Path p = Pa

ths.get("a.txt"); try (BufferedReader in = new BufferedReader( new FileReader(p.toFile()))) { String line = in.readLine(); while (line != null) { String[] v = line.split("::"); String lname = v[0]; String fname = v[1]; String dept = v[2]; System.out.println(fname + " " + lname + ", dept " + dept); line = in.readLine(); } } catch (FileNotFoundException e) { System.out.println("File not found."); } catch (IOException e) { System.out.println("I/O error."); } } } (Refer to code example 15-1.) What delimiter is used to separate fields in the a.txt file?
Computers and Technology
1 answer:
Charra [1.4K]3 years ago
6 0

Answer:

The delimiter use is "::".

Explanation:

The Java inbuilt String.split( ) function is use to split a String into an array of String.

The split( ) takes delimiter as arguments/parameter which determines at which point the string is to be broken down into different part/token.

From the above code snippet;

Each line in the file a.txt that is not null is splitted using the statement below:

String[ ] v = line.split("::");

The line is splitted using "::" as delimiter and the resulting array is then assigned to the variable 'v'.

For instance, a line in the file could take the form:

John::Smith::Music

When it is splitted,

String lname = John;

because lname make reference to index 0 of the array.

String fname = Smith;

because fname make reference to index 1 of the array.

String dept = Music;

and dept make reference to index 2 of the array.

You might be interested in
Draw a flow chart that accepts mass and volume as input from the user. The flow chart should compute and display the density of
TiliK225 [7]

Answer:

See attachment for flowchart

Explanation:

The flowchart is represented by the following algorithm:

1. Start

2. Input Mass

3. Input Volume

4 Density = Mass/Volume

5. Print Density

6. Stop

The flowchart is explained by the algorithm above.

It starts by accepting input for Mass

Then it accepts input for Volume

Step 4 of the flowchart/algorithm calculated the Density using the following formula: Density = Mass/Volume

Step 5 prints the calculated Density

The flowchart stops execution afterwards

Note that the flowchart assumes that the user input is of number type (integer, float, double, etc.)

6 0
3 years ago
Object-oriented systems have three general types of cohesion: _____, _____, and _____. A. method, class, inheritance B. method,
Verdich [7]

Answer:

D. method, class, generalization/specialization

Explanation:

The Cohesion is said to be the level to what an element of a module is related to others. Generally, the cohesion can be understood as an internal adhesive that holds together the modules. If the software is good then it is going to have high cohesion. Method and class are type of cohesion, as they hold the modules together. And generalization/specialization also is a general type of cohesion as generalization tracks the common features among the class, and binds them into one superclass. However, the specialization means creating subclasses out of the classes, and which is the meaning of the specialization. In an ideal situation, there should be high cohesion or single responsibility. However, in the case of inheritance, there can be multiple responsibilities. And hence composition like a generalization, specialization, association, aggregation are used to make use of the composition for reuse rather than inheritance. Have you seen language supporting multiple inheritances. You will never see it though there is some way. And its never allowed to ensure high cohesion. And hence three general types of cohesion are method, class and generalization/specialization. And this is option D.

4 0
3 years ago
Create your own Python code examples that demonstrate each of the following. Do not copy examples from the book or any other sou
natulia [17]
Ssfhooiyfbjkoyfvhkodd
6 0
3 years ago
Six external parts of a computer system, which are output and which are input devices.
Zigmanuir [339]
1. The keyboard is an example of an input device.
2. A mouse is an example of an input device.
3. Display Monitors are examples of output devices as they display information.4. Audio speakers are examples of output devices.5. Headsets with microphones are an example of both an input and output device as they allow sound to be inputted and receive sound.6. Printer/Printer scanner. A printer would be an example of an output device, however, a printer scanner combination would be both input and output.

3 0
3 years ago
QUESTION 11
tino4ka555 [31]

Answer:

x == 32

Explanation:

CODE in Java:

       int x = 32;

       if(x == 32){

           System.out.println("Pass");

       }

       else{

           System.out.println("Fail");

       }

OUTPUT:

Pass

8 0
2 years ago
Other questions:
  • Up to 10 people is a good guideline for the size of your study group.
    15·1 answer
  • Multiple users report that the network printer, which is connected through the print server, is not printing. Which of the follo
    12·1 answer
  • What is one of the most helpful things about having a role model?
    10·2 answers
  • Which question about whale sharks is nonscientific?
    11·2 answers
  • Being nice take the points​
    9·1 answer
  • AYUDAAAA!!!!! URGENTE!!!!!!1<br> ¿para que sirve la "BIG DATA"?
    9·1 answer
  • Define a function pyramid_volume with parameters base_length, base_width, and pyramid_height, that returns the volume of a pyram
    6·2 answers
  • In a swap you need a variable so that one of the values is not lost ? Need help
    7·2 answers
  • The Python language uses a compiler which is a program that both translates and executes the instructions in a high-level langua
    15·1 answer
  • 2.4 Code Practice: Question 2
    5·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!