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]
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
Who is father of Engineer?
3241004551 [841]

John Smeatom, U.K. 18th century, was the first self-proclaimed, civil engineer in the 18th century and IS considered “the father of modern, civil engineering”.

hoped this helped! :)

4 0
3 years ago
Read 2 more answers
The distribution of actual weights of 8‑ounce wedges of cheddar cheese produced at a dairy is Normal, with mean 8.1 ounces and s
s344n2d4d5 [400]

Answer:

sampling distribution

Explanation:

Sampling distribution is distribution of multiple samples' satistics of a population.

3 0
3 years ago
You can help build a safe work environment by using your knowledge of violence prevention strategies to spot what?
Ostrovityanka [42]

Answer:

warning signs

Explanation:

give directions on your surroundings

4 0
2 years ago
Outline the process used to test the following hypothesis: Titanium cages are stronger than steel cages for hockey goalie masks.
son4ous [18]

Answer:

true

Explanation:

8 0
2 years ago
An industrial plant consists of several 60 Hz single-phase motors with low power factor. The plant absorbs 600 kW with a power f
Gelneren [198K]

Answer:

(a) Q=332 kvar and C=5.66 uF

(b) pf=0.90 lagging

Explanation:

Given Data:

P=600kW

V=12.47kV

f=60Hz

pf_{old} =0.75

pf_{new} =0.95

(a) Find the required kVAR rating of a capacitor

\alpha _{old}=cos^{-1}(0.75) =41.41°

\alpha _{new}=cos^{-1}(0.95) =18.19°

The required compensation reactive power can be found by

Q=P(tan(\alpha_{old}) - tan(\alpha_{new}))

Q=600(tan(41.41) - tan(18.19))

Q=332 kvar

The corresponding capacitor value can be found by

C=Q/2\pi fV^{2}

C=332/2*\pi *60*12.47^{2}

C=5.66 uF

(b) calculate the resultant supply power factor

First convert the hp into kW

P_{mech} =250*746=186.5 kW

Find the electrical power (real power) of the motor

P_{elec} =P_{mech}/n

where n is the efficiency of the motor

P_{elec} =186.5/0.80=233.125 kW

The current in the motor is

I_{m} =(P/\*V*pf)

The pf of motor is 0.85 Leading

Note that represents the angle in complex notation (polar form)

I_{m} =(233.125/12.47*0.85)

I_{m}=18.694+11.586j A

Now find the Load current

pf of load is 0.75 lagging (notice the minus sign)

I_{load} =(600/12.47*0.75)

I_{load} =48.115-42.433j A

Now the supply current is the current flowing in the load plus the current flowing in the motor

I_{supply} =I_{m} + I_{load}

I_{supply}= (18.694+11.586)+(48.115-42.433)

I_{supply} =66.809-30.847j A

or in polar form

I_{supply} =73.58°

Which means that the supply current lags the supply voltage by 24.78

therefore, the supply power factor is

pf=cos(24.78)=0.90 lagging

Which makes sense because original power factor was 0.75 then we installed synchronous motor which resulted in improved power factor of 0.90

8 0
3 years ago
Other questions:
  • A 15 cm × 15 cm circuit board dissipating 20 W of power uniformly is cooled by air, which approached the circuit board at 20C w
    11·1 answer
  • The air contained in a room loses heat to the surroundings at a rate of 60 kJ/min while work is supplied to the room by computer
    7·2 answers
  • After a capacitor is fully chargerd, a small amount of current will flow though it. what is this current called?
    14·1 answer
  • Explain the difference in the heat transfer modes of conduction and convection.
    14·1 answer
  • Water enters a leaky cylindrical tank (D = 1 ft) at a rate of 8 ft3/min. Water leaks out of the tank at a rate of 17% of the flo
    14·1 answer
  • What is the hardest part of thermodynamics?
    5·1 answer
  • What are the important things to remember when arriving for an interview?
    15·1 answer
  • Ppman2000 Aye Get On Treasure Quest and Join Masons Kingdom :D
    10·1 answer
  • Explain how you would solve for total resistance in a parallel circuit versus a series circuit. How would you apply and solve fo
    10·1 answer
  • A jointed arm robot can rotate on the following 6 axes?
    8·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!