Write a program SumOfTwoDice.java that prints the sum of two random integers between 1 and 6 (such as you might get when rolling dice).

//2-18-14
//TEST ** (double star) program
import java.lang.Math;

public class DicerollTEST{
public static void main(String[] args) {
int SIDES = 6;                                                                                //declares there 6 sides on a die and int SIDES
int a = 1 + (int) (Math.random() * SIDES);                       //Gives the random roll to one die
int b = 1 + (int) (Math.random() * SIDES);                      //Gives the random roll to the second die
int sum = a + b;                                                                            //Adds the sum of the two dice
System.out.println(sum);                                                       //Prints the sum of the 2 dice
}
}

About these ads

Write a program that takes two int values a and b from the command line and prints a random integer between a and b.

import java.lang.Math;
import java.util.Scanner;

public class RandomNumbers{

public static void main(String args[])
{
System.out.println(“Enter a number “); //This prompts the user to enter a number
Scanner scan = new Scanner(System.in);
double t = scan.nextDouble(); //Stores the valuse as a double

System.out.println(“Enter a second number “); //This prompts the user to enter a 2nd number
double v = scan.nextDouble(); //Stores the valuse as a double

double w = Math.floor(Math.random()*(t-v+1)+v); //assigns w to a random number in between t & v
System.out.println(w); //prints w

}
}

Wind chill

Given the temperature t (in Fahrenheit) and the wind speed v (in miles per hour), the National Weather Service defines the effective temperature (the wind chill) to be:

w = 35.74 + 0.6215 t + (0.4275 t – 35.75) v0.16

Write a program WindChill.java that takes two double command-line arguments t and v and prints out the wind chill. Use Math.pow(a, b) to compute ab. Note: the formula is not valid if t is larger than 50 in absolute value or if v is larger than 120 or less than 3 (you may assume that the values you get are in that range).

 

Write a program SpringSeason.java that takes two int values

import java.util.Scanner;

public class SpringSeason{

public static void main(String args[])
{
System.out.println(“Enter the month “); //This prompts the user to enter a month
Scanner scan = new Scanner(System.in);
int month = scan.nextInt(); //Stores the valuse as an int

System.out.println(“Enter the day “); //This prompts the user to enter day
int day = scan.nextInt(); //Stores the valuse as an int

boolean wootwoot = (month == 3 && day >= 20 && day <= 31)
|| (month == 4 && day >= 1 && day <= 30)
|| (month == 5 && day >= 1 && day <= 31)
|| (month == 6 && day >= 1 && day <= 20);

System.out.println(wootwoot);

}
}

How Much Energy is Released?

How much energy (in kilojoules) is released when 7.40g of water at 39.0∘C is cooled to -18.0∘C? The heat of fusion of water is 6.01 kJ/mol, and the molar heat capacity is 36.6 J/(K⋅mol) for ice and 75.3 J/(K⋅mol) for liquid water.

What is the Radius of a Tungsten atom?

The length of a unit-cell diagonal that passes through the center atom in tungsten is equal to 549 pm.

What is the radius (in picometers) of a tungsten atom?

What is the entropy of vaporization?

Naphthalene, better known as “mothballs,” has bp= 218∘C and ΔHvap = 43.3kJ/mol.

What is the entropy of vaporization, ΔSvap [in J/(K⋅mol)] for naphthalene?

Dalton’s Law of Partial Pressure

A 1-L flask is filled with 1.10g of argon at 25 ∘C. A sample of ethane vapor is added to the same flask until the total pressure is 1.40atm .

What is the partial pressure of argon, P(Ar), in the flask?

What is the partial pressure of ethane, P(ethane), in the flask?

Biochemical Applications of the Gas Laws

The various gas laws can be used to describe air, which is a mixture of gases. In some cases, these laws have direct application to the air that we breathe.

A.)  How long does it take a person at rest to breathe one mole of air if the person breathes 80.0mL/s of air that is measured at 25 ∘C and 755 mmHg?

B.)  Typically, when a person coughs, he or she first inhales about 2.30L of air at 1.00 atm and 25 ∘C. The epiglottis and the vocal cords then shut, trapping the air in the lungs, where it is warmed to 37 ∘C and compressed to a volume of about 1.70 L by the action of the diaphragm and chest muscles. The sudden opening of the epiglottis and vocal cords releases this air explosively. Just prior to this release, what is the approximate pressure of the gas inside the lungs?

C.)  Helium-oxygen mixtures are used by divers to avoid the bends and are used in medicine to treat some respiratory ailments. What percent (by moles) of He is present in a helium-oxygen mixture having a density of 0.538g/L at 25 ∘C and 721 mmHg?

 

Partial Pressure and the Ideal Gas Law

The ideal gas law, PV=nRT is independent of the kind of gas. In other words, the pressure exerted by a given number of ideal gas particles is the same whether the sample consists of all one type of particle or a mixture of different kinds of particles.

Therefore, the pressure exerted by a mixture of gases can be expressed as follows:

Ptotal=(n1+n2+n3+⋯)RTV=ntotalRTV

partial pressure is the pressure exerted by just one type of gas in a mixture. A partial pressure is calculated using only the number of moles of that particular gas, instead of the total number of moles:

P1=n1RTV, P2=n2RTV, P3=n3RTV,etc.

The sum of the partial pressures is equal to the total pressure in the mixture:

Ptotal=P1+P2+P3+⋯

Air is about 78.0% nitrogen molecules and 21.0% oxygen molecules. Several other gases make up the remaining 1% of air molecules.  What is the partial pressure of nitrogen in air at atmospheric pressure (1 atm)? Assume ideal behavior.

Follow

Get every new post delivered to your Inbox.

Join 2,038 other followers

%d bloggers like this: