Write a C++ program that reads daily weather observation data from a file and writes monthly and annual summaries of the daily data to a file.
a. The daily weather data will be contained in a file named wx_data.txt, with each line of the file representing the weather data for a single day.
b. For each day, the date, precipitation amount, maximum temperature, and minimum temperature will be provided as tab-separated data with the following format: 20180101 0.02 37 23 20180102 0.00 42 18 <...data for the remainder of the year here...>
c. For the first entry in the daily data above, the date is 20180101 (1 January 2018), the precipitation amount is 0.02 inches, the maximum temperature is 37°F, and the minimum temperature is 23°F.
d. You may assume that the weather data is complete (i.e., there is data for each day of every month of the year) and that the data contains no errors.
2. The program must read from file each daily weather observation and write a summary by month and year to a file named wx_summary.txt.
a. The output that is written to file must have the following format:
-------------------
January
-------------------
Precipitation
Total: 3.12
Average: 0.10
Temperature
Maximum: 62
Minimum: 39
-------------------
February
-------------------
Precipitation
Total: 10.18
Average: 0.36
Temperature
Maximum: 78
Minimum: 64
-------------------
March
-------------------
Precipitation
Total: 2.02
Average: 0.07
Temperature
Maximum: 73
Minimum: 53
-------------------
April
-------------------
Precipitation
Total: 3.99
Average: 0.13
Temperature
Maximum: 77
Minimum: 58
-------------------
May
-------------------
Precipitation
Total: 3.73
Average: 0.12
Temperature
Maximum: 87
Minimum: 77
-------------------
June
-------------------
Precipitation
Total: 8.47
Average: 0.28
Temperature
Maximum: 92
Minimum: 75
-------------------
July
-------------------
Precipitation
Total: 6.79
Average: 0.22
Temperature
Maximum: 89
Minimum: 74
-------------------
August
-------------------
Precipitation
Total: 7.54
Average: 0.24
Temperature
Maximum: 82
Minimum: 74
-------------------
September
-------------------
Precipitation
Total: 18.25
Average: 0.61
Temperature
Maximum: 89
Minimum: 74
-------------------
October
-------------------
Precipitation
Total: 3.75
Average: 0.12
Temperature
Maximum: 82
Minimum: 72
-------------------
November
-------------------
Precipitation
Total: 5.62
Average: 0.19
Temperature
Maximum: 77
Minimum: 63
-------------------
December
-------------------
Precipitation
Total: 16.55
Average: 0.53
Temperature
Maximum: 72
Minimum: 67
-------------------
Max temp for year: 98 in May
Min temp for year: 21 in January
Max precip for year: 18.25 in September
In: Computer Science
A refrigeration system is working on vapour compression cycle using R134a as refrigerant. The objective is to keep the refrigerated space at temperature of 243K. The vapours enter the compressor at 0.6 bar and at 239K and after compression leaves at 12 bar and 338K. The condenser is water cooled, in which water is supplied at 291 K at mass flow rate of 15 Kg/hr. and leaves at 299K. The refrigerant leaves the condenser temperature of 315K after rejecting heat. The compressor is not perfectly insulated and it absorbs 450 J/sec of heat from the surrounding. Analyze the refrigerator by determining
Dryness fraction of refrigerant (x) at inlet of evaporator inlet, Refrigeration load in tones of refrigeration, COP of the refrigerator
Draw TS diagram of the process and label all operating temperature and pressure
In: Mechanical Engineering
Explain how to use a Scanner object to read
information from a page on the internet. Give an example.
Explain what a wrapper classes are and how they are used in
Java. Give an example.
What is an ArrayList object? How does is it
similar to and how does it differ from a traditional
array.
What is inheritance? How is it useful in software projects. How
is the is-a test related to inheritance?
What is an exception? Explain how to use try/catch blocks to
prevent a program from crashing.
What is refactoring? What are some of the ways that Eclipse can
help you with refactoring?
What is the output? Explain how you obtain this answer by hand, not using a computer.
String alphabet = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
for(int i = 1; i <= 26; i *= 2) {
System.out.print(alphabet.charAt(i - 1));
}
What is the output? Explain how you obtain this answer by hand, not using a computer.
int n = 500;
int count = 0;
while (n > 1) {
if (n % 2 == 0) {
n /= 3;
}
else {
n /= 2;
}
count++;
}
System.out.println(count);
A Java Swing application contains this paintComponent method for a panel. Sketch what is drawn by this method.
public void paintComponent(Graphics g) {
super.paintComponent(g);
g.setColor(Color.black);
g.fillRect(100, 100, 200, 100);
g.fillRect(300, 200, 200, 100);
g.fillRect(500, 100, 200, 100);
}
In: Computer Science
An aqueous solution of magnesium oxalate is prepared by
dissolving 4.46 g of magnesium oxalate in 1.51×102 g of
water. The density of the solution is 1.01 g mL-1.
a) Determine the mass percent of magnesium oxalate in the
solution.
b) Determine the mole fraction of magnesium oxalate in the
solution.
An aqueous solution of nickel(II) chloride is prepared by
dissolving 5.61 g of nickel(II) chloride in 4.53×102 g
of water. The density of the solution is 1.34 g
mL-1.
Determine the molarity (in mol/L) of nickel(II) chloride in the
solution.
In: Chemistry
Freight Terms
Determine the amount to be paid in full settlement of each of two invoices, (a) and (b), assuming that credit for returns and allowances was received prior to payment and that all invoices were paid within the discount period. If required, round the answers to the nearest dollar.
| Merchandise | Freight Paid by Seller |
Freight Terms | Returns and Allowances |
|||||
| a. | $8,200 | $300 | FOB destination, 1/10, n/30 | $1,600 | ||||
| b. | 3,400 | 600 | FOB shipping point, 2/10, n/30 | 900 | ||||
| a. | $fill in the blank 1 |
| b. | $fill in the blank 2 |
In: Accounting
a)At a distance of 0.216cm from the center of a charged conducting sphere with radius 0.100cm, the electric field is 440N/C . What is the electric field 0.604cm from the center of the sphere?
b)At a distance of 0.216cm from the axis of a very long charged conducting cylinder with radius 0.100cm, the electric field is 440N/C . What is the electric field 0.608cm from the axis of the cylinder?
c)At a distance of 0.180cm from a large uniform sheet of charge, the electric field is 440N/C . What is the electric field 1.23cm from the sheet?
In: Physics
With reference to Sweezy’s model of the kinked demand curve, explain the reasons why we might expect price to be unresponsive to small variations in cost in the case of oligopoly. What are the main limitations of the kinked demand curve model?
b. Quote real world examples of oligopolistic firms that have benefited from a first-mover advantage.
In: Economics
Companies are expected to act ethically and ensure their employees are also acting ethically. However, as we know the level of ethics expected and those practiced are not always the same. Take a moment to share your thoughts on the following questions about ethics.
In: Economics
A convergent-divergent nozzle operates under out-of-design
conditions, resulting in
formation of a normal shock wave in the diverging section. A large
reservoir
supplies air to the nozzle at 400 kPa and 800 K. The throat of the
nozzle is 0.2 m2. The number
Mach upstream of the shock wave is M1 = 2.44. The nozzle area at
the exit is
0.7 m2. Calculate the area of the nozzle at the location of the
shock wave and the temperature of the
air when leaving the nozzle
In: Mechanical Engineering
JAVA
Personal Information Class
Design a class that hold the personal data: name, address, age and phone number. Write appropriate methods (constructor, getters ad setters. Demonstrate the class by writing a program that creates three instances of the class. You can populate information in each object using Scanner class.
In: Computer Science
Sauer Food Company has decided to buy a new computer system with
an expected life of three years. The cost is $430,000. The company
can borrow $430,000 for three years at 13 percent annual interest
or for one year at 11 percent annual interest. Assume interest is
paid in full at the end of each year.
a. How much would Sauer Food Company save in
interest over the three-year life of the computer system if the
one-year loan is utilized and the loan is rolled over (reborrowed)
each year at the same 11 percent rate? Compare this to the 13
percent three-year loan.
b. What if interest rates on the 11 percent loan
go up to 16 percent in year 2 and 19 percent in year 3? What would
be the total interest cost compared to the 13 percent, three-year
loan?
In: Finance
I am a physics undergrad and thinking of exploring quantum information theory. I had a look at some books in my college library. What area in QIT, is the most mathematically challenging and rigorous? From what I saw in the books, most topics was just simple linear algebra. I am looking for an area which is mathematically more rich, and uses maybe more concepts from theoretical computer science, number theory, discrete maths, algebra etc. Classical cryptography is an area on the interface of maths and TCS which uses many areas of maths such as number theory, algebra, ellptical curves. Is the quantum cryptography also rich in mathematics? What are the prerequisites? If not, please could you suggest some areas that I are mathematically rich in QIT?
In: Physics
java - Write a method that sums all the numbers in the major diagonal in an n x n matrix of double values using the following header:
public static double sumMajorDiagonal(double [][]
m)
Write a test program that first prompts the user to enter the
dimension n of an n x n matrix, then asks them to enter the matrix
row by row (with the elements separated by spaces). The program
should then print out the sum of the major diagonal of the
matrix.
SAMPLE RUN:
Enter dimension n of nxn matrix:Enter row·0:Enter row 1:Enter·row 2:Enter row 3:17.1
(can have 3 or 4 rows)
In: Computer Science
Present Values
Use Present Value Tables or your calculator to complete the requirements below.
You have an opportunity to purchase a government security that will pay $217,000 in 5 years.
Required:
Round your answers to the nearest cent, if rounding is required.
1. Calculate what you would pay for the
security if the appropriate interest (discount) rate is 6%
compounded annually.
$
2. Calculate what you would pay for the
security if the appropriate interest (discount) rate is 10%
compounded annually.
$
3. Calculate what you would pay for the
security if the appropriate interest (discount) rate is 6%
compounded semiannually.
$
In: Accounting