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
garik1379 [7]
3 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]3 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
14. An engine is brought into the shop with a
Lostsunrise [7]

Answer:

B. To accurately measure spark advance, use a timing light that incorporates an

ignition advance meter. The spark advance cannot be determined by listening to the way the engine sounds.

8 0
2 years ago
Air at a pressure of 6000 N/m^2 and a temperature of 300C flows with a velocity of 10 m/sec over a flat plate of length 0.5 m. E
White raven [17]

Answer:

Q=hA(T_{w}-T_{inf})=16.97*0.5(27-300)=-2316.4J

Explanation:

To solve this problem we use the expression for the temperature film

T_{f}=\frac{T_{\inf}+T_{w}}{2}=\frac{300+27}{2}=163.5

Then, we have to compute the Reynolds number

Re=\frac{uL}{v}=\frac{10\frac{m}{s}*0.5m}{16.96*10^{-6}\rfac{m^{2}}{s}}=2.94*10^{5}

Re<5*10^{5}, hence, this case if about a laminar flow.

Then, we compute the Nusselt number

Nu_{x}=0.332(Re)^{\frac{1}{2}}(Pr)^{\frac{1}{3}}=0.332(2.94*10^{5})^{\frac{1}{2}}(0.699)^{\frac{1}{3}}=159.77

but we also now that

Nu_{x}=\frac{h_{x}L}{k}\\h_{x}=\frac{Nu_{x}k}{L}=\frac{159.77*26.56*10^{-3}}{0.5}=8.48\\

but the average heat transfer coefficient is h=2hx

h=2(8.48)=16.97W/m^{2}K

Finally we have that the heat transfer is

Q=hA(T_{w}-T_{inf})=16.97*0.5(27-300)=-2316.4J

In this solution we took values for water properties of

v=16.96*10^{-6}m^{2}s

Pr=0.699

k=26.56*10^{-3}W/mK

A=1*0.5m^{2}

I hope this is useful for you

regards

8 0
3 years ago
What is brainstorming and why is it important to create the perfect solution to a problem? giving brainliest to the first answer
Diano4ka-milaya [45]
Brainstorming allows people to think freely without judge, or fear to share there answer. Basically encourages people to open up to what they believe.
5 0
3 years ago
A 200‑m rigid vessel contains a saturated liquid‑vapor mixture with a vapor quality of 75%. The temperature of the vessel is mai
DerKrebs [107]

Answer:

Given,

Temperature;

T = 393;;K

Convert to Celcius;

T = (393-273) degrees

T = 120°C

Using Table A-4 (Saturated water - Temperature table), at T = 120 C;

vf = 0.001060 m³/kg

vg = 0.89133 m³/kg

Quality is given as;

75% = 0.75

Specific volume is given as;

v = vf + x (vg - vf) = 0.001060 + 0.75(0.89133 _ 0.001060)

v= 0.66876 m³/kg

We know;

v = V/m

0.66876  = 100/m

m = 149.53 kg

6 0
3 years ago
-1 1/6 divided by 2 1/3
pantera1 [17]

Answer:

-\frac{1}{2}

Explanation:

-1\frac{1}{6}:2\frac{1}{3}=\\  \\=-\frac{7}{6}:\frac{7}{3}\\  \\=-\frac{7}{6}*\frac{3}{7}\\  \\=-\frac{1}{2}

4 0
3 years ago
Other questions:
  • A pump is used to transport water from a reservoir at one elevation to another reservoir at a higher elevation. If the elevation
    5·1 answer
  • in a vehicle you're servicing the fuel pressure drops rapidly when the engine is says that one or more turned off. Technician a
    7·1 answer
  • What are the two most important things to remember when at the end of your interview?
    6·1 answer
  • If 65 gallons of hydraulic oil weighs 350lb, what is the specific weight of the oil in lb/ft^3?
    14·1 answer
  • 4. Which of the following is the first thing you should do when attempting
    13·2 answers
  • List two skills that are useful when working in teams.
    11·2 answers
  • Sarah and Raj take/takes me to a baseball game every year.
    11·1 answer
  • Workplace bullying can cause_____hazards.
    7·1 answer
  • REVVIVE ME MY MOM WALKED IN MY ROOM AND SCARED THE BAJESUS OUTTA ME
    5·2 answers
  • Pay attention to the following questions!
    14·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!