Define a function computegasvolume that returns the volume of a gas given parameters pressure, temperature, and moles. use the gas equation pv = nrt, where p is pressure in pascals, v is volume in cubic meters, n is number of moles, r is the gas constant 8.3144621 ( j / (mol*k)), and t is temperature in kelvin. all parameter types and the return type are double.

Respuesta :

Answer:

Refer below.

Explanation:

A function can be characterized as a connection wherein one thing is reliant on another for its worth.

Clarification: Given R = 8.314J/mol*k

PV = nRT

V = nRT/P

V = 8.314RT/P (cm^3)

Volume of gas =(( 8.314 * R* T)/P ) cm3

Answer:

Incomplete question, we are given the starter code below

Explanation:

The starter code given

gas_const = 8.3144621

def compute_gas_volume((gas_pressure,,gas_temperature,gas_moles):

gas_pressure = 100.0

gas_moles = 1.0

gas_temperature = 273.0

gas_volume = 0.0

gas_volume = compute_gas_volume(gas_pressure, gas_temperature, gas_moles)

print('Gas volume:', gas_volume, 'm^3')

Then, we will want to print

pv = nrt

Gas volume is

v = nrt/p

v = n×r×t ÷ p

So to compute v, we use

public static void main(String args[]){

final Double R = 8.3145;

Double pressure;

Double volume;

Double n;

Double temperature;

System.out.println("What is the number of moles?

n = scan.nextDouble();

System.out.println("What is the tempertaure in K?

temperature = scan.nextDouble();

System.out.println("What is the pressure in atm?

pressure = scan.nextDouble();

volume=(n*R*temperature)/pressure

System.out.println("The volume is " + volume + " m^3 or L");

Since we are already given the value of the parameter. Then, we can write the code as follow

gas_pressure = 100.0

gas_moles = 1.0

gas_temperature = 273.0

gas_volume = 0.0

gas_volume =

GAS_CONST = 8.3144621

defcompute_gas_volume(gas_pressure, gas_temperature, gas_moles):

return gas_moles * GAS_CONST * gas_temperature / gas_pressure