For this exercise, you will receive two string inputs, which are the names of the text files. You need to check if the input file exists. If input file doesn't exist, print out "Input file does not exist."
You are required to create 4 functions:
void removeSpace (ifstream &inStream, ofstream &outStream): removes white space from a text file and write to a new file. If write is successful, print out "Text with no white space is successfully written to outFileName."
int countChar (ifstream &inStream): returns number of character in input file.
int countWord(ifstream &inStream): returns number of words in input file.
int countLines(ifstream &inStream): returns number of lines in input file.
After calling each function, you have to reset the state flags and move the stream pointer to beginning of file. You can do that by closing and re-opening the file, or by calling member functions:
inStream.clear(); inStream.seekg(0);
Example:
Input: input.txt output.txt
Output:
Text with no white space is successfully written to output.txt.
Number of characters is: 154
Number of words is: 36
Number of lines is: 10
In: Computer Science
Toss 5 coins 25 times and note on each throw the number of heads. Make a probability distribution of the number of heads. Find mean and variance of that distribution and compare it with the mean and variance of theoretical probability distribution using binomial probability distribution.
In: Statistics and Probability
In: Statistics and Probability
Suppose the returns on long-term government bonds are normally distributed. Assume long-term government bonds have a mean return of 5.1 percent and a standard deviation of 8.6 percent.
|
What is the approximate probability that your return on these bonds will be less than −3.5 percent in a given year? (Do not include the percent sign (%). Round your answer to 2 decimal places (e.g., 32.16).) |
| Probability | % |
| Requirement 2: | |
|
What range of returns would you expect to see 68 percent of the time? (Do not include the percent signs (%). Negative amount should be indicated by a minus sign. Input your answers from lowest to highest to receive credit for your answers. Round your answers to 2 decimal places (e.g., 32.16).) |
| Expected range of returns | % | to | % |
| Requirement 3: | |
|
What range would you expect to see 95 percent of the time? (Do not include the percent signs (%). Negative amount should be indicated by a minus sign. Input your answers from lowest to highest to receive credit for your answers. Round your answers to 2 decimal places (e.g., 32.16).) |
In: Finance
In a dice game, Alice wins 5 (tokens) if she guesses the roll in advance; otherwise she loses 1. The dice shows six equally likely values as usual. Verify that Alice's expected win G1 is 0.
In a second experiment, Bob has two different dice in his sleeve, of which he selects one with equal probability and rolls them. One shows only even numbers, the other only odd numbers. The expected profit G2 is still 0.
In the third case, Alice learns from an oracle which dice Bob will use, before she makes her choice. She adjusts her strategy and uses the additional information. How high will her expected profit G3 be?
In: Statistics and Probability
In the New York State "Win 4" game, four digits are randomly drawn, with replacement. The player chooses four digits and may pick from several types of bets:
a. "Straight": To win, the player's digits must match those drawn in the order they were drawn.
b. There are four kinds of "box" bets. In each, the player wins by matching the digits drawn in any order. "24-Way Box": The player's digits are all different. "12-Way Box": The player names one digit twice. "6-Way Box": The player names two different digits twice each. "4-Way Box": The player names one digit three times and a different digit once.
Find the probability of winning each of these bets.
In: Statistics and Probability
Section A – Hotel Business in Hong Kong Question A1 Answer the below short questions (a) to (i) according to A Statistical Review of Hong Kong Tourism 2018, published by Hong Kong Tourism Board in June 2019.
a) What is the total number of visitor arrival to Hong Kong upon 2018? How many visitors stayed overnight?
b) Identify Hong Kong’s top THREE source markets of visitors’ arrival to Hong Kong in 2018.
c) Which month contained the highest visitor arrivals number in 2018?
d) Briefly describe the hotel performance in 2018.
e) Which hotel category noted a highest gain percentage in room occupancy compare with 2017?
f) State TWO districts which recorded the highest room occupancy rate in Hong Kong.
g) In 2017, which department in the hotel earn the second highest revenue and what is the total percentage.
h) Refer to the hotel room occupancy rate and average achieved hotel room rate in 2018, illustrate TWO indicators or messages reflected from those figures.
i) The percentage distribution of visitor arrivals by months 2018 were quite steady along the year, the range of percentage starting from 7.2% to 10.1%. If you were the manager of a hotel, try to briefly explain the reasons behind of the distributions. (For example: What is/are the factor(s) may affect the percentage of arrival on Dec 2018.)
In: Operations Management
Consider a system consisting of a cylinder with a movable piston containing 106 gas molecules at 298 K at a volume of 1 L. Consider the following descriptions of this system:
A. Initial system as described above.
B. Starting from the initial system, the volume of the container is changed to 2 L and the temperature to 395 K.
C. Starting from the initial system, a combination reaction occurs at constant volume and temperature.
D. Starting from the initial system, the gas reacts completely to produce 107 gas molecules at 395 K in a volume of 2 L.
Arrange the descriptions in order of increasing number of microstates in the resulting system. Explain the rationale for your ranking.
Is this ranking the same order as if you ranked the systems according to increasing entropy?
In: Chemistry
A piston-cylinder arrangement containing steam at 200 kPa and 200°C is cooled at a constant volume of 0.5 m3 until it reaches 140 kPa.
(a) Calculate the amount of mass of steam in the cylinder (kg)
(b) Find the quality (x) of the steam once it reaches 140 kPa
Then the piston is allowed to float freely (maintaining a constant pressure, but changing volume), while 50% of the steam is released from the piston. Once the release is done, you determine that the remaining steam is 80% vapor by mass.
(c) Find the final TOTAL volume of steam in the cylinder (m3)
(d) Assuming RH2O is 0.4615 kJ/kg-K, Determine the TOTAL volume of the steam assuming it was an ideal gas (m3)
(e) Calculate the percent error in the specific volume calculated using the ideal gas law (from part (d)) compared the actual specific volume found from the steam tables (part (c)).
Assuming there are 3.28 ft per meter, (f) Calculate the final volume from part (c) in cubic feet. (ft3)
I have that answer I just can't figure out how to get them. Please help and if you can show all work that be great. The answer are:
a)0.463kg
b)x=0.8737
c)0.229m^3
d)0.2917m^3
e)27.4%
f)8.08ft^3
I
In: Chemistry
1) What is a business plan and how is it used?
2) Which three of the ten guidelines for preparing a business plan (see your eText) do you think are the most important for the entrepreneur to consider?
3) Outline some of the critical points to capture in an elevator pitch. Explain why each point is important.
In: Operations Management