Questions
Write a C++ program that reads daily weather observation data from a file and writes monthly...

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

Explain how to use a Scanner object to read information from a page on the internet....

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

JAVA Personal Information Class Design a class that hold the personal data: name, address, age and...

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

java - Write a method that sums all the numbers in the major diagonal in an...

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

What is the working-set modeling?

What is the working-set modeling?

In: Computer Science

Distinguish between tangible and intangible benefits.

Distinguish between tangible and intangible benefits.

In: Computer Science

Problem 3: The IsSorted class [30’] Description: This Java program will create an integer array object...

Problem 3: The IsSorted class [30’]

Description:

This Java program will create an integer array object with arbitrary elements, and judge whether this array is sorted (non-decreasing). For example, array1 {2,3,1,0} is not sorted, while array2 {5, 8,10,12,15} is sorted.

You may assume the array is non-empty.

Specifications:

In addition to the main method, you need to create another method

  • isSorted()

main Method

  1. The main method will create an array of integers, and initialize its elements with arbitrary values.
  2. The main method will then call the isSorted() method by passing this array. The isSorted() method will judge whether the array is sorted or not and return true or false.
  3. Based upon the results of the isSorted() method, the main method will print out a corresponding message.

isSorted Method

The isSorted() method takes in an array of integers as a parameter. It checks whether all elements in this array are sorted (arranged in non- decreasing order) or not, and return true or false.

Output

Your output should look something like follows:

//Suppose the array is [5, 0, 2, 3, 8]

$java IsSorted

The array is not sorted.

//Suppose the array is [1, 1]

$java IsSorted

The array is sorted.

//Suppose the array is [2, 6, 10, 15, 20]

$java IsSorted

The array is sorted.

//Suppose the array is [7, 4, 3, 0]

$java IsSorted

The array is not sorted.

In: Computer Science

In your opinion, why is it difficult to integrate IT and medicine? In your opinion, should...

In your opinion, why is it difficult to integrate IT and medicine?

In your opinion, should all HIMS implement a "integrated management" approach? (Why or Why Not?) **Tip: First, I would define what an HIMS is, Second define what an "integrated management" system is, Third: I would explain why OR why not I believed integrated management is needed in health care information systems.

In: Computer Science

In C++ and their need to be 3 files please Instructions In this lab, you will...

In C++ and their need to be 3 files please

Instructions

In this lab, you will modify the Student class you created in a previous lab. You will modify one new data member which will be a static integer data member. Call that data member count. You also add a static method to the Student class that will display the value of count with a message indicating what the value represents, meaning I do not want to just see a value printed to the screen.

Change main so that it calls this new method towards the end of the program. Call the method using the static syntax; do not use one of the instances of the Student class.

You will also need to change the Student constructor so that it increments the new data member you added, count. In your post explain why you get the value it displays.

Download Source Lab 7 Files:

File 1.) Source.cpp

#include

#include "Student.h"

using namespace std;

int main()

{

Student rich(2);

rich.DisplayStudent();

Student mary(3);

mary.DisplayStudent();

return 0;

}

File 2.) Student.cpp

#include "Student.h"

Student::Student(int numGrades)

{

quanity = numGrades;

grades = new int[numGrades];

name = "rich";

grades[0] = 88;

grades[1] = 96;

}

Student::~Student()

{

delete[] grades;

}

void Student::DisplayStudent()

{

cout << "Grades for " << name << endl;

for (int index = 0; index < quanity; index++)

{

cout << *(grades + index) << endl;

}

}

File 3.) Student.h #pragma once

#include

#include

using namespace std;

class Student

{

public: Student(int numGrades);

~Student();

void DisplayStudent();

private: string name;

int* grades;

int quanity;

};

In: Computer Science

Java This is background information First, code this project. Write a program that determines the change...

Java

This is background information First, code this project. Write a program that determines the change to be dispensed from a vending machine. An item in the machine can cost between 25 cents and a dollar, in 5-cent increments (25, 30, 35, ..., 90, 95, or 100) and the machine only accepts a single dollar bill to pay for the item. For example, a possible dialogue with the user might beEnter price of item(from 25 cents to a dollar, in 5-cent increments): 45You bought an item for 45 cents and gave me a dollar,so your change is 2 quarters,0 dimes, and 1 nickel.

You can write this program based on the program or with if statements. After getting it to work, include input checking. Display the change only if a valid price is entered (no less than 25 cents, no more than 100 cents, and an integer multiple of 5 cents). Otherwise, display separate error messages for any of the following invalid inputs: a cost under 25 cents, a cost that is not an integer multiple of 5, and a cost that is more than a dollar.

Write comments

In: Computer Science

**Python** 4. Running total of product and sum of integers input by a user Write a...

**Python**

4. Running total of product and sum of integers input by a user

Write a function ProdSum that asks a user to input a number from one to 99. If the input number is less than or equal to 25, then calculate the running product of each number inputted by the user that is less that or equal to 25. If the number is greater than 25, then calculate the running sum of each number inputted by the user that is greater that 25. If the user enters zero as input, then print out the total running product calculated and the total running sum calculated and end the function.

Assume the user can input as many numbers as desired until inputting a zero. Make sure you test the number inputted by the user to ensure it is in the range from zero to 99 and inform the user if the number is not in the range and to try again. Also print the appropriate labels for the two calculations in your print statements, as well as the number inputted by the user..

For Example:

Enter a number from 1 to 99 or 0 to Exit: 5

Enter a number from 1 to 99 or 0 to Exit: 83

Enter a number from 1 to 99 or 0 to Exit: 21

Enter a number from 1 to 99 or 0 to Exit: 55

Enter a number from 1 to 99 or 0 to Exit: 13

Enter a number from 1 to 99 or 0 to Exit: 64

Enter a number from 1 to 99 or 0 to Exit: 0

The product of the numbers [5, 21, 14] is 1470

The sum of the numbers [83, 55, 63] is 201

In: Computer Science

Please, Describe What is the interface ID in an IPv6 address - Give an example What...

Please, Describe

    1. What is the interface ID in an IPv6 address - Give an example
    1. What is the EUI-64 in an IPv6 address - Give an example
    2. Subnetting
    3. Give an example of the prefix of a network that does not need to subnet (do not copy the one in the book, prepare one yourself)
    4. Give an example of the prefix of a larger network with several locations (do not copy the one in the book, prepare one yourself)

In: Computer Science

Given below an example of memory configuration after a number of placement and swapping-out operations. Show...

  1. Given below an example of memory configuration after a number of placement and swapping-out operations. Show the location of new allocation using first-fit, next-fit and worst-fit placement algorithms in satisfying the following allocation requests:
    1. 10M.
    2. 15M.

Allocated block

Free block

4M

12M

16M

8M

   14M

20M

Last allocated block (4M)

In: Computer Science

Java Coding Program. In this assignment, you will write a program that analyzes Phoenix area 2018...

Java Coding Program.

In this assignment, you will write a program that analyzes Phoenix area 2018 rainfall data. Inside the main() method, first you will get the rainfall data for each of the 12 months in 2018 from the user and stores them in a double array. Next, you will need to design the following four value-returning methods that compute and return to main() the totalRainfall, averageRainfall, driestMonth, and wettestMonth. The last two methods return the index (or number) of the month with the lowest and highest rainfall amounts, not the amount of rain that fell those months. Notice that this month index (or number) can be used to obtain the amount of rain that fell those months.

I need help with driestMonth and wettestMonth. Wettest month is not giving me the correct output.

This is how it should read when it prints out on screen. Example : "The least rain fell in May with 0.35 inches."

This is what I have so far.

----------------------------------------------------------------------------

import java.util.Scanner;
import java.text.DecimalFormat;

public class Assignment12
{
public static void main(String[] args)
{
// variables
final int numMonths = 12;
double[] rainArray = new double[numMonths];
String[] month = {"Januray", "February", "March", "April", "May",
"June", "July", "August", "September",
"October", "November", "December"};
  
Scanner scan = new Scanner(System.in);
DecimalFormat fmt = new DecimalFormat("0.00");
  

// get user input for rainfall each month
for(int i=0; i < numMonths; i++)
{
System.out.print("\nEnter " + month[i] + " rainfall amount: ");
rainArray[i] = scan.nextDouble();
}
  
System.out.print("\n==== 2018 Rain Report for Phoenix, AZ ====");
System.out.print("\nTotal rainfal: " + fmt.format(getTotal(rainArray)));
System.out.print("\nAverage monthly rainfall: " + fmt.format(getAverage(rainArray)));
System.out.print("\nThe least rain feel in " + getWettestMonth(rainArray));
System.out.print("\nThe most rain fell in ");
}
  
public static double getTotal(double[] rainArray)
{
double total = 0;
final int numMonths = 12;
for(int i=0; i < numMonths; i++)
{
total = total + rainArray[i];
}
return total;
}
  
public static double getAverage(double[] rainArray)
{
double total = 0;
double average = 0;
final int numMonths = 12;
for(int i=0; i < numMonths; i++)
{
total = total + rainArray[i];
}
average = total / numMonths;
return average;
}
  
public static int getWettestMonth(double[] rainArray)
{
int mostRainIndex = 0;
final int numMonths = 12;
for(int i=0; i < numMonths; i++)
{
if(rainArray[i] > rainArray[mostRainIndex])
{
mostRainIndex = i;
}
}
return mostRainIndex;
}

public static int getDriestMonth(double[] rainArray)
{
//code
}
}

In: Computer Science

For this assignment, we will learn to use Python's built in set type. It's a great...

For this assignment, we will learn to use Python's built in set type. It's a great collection class that allows you to get intersections, unions, differences, etc between different sets of values or objects.

1. Create a function named common_letters(strings) that returns the intersection of letters among a list of strings. The parameter is a list of strings.

For example, you can find the common letter in the domains/words statistics, computer science, and biology. You might easily see it, but you need to write Python code to compute the answer. In order to pass the tests you must use the set api.

In: Computer Science