answer.
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
garik1379 [7]
2 years ago
5

Define a public static method named s2f that takes two String arguments, the name of a file and some text. The method creates th

e file and writes the text to it. If all goes well the method returns true. If, however, either of its arguments are null or if there is any problem in creating or writing to the file, the method returns false.
Engineering
1 answer:
marin [14]2 years ago
7 0

Answer:

import java.io.IOException;

import java.io.PrintWriter;

/*

* To change this license header, choose License Headers in Project Properties.

* To change this template file, choose Tools | Templates

* and open the template in the editor.

*/

public class WriteFile {

public static boolean s2f(String fileName,String content)

{

boolean result = true;

if(content == null || fileName == null)

result = false;

else

{

try{

PrintWriter fileWriter = new PrintWriter(fileName, "UTF-8");

fileWriter.println(content);

fileWriter.close();

} catch (IOException e) {

result = false;

}

}

return result;

}

public static void main(String[] args)

{

boolean res = s2f("data.txt","Java is awesome.");

if(res==true)

System.out.println("Successful");

else

System.out.println("There was some error in writing to a file.");

}

}

You might be interested in
Anytime scaffolds are assembled or __________, a competent person must oversee the operation.
egoroff_w [7]
D. made because made is a synonym for assembled
4 0
2 years ago
Read 2 more answers
Small droplets of carbon tetrachloride at 68 °F are formed with a spray nozzle. If the average diameter of the droplets is 200 u
Licemer1 [7]

Answer:

the difference in pressure between the inside and outside of the droplets is 538 Pa

Explanation:

given data

temperature = 68 °F

average diameter = 200 µm

to find out

what is the difference in pressure between the inside and outside of the droplets

solution

we know here surface tension of carbon tetra chloride at 68 °F is get from table 1.6 physical properties of liquid that is

σ = 2.69 × 10^{-2} N/m

so average radius = \frac{diameter}{2} =  100 µm = 100 ×10^{-6} m

now here we know relation between pressure difference and surface tension

so we can derive difference pressure as

2π×σ×r = Δp×π×r²    .....................1

here r is radius and  Δp pressure difference and σ surface tension

Δp = \frac{2 \sigma }{r}    

put here value

Δp = \frac{2*2.69*10^{-2}}{100*10^{-6}}  

Δp = 538

so the difference in pressure between the inside and outside of the droplets is 538 Pa

7 0
2 years ago
1. A glass window of width W = 1 m and height H = 2 m is 5 mm thick and has a thermal conductivity of kg = 1.4 W/m*K. If the inn
emmasim [6.3K]

Answer:

1. \dot Q=19600\ W

2. \dot Q=120\ W

Explanation:

1.

Given:

  • height of the window pane, h=2\ m
  • width of the window pane, w=1\ m
  • thickness of the pane, t=5\ mm= 0.005\ m
  • thermal conductivity of the glass pane, k_g=1.4\ W.m^{-1}.K^{-1}
  • temperature of the inner surface, T_i=15^{\circ}C
  • temperature of the outer surface, T_o=-20^{\circ}C

<u>According to the Fourier's law the rate of heat transfer is given as:</u>

\dot Q=k_g.A.\frac{dT}{dx}

here:

A = area through which the heat transfer occurs = 2\times 1=2\ m^2

dT = temperature difference across the thickness of the surface = 35^{\circ}C

dx = t = thickness normal to the surface = 0.005\ m

\dot Q=1.4\times 2\times \frac{35}{0.005}

\dot Q=19600\ W

2.

  • air spacing between two glass panes, dx=0.01\ m
  • area of each glass pane, A=2\times 1=2\ m^2
  • thermal conductivity of air, k_a=0.024\ W.m^{-1}.K^{-1}
  • temperature difference between the surfaces, dT=25^{\circ}C

<u>Assuming layered transfer of heat through the air and the air between the glasses is always still:</u>

\dot Q=k_a.A.\frac{dT}{dx}

\dot Q=0.024\times 2\times \frac{25}{0.01}

\dot Q=120\ W

5 0
2 years ago
Consider insulation on a circular pipe For the same thickness and type of insulation, the thermal resistance of the insulation i
leonid [27]

Answer:

b). The same for all pipes independent of the diameter

Explanation:

We know,

R_{conduction}=\frac{ln(\frac{r_{2}}{r_{1}})}{2\pi LK}

R_{convection}=\frac{1}{h(2\pi r_{2}L)}

From the above formulas we can conclude that the thermal resistance of a substance mainly depends upon heat transfer coefficient,whereas radius has negligible effects on heat transfer coefficient.

We also know,

Factors on which thermal resistance of insulation depends are :

1. Thickness of the insulation

2. Thermal conductivity of the insulating material.

Therefore from above observation we can conclude that the thermal resistance of the insulation is same for all pipes independent of diameter.

5 0
2 years ago
Which of the following is NOT true about hydraulic valves? A. Directional control valves determine the path of a fluid in a give
Lelechka [254]

Answer: Option D is not true of hydraulic valves. A hydraulic valve is a device that can change the opening degree of liquid flow path

Explanation:

The pilot check valve allows flow of liquid in one direction and blocks flow in the opposite direction

5 0
2 years ago
Other questions:
  • Mary is interested in developing new machines that would increase the productivity of small scale farmers. After high school, wh
    8·1 answer
  • A signalized intersection approach has an upgrade of 4%. The total width of the cross street at this intersection is 60 feet. Th
    15·1 answer
  • A mass of 12 kg saturated refrigerant-134a vapor is contained in a piston-cylinder device at 240 kPa. Now 300 kJ of heat is tran
    8·1 answer
  • A three-story school has interior column bays that are spaced 25 ft apart in both directions. If the loading on the flat roof is
    7·1 answer
  • 1. Saturated steam at 4 bars absolute pressure with a mean velocity of 3 m/s flows through a horizontal SS304 stainless-steel pi
    6·1 answer
  • Can crushers help us recycle in a space efficient way which is good for saving the earth and for giving you more room in your ap
    7·1 answer
  • A 2-m3 rigid tank initially contains air at 100 kPa and 22oC. The tank is connected to a supply line through a valve. Air is flo
    9·1 answer
  • A spherical tank for storing gas under pressure is 25 m in diameter and is made of steel 15 mm thick. The yield point of the mat
    5·2 answers
  • A surface grinding operation is used to finish a flat plate that is 5.50 in wide and 12.500 in long. The starting thickness is 1
    9·1 answer
  • Mr. Ray deposited $200,000 in the Old and Third National Bank. If the bank pays 8% interest, how much will he have in the accoun
    10·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!