The cylinder in the figure(Figure 1) has a moveable piston attached to a spring. The cylinder's cross-section area is 10 cm2, it contains 0.0040mol of gas, and the spring constant is 1500 N/m. At 19 degreesC the spring is neither compressed nor stretched.
How far is the spring compressed if the gas temperature is raised to 200 degrees C ?
In: Physics
Im getting an error on the Player.h class.
Error reads expected initializer before player.
I have put a comment by the line with the error.
sample out put is
Welcome to Rock Paper Scissors
You played: paper
Computer played: paper
It's a tie
Player.h
#include<string>
using namespace std;
class Player{
private:
int play;//variable
public:
string getPlay();//variables
void setPlay(string play);
void setPlay(int play);
}
string Player = getPlay(){//error
if(this.play == 1){
return "rock";
}
else if(this.play == 2){
return
"paper";
}
else if(this.play == 3){
return
"scissors";
}
return "invalid";
}
void Player :: setPlay(stringPlay){//set players
string play
if(play == "rock"){
this.play = 1;
}
else if(play == "paper"){
this.play = 2;
}
else if(play == "scissors"){
this->play = 3;
}
}
void Player :: setPlay(int play){//set players int
play
this.play = play;
}
};
RSPDriver.cpp
#include <iostream>
#include"Player.h"
using namespace std;
int main() {
int comupterPlay;//varriables
int lastPlay;
string userPlay;
Player computer;
Player player;
do{
cout<<"Type rock, paper,
scissors: ";//get users play
cin>>userPlay;
player.setPlay(userPlay);//set
users play
}
do{
computerPlay =
rand() % 3 + 1;//get computers random play
}
while(computerPlay == lastPlay);//set computers play
lastPlay =
computerPlay;
computer.setPlay(computerPlay);
cout<<"Computer played:
"<<computer.getPlay()<<endl;
displayWinner(computer.getPlay(),
player.getPlay())<<endl;
}
return
0:
}
void displayWinner(string com, string player){//define
winner
if(com== "rock" && player
== "rock")
cout<<"It's a tie"<<endl;
else if(com=="rock" && player =="paper")
cout<<"Player wins"<<endl;
else if(com=="rock" && player=="scissors")
cout<<"Computer wins"<<endl;
else if(com=="paper" && player=="paper")
cout<<"It's a tie"<<endl;
else if(com=="paper" && player=="scissors")
cout<<"Player wins"<<endl;
else if(com=="paper" && player=="rock")
cout<<"Computer wins"<<endl;
else if(com=="scissors" && player=="scissors")
cout<<"It's a tie"<<endl;
else if(com=="scissors" && player=="rock")
cout<<"Player wins"<<endl;
else if(com=="scissors" && player=="paper")
cout<<"Computer wins"<<endl;
}
}
In: Computer Science
Part 1: A particular telephone number is used to receive both voice calls and fax messages. Suppose that 20% of the incoming calls involve fax messages, and consider a sample of 20 incoming calls. (Round your answers to three decimal places.)
(a) What is the probability that at most 6 of the calls involve a fax message?
(b) What is the probability that exactly 6 of the calls involve a fax message?
(c) What is the probability that at least 6 of the calls involve a fax message?
(d) What is the probability that more than 6 of the calls
involve a fax message?
Part 2 : Suppose that 4% of the 2 million high school students who
take the SAT each year receive special accommodations because of
documented disabilities. Consider a random sample of 15 students
who have recently taken the test. (Round your probabilities to
three decimal places.)
(a) What is the probability that exactly 1 received a special
accommodation?
(b) What is the probability that at least 1 received a special
accommodation?
(c) What is the probability that at least 2 received a special
accommodation?
(d) What is the probability that the number among the 15 who
received a special accommodation is within 2 standard deviations of
the number you would expect to be accommodated?
(e) Suppose that a student who does not receive a special
accommodation is allowed 3 hours for the exam, whereas an
accommodated student is allowed 4.5 hours. What would you expect
the average time allowed the 15 selected students to be? (Round
your answer to two decimal places.)
Part 3: An airport limousine can accommodate up to four
passengers on any one trip. The company will accept a maximum of
six reservations for a trip, and a passenger must have a
reservation. From previous records, 45% of all those making
reservations do not appear for the trip. Answer the following
questions, assuming independence wherever appropriate. (Round your
answers to three decimal places.)
(a) If six reservations are made, what is the expected number of
available places when the limousine departs?
places
(b) Suppose the probability distribution of the number of
reservations made is given in the accompanying table.
| Number of reservations | 3 | 4 | 5 | 6 |
| Probability | 0.09 | 0.19 | 0.29 | 0.43 |
Let X denote the number of passengers on a randomly selected trip. Obtain the probability mass function of X.
| x | 0 | 1 | 2 | 3 | 4 |
| p(x) |
In: Statistics and Probability
Consider an adiabatic, piston cylinder assembly containing 1 kmol of propane (C3H8) and 7 kmol of oxygen (O2). The piston is initially pinned, and the pressure is P1=1000 kPa with temperature T=1000 K. The pin is removed and the system expands until the total cylinder pressure is P2=100 kPa and the temperature is T2=600 K. Assume ideal gases and constant specific heat.
Oxygen: cp=0.918 kJ/kg*K, cv=0.658 kJ/kg*K, MW=32 kmol/kg
Propane: cp=1.67 kJ/kg*K, cv=1.48 kJ/kg*K, MW=44 kmol/kg
Universal gas constant R=8.314 kJ/kmol*K
Find:
a) the mass of propane and oxygen in kg
b) the initial cylinder volume in m3
c) the work produced from state 1 to 2 in kJ
d) the amound of entropy generated from state 1 to 2 in kJ/K
In: Mechanical Engineering
A.) Mothballs are composed primarily of the hydrocarbon naphthalene (C10H8). When 1.025 g of naphthalene is burned in a bomb calorimeter, the temperature rises from 24.25 ∘C to 32.33 ∘C.
Calculate the standard enthalpy of formation (ΔH∘f) for nitroglycerin. Express the change in energy in kilojoules per mole to three significant figures.
B.) The air within a piston equipped with a cylinder absorbs 575 J of heat and expands from an initial volume of 0.12 L to a final volume of 0.83 L against an external pressure of 1.0 atm.
What is the change in internal energy of the air within the piston?
C.) A 2.95 g lead weight, initially at 10.8 ∘C, is submerged in 8.07 g of water at 51.9 ∘C in an insulated container. What is the final temperature of both the weight and the water at thermal equilibrium? Express the temperature in Celsiu
D.) Suppose that 24 g of each of the following substances is initially at 26.0 ∘C. What is the final temperature of each substance upon absorbing 2.40 kJ of heat?
gold
silver
aluminum
water
In: Chemistry
14.4 15.0 L of an ideal monatomic gas at 3.00 atm and 450 K are contained in a cylinder with a piston. The gas first cools isochorically to 270 K (step 1). It then expands isobarically back to its original temperature (step 2), and then contracts isothermally back to its original volume (step 3). a) Show the series of processes on a pV diagram. b) Calculate the temperature, pressure, and volume of the system at the end of each step in the process. Indicate the p and V values on the pV diagram. c) Compute the total work done by the gas on the piston during each step of the cycle in L - atm, and the total work done by the gas for one complete cycle. d) Compute the heat added during each step of the cycle in L - atm, and the net heat added for one cycle. Compare the total work done with the net heat added. e) Is this an engine or a refrigerator? If it is an engine, what is its efficiency; if it is a refrigerator, what is its coefficient of performance?
In: Physics
1. For each of the cases that follow, draw a picture of the system being described and list as many properties of the equilibrium state as you can, especially the constraints placed on the equilibrium state of the system by its surroundings.
a. The system is placed in thermal contact with a thermostatic bath maintained at temperature T.
b. The system is contained in a constant-volume container and thermally and mechanically isolated from its surroundings.
c. The system is contained in a frictionless piston and cylinder that is exposed to an atmosphere at pressure P and thermally isolated from its surroundings.
d. The system is contained in a frictionless piston and cylinder that is exposed to an atmosphere at pressure P and is in thermal contact with a thermostatic bath maintained at temperature T.
e. The system consists of two insulated tanks of gas connected by tubing. A valve between the two tanks is fully opened for a short time and then closed. (Note: Think through carefully about the consequences of the tank being opened for a short time instead of a long time – what would the difference be in the properties (T and P) of the gas in the two tanks?).
In: Physics
Part A: Increasing Piston Displacement (L)
|
L (cm) |
Pg (atm) |
|
7.0 |
1.6 |
|
8.0 |
1.34 |
|
9.0 |
1.2 |
|
10.0 |
1.1 |
|
11.0 |
0.10 |
|
12.0 |
0.9 |
|
13.0 |
0.8 |
|
14.0 |
0.72 |
|
15.0 |
0.69 |
|
16.0 |
0.6 |
|
17.0 |
0.59 |
|
18.0 |
0.52 |
|
19.0 |
0.5 |
|
20.0 |
0.49 |
|
21.0 |
0.45 |
|
22.0 |
0.35 |
|
23.0 |
0.3 |
|
24.0 25.0 |
0.3 0.29 |
1. Calculate the product of the pressure P and length L for every
row in both data tables.
2. Calculate the deviation for each value of PL.
Part B: Decreasing Piston Displacement (L)
|
L (cm) |
Pg (atm) |
|
25.0 |
0.29 |
|
24.0 |
0.3 |
|
23.0 |
0.3 |
|
22.0 |
0.32 |
|
21.0 |
0.45 |
|
20.0 |
0.49 |
|
19.0 |
0.5 |
|
18.0 |
0.51 |
|
17.0 |
0.58 |
|
16.0 |
0.61 |
|
15.0 |
0.67 |
|
14.0 |
0.71 |
|
13.0 |
0.79 |
|
12.0 |
0.85 |
|
11.0 |
0.95 |
|
10.0 |
1.05 |
|
9.0 |
1.2 |
|
8.0 |
1.35 |
|
7.0 |
1.6 |
In: Physics
1/ Determine the amount of heaat required to raise the temperature of 2500 grams of water form 35C degree to 57C degree. The specific heat of water is 4.18J/g*C.
2/A system releases 350. kilojoules of heat while 750. kilojoules of work are done on it. Determine the change in internal energy (△ E) of the system
3/ Afixed mass of gas is placed in a cylinder fitted with a movable piston. 2000.joules of heat are added to the gas, causing it to expand. The expanding gas caused the piston to rise, thus increasing the volume of the cylinder 4,5 liters. If the constant downward pressure of the piston on the gas was 3.5 atmospheres.Calculate the (△ E) of the gas.
4/ How many joules of heat are released to the surroundings when145.0 grams of aluminum react with an excess amount of iron(III) oxide according to the following reaction?
2AL + Fe2O3 ------> AL2O3 + 2Fe △Hrxn= -849KJ
5/ use the following reactions 1,2 and 3 to determine the enthalpy of reaction for:
N2O(g) + NO2(g) -----> 3NO(g) △Hrxn= ?
I/ N2(g) + O2 (g) ------> 2NO(g) △Hrxn=+180.7KJ
II/ 2NO(g) + O2(g) ------> 2NO2(g) △Hrxn=-113.1KJ
III/ 2N2O(g) ------> 2N2(g) + O2(g) △Hrxn=-163.2KJ
6/ A 75 gram piece of copper at 100C degree is placed in an insulated container that contains 225 grams of water at 35C degree. Determine the equilibrium temperature reached in the copper water system. The specific heat of copper is 0.385J/g*C and the specific heat of water is 4.18J/g*C. You may assume that there is no exchange of heat between the system and surroundings.
In: Chemistry
Create a ShoppingCart class in java that simulates the operation of a shopping cart. The ShoppingCart instance should contain a BagInterface implementation that will serve to hold the Items that will be added to the cart. Use the implementation of the Item object provided in Item.java. Note that the price is stored as the number of cents so it can be represented as an int (e.g., an Item worth $19.99 would have price = 1999).
Using the CLASSES BELOW Your shopping cart should support the following operations:
Add an item
Add multiple quantities of a given item (e.g., add 3 of Item __)
Remove an unspecified item
Remove a specified item
Checkout – should "scan" each Item in the shopping cart (and display its ***IMPORTANT
information), sum up the total cost and display the total cost
Check budget – Given a budget amount, check to see if the budget is large ***IMPORTANT
enough to pay for everything in the cart. If not, remove an Item from the shopping cart, one at a time, until under budget.
Write a driver program to test out your ShoppingCart implementation.
*Item Class*
/**
* Item.java - implementation of an Item to be placed in ShoppingCart
*/
public class Item
{
private String name;
private int price;
private int id;//in cents
//Constructor
public Item(int i, int p, String n)
{
name = n;
price = p;
id = i;
}
public boolean equals(Item other)
{
return this.name.equals(other.name) && this.price == other.price;
}
//displays name of item and price in properly formatted manner
public String toString()
{
return name + ", price: $" + price/100 + "." + price%100;
}
//Getter methods
public int getPrice()
{
return price;
}
public String getName()
{
return name;
}
}
BAG INTERFACE CLASS
/**
* BagInterface.java - ADT Bag Type
* Describes the operations of a bag of objects
*/
public interface BagInterface<T>
{
//getCurrentSize() - gets the current number of entries in this bag
// @returns the integer number of entries currently in the bag
public int getCurrentSize();
//isEmpty() - sees whether the bag is empty
// @returns TRUE if the bag is empty, FALSE if not
public boolean isEmpty();
//add() - Adds a new entry to this bag
// @param newEntry - the object to be added to the bag
// @returns TRUE if addition was successful, or FALSE if it fails
public boolean add(T newEntry);
//remove() - removes one unspecified entry from the bag, if possible
// @returns either the removed entry (if successful), or NULL if not
public T remove();
//remove(T anEntry) - removes one occurrence of a given entry from this bag, if possible
// @param anEntry - the entry to be removed
// @returns TRUE if removal was successful, FALSE otherwise
public boolean remove(T anEntry);
//clear() - removes all entries from the bag
public void clear();
//contains() - test whether this bag contains a given entry
// @param anEntry - the entry to find
// @returns TRUE if the bag contains anEntry, or FALSE otherwise
public boolean contains(T anEntry);
//getFrequencyOf() - count the number of times a given entry appears in the bag
// @param anEntry - the entry to count
// @returns the number of time anEntry appears in the bag
public int getFrequencyOf(T anEntry);
//toArray() - retrieve all entries that are in the bag
// @returns a newly allocated array of all the entries in the bag
// NOTE: if bag is empty, it will return an empty array
public T[] toArray();
}
In: Computer Science