DO NOT use System.exit().
DO NOT add the project or package statements.
DO NOT change the class name.
DO NOT change the headers of ANY of the given methods.
DO NOT add any new class fields.
ONLY display the result as specified by the example for each problem.
DO NOT print other messages, follow the examples for each problem.
USE StdIn, StdOut, and StdRandom libraries.
No SCANNER PLEASE!
/*
*
* @author
*
* To generate weather for location at longitude -98.76 and latitude 26.70 for
* the month of February do:
* java WeatherGenerator -98.76 26.70 3
*/
public class WeatherGenerator {
static final int WET = 1; // Use this value to represent a wet day
static final int DRY = 2; // Use this value to represent a dry day
// Number of days in each month, January is index 0, February is index 1...
static final int[] numberOfDaysInMonth = {31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31};
/*
* Description:
* this method works under the assumption that under the same directory as
WeatherGenerator.java,
* there exist drywet.txt and wetwet.txt that contains probabilities of the next day being wet
* with today being a dry/wet day.
* Parameters:
* drywet & wetwet:
* 2 empty 2D arrays that will be populated, with each row in the format of:
* {Longitude, Latitude, January, February, March, April, May, June, July, August, September,
October, November, December}
* {-97.58, 26.02, 0.76, 0.75, 0.77, 0.74, 0.80, 0.86, 0.94, 0.97, 0.89, 0.77, 0.74, 0.77}
* you can assume that there more than enough data in the txt file,
* when there are more data in the txt files than what drywet & wetwet can store, store it up to the
array size
* Return:
* this method does not return data, the method is used to populate two 2D arrays with 14
* columns - drywet and wetwet.
* Example:
* double[][] drywet = new double[4100][14];
* double[][] wetwet = new double[4100][14];
* populateArrays(drywet, wetwet);
*/
public static void populateArrays(double[][] drywet, double[][] wetwet) {
StdIn.setFile("drywet.txt");
for(int i=0; i < drywet.length; i++){
for(int j=0; j<14; j++){
drywet[i][j] = StdIn.readDouble();
}
}
StdIn.setFile("wetwet.txt");
for(int i=0; i < drywet.length; i++){
for(int j=0; j<14; j++){
wetwet[i][j] = StdIn.readDouble();
}
}
}
/*
* Description:
* this method uses drywet and wetwet arrays populated by populateArrays, and longitude and
latitude
* of the target location to populate drywetProbability and wetwetProbability with the
* probability of dry/wet day is followed by a wet day each month at that location.
* In other words, extracting the probabilities of the location.
* parameters:
* drywetProbability: array of size 12 that will be populated with by the probability of dry days
* followed by a wet day each month
* wetwetProbability: array of size 12 that will be populated with by the probability of wet days
* followed by a wet day each month
* longitude:
* the longitude of the location
* latitude:
* the latitude of the location
* drywet:
* a 2D array of doubles populated b.
@author Haolin Jin To generate weather for locatio.pdfchennaiallfoodwear
/*
*
* @author: Haolin Jin
*
* To generate weather for location at longitude -98.76 and latitude 26.70 for
* the month of February do:
* java WeatherGenerator -98.76 26.70 3
*/
public class WeatherGenerator {
static final int WET = 1; // Use this value to represent a wet day
static final int DRY = 2; // Use this value to represent a dry day
// Number of days in each month, January is index 0, February is index 1...
static final int[] numberOfDaysInMonth = {31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31};
/*
* Description:
* this method works under the assumption that under the same directory as
WeatherGenerator.java,
* there exist drywet.txt and wetwet.txt that contains probabilities of the next day being wet
* with today being a dry/wet day.
* Parameters:
* drywet & wetwet:
* 2 empty 2D arrays that will be populated, with each row in the format of:
* {Longitude, Latitude, January, February, March, April, May, June, July, August, September,
October, November, December}
* {-97.58, 26.02, 0.76, 0.75, 0.77, 0.74, 0.80, 0.86, 0.94, 0.97, 0.89, 0.77, 0.74, 0.77}
* you can assume that there more than enough data in the txt file,
* when there are more data in the txt files than what drywet & wetwet can store, store it up to the
array size
* Return:
* this method does not return data, the method is used to populate two 2D arrays with 14
* columns - drywet and wetwet.
* Example:
* double[][] drywet = new double[4100][14];
* double[][] wetwet = new double[4100][14];
* populateArrays(drywet, wetwet);
*/
public static void populateArrays(double[][] drywet, double[][] wetwet) {
StdIn.setFile("drywet.txt");
for(int i=0; i < drywet.length; i++){
for(int j=0; j<14; j++){
drywet[i][j] = StdIn.readDouble();
}
}
StdIn.setFile("wetwet.txt");
for(int i=0; i < drywet.length; i++){
for(int j=0; j<14; j++){
wetwet[i][j] = StdIn.readDouble();
}
}
}
/*
* Description:
* this method uses drywet and wetwet arrays populated by populateArrays, and longitude and
latitude
* of the target location to populate drywetProbability and wetwetProbability with the
* probability of dry/wet day is followed by a wet day each month at that location.
* In other words, extracting the probabilities of the location.
* parameters:
* drywetProbability: array of size 12 that will be populated with by the probability of dry days
* followed by a wet day each month
* wetwetProbability: array of size 12 that will be populated with by the probability of wet days
* followed by a wet day each month
* longitude:
* the longitude of the location
* latitude:
* the latitude of the location
* drywet:
* a 2D array of doubles populated by the method populateArrays() using drywet.txt
* wetwet:
* a 2D array of doubles populated by the method populateArrays() using wetwet.txt
* return:
* this method does not return data. The method is used to populate two 1D arrays of length
* 12 - drywetProbability and wetwetProbability.
* The probability of January is stored at index 0, February stored at index 1...
* example.
Assignment Details There is a .h file on Moodle that provides a defi.pdfjyothimuppasani1
Assignment Details There is a .h file on Moodle that provides a definition for a
WeatherForecaster class. The functionality for that class is similar to the functionality you
implemented in Assignment 5, with a few additional functions. Instead of using an array of
structs and functions to process the array, you will create one WeatherForecaster object that
includes the array of structs as a private variable and public methods to process the data. The
struct for this assignment has an additional member called forecastDay, you will need to store all
of the data this time. struct ForecastDay{ string day; string forecastDay; int highTemp; int
lowTemp; int humidity; int avgWind; string avgWindDir; int maxWind; string maxWindDir;
double precip; }; Methods in the WeatherForecaster class void addDayToData(ForecastDay); •
Takes a ForecastDay as an argument and adds it to the private array stored in the
WeatherForecaster object. • Use the private index variable to control where ForecastDay is
added to the array. void printDaysInData(); • Show the dates in the data set where the day and
the forecast day are the same. void printForecastForDay(string); • Take a date as an argument
and shows the forecast for that date. CSCI 1310 - Assignment 6 Due Saturday, Oct 15, by 12:30
pm void printFourDayForecast(string); • Takes a date as an argument and shows the forecast
issued on that date and for the next three days. For example, for a date of 1- 26-2016, you would
show the forecast for 1-26-2016 issued on 1- 26-2016 as well as the forecast for 1-27, 1-28, and
1-29 issued on 1-26. double calculateTotalPrecipitation(); • Returns the sum of the precipitation
in the data set. void printLastDayItRained(); • Shows the date of the last measureable
precipitation. void printLastDayAboveTemperature(int); • Takes an integer as an argument and
shows the date for the last day above that temperature. If no days are above the temperature,
prints “No days above that temperature.” void printTemperatureForecastDifference(string); •
Takes a date as an argument and shows the temperature forecast for that date for the three days
leading up to the date and the day-of forecast. void printPredictedVsActualRainfall(int); • Shows
the difference between the predicted and actual rainfall total in the entire data set. • The
argument to the function is the number of forecast days away. For example, the forecast for 1-27-
2016 is one day away from 1- 26-2016. string getFirstDayInData(); • Returns the first date in the
data with a day-of forecast, i.e. day = forecastDay string getLastDayInData(); • Returns the last
date in the data with a day-of forecast, i.e. day = forecastDay Challenge functions 1. There is
another header file on Moodle called WeatherForecastChallenge.h that uses a vector to store the
future forecast days. Instead of including all data in the yearData array, you can include only
days where the day = forecast day in the array. The other forecast days are stored in the vecto.
//g++ -o simpleVector.exe simpleVector.cpp
#include
#include
#include
using namespace std;
/******************************************************
* Template class named SimpleVector
* An array that can hold any specified
* data type. Use a dynamic array.
******************************************************/
template
class SimpleVector
{
public:
//default constructor
SimpleVector();
//constructor with size of array
SimpleVector(int size);
//copy constructor
SimpleVector(const SimpleVector& object);
//setter method
void SetArray(int size);
//getter method
void ShowArray(int size);
//destructor
void FreeMemory();
//accessor method
int GetSizeOfArray();
//getter method
T GetElementAt(int index);
//Overload the [] operator. The argument is a subscript.
//This function returns a reference
//to the element in the array indexed by the subscript.
T operator [] (int subscript);
private:
//private memeber variable
T *array; //to dynamically allocate an array
T *copy;
};
//These function are going to be used in switch statement
//in order to test each case(integer, double, string).
void caseOne(int userInput, int size);
void caseTwo(int userInput, int size);
void caseThree(int userInput, int size);
int main() {
int userInput;
int size;
char keepInput;
do {
cout << \"What type of data do you want?\ \";
cout <<\"1. intger\ \";
cout <<\"2. double\ \";
cout <<\"3. strings\ \";
cin >> userInput;
cout << \"Enter the number of data \";
cin >> size;
switch(userInput) {
case 1:
{
caseOne(userInput, size);
break;
}
case 2:
{
caseTwo(userInput, size);
break;
}
case 3:
{
caseThree(userInput, size);
break;
}
default:
cout << \"invalid input\";
}
cout << \"\ Do you want to enter the data again?(Y/N)\ \";
cin >> keepInput;
} while(toupper(keepInput) == \'Y\');
return 0;
}
//This funciton is called in the switch satatement
//The purpose of this funtion is test SimpleVecor calss
//funciton for \'int\' type.
void caseOne(int userInput, int size) {
SimpleVectorintegerData(size);
integerData.SetArray(size);
integerData.ShowArray(size);
cout << \"\ Enter an index to retrieve the data\ \";
cin >> userInput;
cout << \"\ Getting an element of array by \ \";
cout << \"1. GetElementAt function : \";
cout << integerData.GetElementAt(userInput);
cout << \"\ 2. overloaded operator [] : \";
cout << integerData[userInput];
cout << \"\ \ Copying the array\";
SimpleVectornewIntegerData(integerData);
newIntegerData.ShowArray(size);
newIntegerData.FreeMemory();
}
//This funciton is called in the switch satatement
//The purpose of this funtion is test SimpleVecor calss
//funciton for \'double\' type.
void caseTwo(int userInput, int size) {
SimpleVectordoubleData(size);
doubleData.SetArray(size);
doubleData.ShowArray(size);
cout << \"\ Enter an index to retrieve the data\ \";
cin >> userInput;
cout << \"\ Getting an element of array by \ \";
cout << \"1. GetElementAt function : \";
cout << doubleData.GetElementAt(userInput);
cout << \"\ 2. overloaded operator [] : \";
cout << doubleData[.
CounterTest.java:
import static org.junit.Assert.*;
import org.junit.Test;
public class CounterTest {
// FIRST
// Write a class Counter such that the following test works
@Test
public void testZero() {
Counter cnt = new Counter(0);
assertEquals(\"initial value of (0) failed\", 0, cnt.getCount());
cnt.increase();
assertEquals(\"increased value of (0) failed\", 0, cnt.getCount());
cnt.decrease();
assertEquals(\"decreased value of (0) failed\", 0, cnt.getCount());
}
// SECOND
// Uncomment the following method,
// modify your Counter class so that this test works.
/*
@Test
public void testIncrease() {
Counter cnt = new Counter(7);
assertEquals(\"initial value of (7) failed\", 0, cnt.getCount());
cnt.increase();
assertEquals(\"increased once value of (7) failed\", 7, cnt.getCount());
cnt.increase();
assertEquals(\"twice increased once value of (7) failed\", 14,
cnt.getCount());
}
*/
// THIRD
// Uncomment the following method,
// modify your Counter class so that this test works.
/*
@Test
public void testDecrease() {
Counter cnt = new Counter(11);
cnt.decrease();
assertEquals(\"decreased value of (11) failed\", -11, cnt.getCount());
cnt.decrease();
assertEquals(\"twice decreased value of (11) failed\", -22,
cnt.getCount());
}
*/
// FOURTH
// Uncomment the following method,
// modify your Counter class so that this test works.
/*
@Test
public void testNegative() {
Counter cnt = new Counter(-1);
cnt.decrease();
assertEquals(\"decreased value of (-1) failed\", 1, cnt.getCount());
cnt.increase();
assertEquals(\"decreased/increased value of (-1) failed\", 0,
cnt.getCount());
cnt.increase();
assertEquals(\"decreased/increased/increased value of (-1) failed\", -1,
cnt.getCount());
}
*/
}
Date.java:
/**
*
* This class represents a date given the month and the day of the month. For the
* given date, this class provides a method for determining the season in the northern hemisphere
for the date.
*
* For example, the given code fragment the output to the console should be WINTER.
*
* Date jan1 = new Date(1, 1);
* String season = jan1.getSeason();
* System.out.println(season);
*
* @author parks
*
*/
public class Date
{
private static final Month year[] = {
new Month(\"January\", 1, 31),
new Month(\"February\", 2, 29),
new Month(\"March\", 3, 31),
new Month(\"April\", 4, 30),
new Month(\"May\", 5, 31),
new Month(\"June\", 6, 30),
new Month(\"July\", 7, 31),
new Month(\"August\", 8, 31),
new Month(\"September\", 9, 30),
new Month(\"October\", 10, 31),
new Month(\"November\", 11, 30),
new Month(\"December\", 12, 31),
};
private int month;
private int day;
/**
* Constructs a new Date object. The month should be a value
* from 1 -12 and the day from 1 - 31.
*
* @param theMonth the month
* @param theDay the day
*/
public Date(int theMonth, int theDay)
{
month = theMonth;
day = theDay;
}
/**
* This method returns the String representation for the month. For example:
* \"January\" for month == 1, \"February\" for month == 2, etc
*
* @return string representation of th.
@author Haolin Jin To generate weather for locatio.pdfchennaiallfoodwear
/*
*
* @author: Haolin Jin
*
* To generate weather for location at longitude -98.76 and latitude 26.70 for
* the month of February do:
* java WeatherGenerator -98.76 26.70 3
*/
public class WeatherGenerator {
static final int WET = 1; // Use this value to represent a wet day
static final int DRY = 2; // Use this value to represent a dry day
// Number of days in each month, January is index 0, February is index 1...
static final int[] numberOfDaysInMonth = {31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31};
/*
* Description:
* this method works under the assumption that under the same directory as
WeatherGenerator.java,
* there exist drywet.txt and wetwet.txt that contains probabilities of the next day being wet
* with today being a dry/wet day.
* Parameters:
* drywet & wetwet:
* 2 empty 2D arrays that will be populated, with each row in the format of:
* {Longitude, Latitude, January, February, March, April, May, June, July, August, September,
October, November, December}
* {-97.58, 26.02, 0.76, 0.75, 0.77, 0.74, 0.80, 0.86, 0.94, 0.97, 0.89, 0.77, 0.74, 0.77}
* you can assume that there more than enough data in the txt file,
* when there are more data in the txt files than what drywet & wetwet can store, store it up to the
array size
* Return:
* this method does not return data, the method is used to populate two 2D arrays with 14
* columns - drywet and wetwet.
* Example:
* double[][] drywet = new double[4100][14];
* double[][] wetwet = new double[4100][14];
* populateArrays(drywet, wetwet);
*/
public static void populateArrays(double[][] drywet, double[][] wetwet) {
StdIn.setFile("drywet.txt");
for(int i=0; i < drywet.length; i++){
for(int j=0; j<14; j++){
drywet[i][j] = StdIn.readDouble();
}
}
StdIn.setFile("wetwet.txt");
for(int i=0; i < drywet.length; i++){
for(int j=0; j<14; j++){
wetwet[i][j] = StdIn.readDouble();
}
}
}
/*
* Description:
* this method uses drywet and wetwet arrays populated by populateArrays, and longitude and
latitude
* of the target location to populate drywetProbability and wetwetProbability with the
* probability of dry/wet day is followed by a wet day each month at that location.
* In other words, extracting the probabilities of the location.
* parameters:
* drywetProbability: array of size 12 that will be populated with by the probability of dry days
* followed by a wet day each month
* wetwetProbability: array of size 12 that will be populated with by the probability of wet days
* followed by a wet day each month
* longitude:
* the longitude of the location
* latitude:
* the latitude of the location
* drywet:
* a 2D array of doubles populated by the method populateArrays() using drywet.txt
* wetwet:
* a 2D array of doubles populated by the method populateArrays() using wetwet.txt
* return:
* this method does not return data. The method is used to populate two 1D arrays of length
* 12 - drywetProbability and wetwetProbability.
* The probability of January is stored at index 0, February stored at index 1...
* example.
Assignment Details There is a .h file on Moodle that provides a defi.pdfjyothimuppasani1
Assignment Details There is a .h file on Moodle that provides a definition for a
WeatherForecaster class. The functionality for that class is similar to the functionality you
implemented in Assignment 5, with a few additional functions. Instead of using an array of
structs and functions to process the array, you will create one WeatherForecaster object that
includes the array of structs as a private variable and public methods to process the data. The
struct for this assignment has an additional member called forecastDay, you will need to store all
of the data this time. struct ForecastDay{ string day; string forecastDay; int highTemp; int
lowTemp; int humidity; int avgWind; string avgWindDir; int maxWind; string maxWindDir;
double precip; }; Methods in the WeatherForecaster class void addDayToData(ForecastDay); •
Takes a ForecastDay as an argument and adds it to the private array stored in the
WeatherForecaster object. • Use the private index variable to control where ForecastDay is
added to the array. void printDaysInData(); • Show the dates in the data set where the day and
the forecast day are the same. void printForecastForDay(string); • Take a date as an argument
and shows the forecast for that date. CSCI 1310 - Assignment 6 Due Saturday, Oct 15, by 12:30
pm void printFourDayForecast(string); • Takes a date as an argument and shows the forecast
issued on that date and for the next three days. For example, for a date of 1- 26-2016, you would
show the forecast for 1-26-2016 issued on 1- 26-2016 as well as the forecast for 1-27, 1-28, and
1-29 issued on 1-26. double calculateTotalPrecipitation(); • Returns the sum of the precipitation
in the data set. void printLastDayItRained(); • Shows the date of the last measureable
precipitation. void printLastDayAboveTemperature(int); • Takes an integer as an argument and
shows the date for the last day above that temperature. If no days are above the temperature,
prints “No days above that temperature.” void printTemperatureForecastDifference(string); •
Takes a date as an argument and shows the temperature forecast for that date for the three days
leading up to the date and the day-of forecast. void printPredictedVsActualRainfall(int); • Shows
the difference between the predicted and actual rainfall total in the entire data set. • The
argument to the function is the number of forecast days away. For example, the forecast for 1-27-
2016 is one day away from 1- 26-2016. string getFirstDayInData(); • Returns the first date in the
data with a day-of forecast, i.e. day = forecastDay string getLastDayInData(); • Returns the last
date in the data with a day-of forecast, i.e. day = forecastDay Challenge functions 1. There is
another header file on Moodle called WeatherForecastChallenge.h that uses a vector to store the
future forecast days. Instead of including all data in the yearData array, you can include only
days where the day = forecast day in the array. The other forecast days are stored in the vecto.
//g++ -o simpleVector.exe simpleVector.cpp
#include
#include
#include
using namespace std;
/******************************************************
* Template class named SimpleVector
* An array that can hold any specified
* data type. Use a dynamic array.
******************************************************/
template
class SimpleVector
{
public:
//default constructor
SimpleVector();
//constructor with size of array
SimpleVector(int size);
//copy constructor
SimpleVector(const SimpleVector& object);
//setter method
void SetArray(int size);
//getter method
void ShowArray(int size);
//destructor
void FreeMemory();
//accessor method
int GetSizeOfArray();
//getter method
T GetElementAt(int index);
//Overload the [] operator. The argument is a subscript.
//This function returns a reference
//to the element in the array indexed by the subscript.
T operator [] (int subscript);
private:
//private memeber variable
T *array; //to dynamically allocate an array
T *copy;
};
//These function are going to be used in switch statement
//in order to test each case(integer, double, string).
void caseOne(int userInput, int size);
void caseTwo(int userInput, int size);
void caseThree(int userInput, int size);
int main() {
int userInput;
int size;
char keepInput;
do {
cout << \"What type of data do you want?\ \";
cout <<\"1. intger\ \";
cout <<\"2. double\ \";
cout <<\"3. strings\ \";
cin >> userInput;
cout << \"Enter the number of data \";
cin >> size;
switch(userInput) {
case 1:
{
caseOne(userInput, size);
break;
}
case 2:
{
caseTwo(userInput, size);
break;
}
case 3:
{
caseThree(userInput, size);
break;
}
default:
cout << \"invalid input\";
}
cout << \"\ Do you want to enter the data again?(Y/N)\ \";
cin >> keepInput;
} while(toupper(keepInput) == \'Y\');
return 0;
}
//This funciton is called in the switch satatement
//The purpose of this funtion is test SimpleVecor calss
//funciton for \'int\' type.
void caseOne(int userInput, int size) {
SimpleVectorintegerData(size);
integerData.SetArray(size);
integerData.ShowArray(size);
cout << \"\ Enter an index to retrieve the data\ \";
cin >> userInput;
cout << \"\ Getting an element of array by \ \";
cout << \"1. GetElementAt function : \";
cout << integerData.GetElementAt(userInput);
cout << \"\ 2. overloaded operator [] : \";
cout << integerData[userInput];
cout << \"\ \ Copying the array\";
SimpleVectornewIntegerData(integerData);
newIntegerData.ShowArray(size);
newIntegerData.FreeMemory();
}
//This funciton is called in the switch satatement
//The purpose of this funtion is test SimpleVecor calss
//funciton for \'double\' type.
void caseTwo(int userInput, int size) {
SimpleVectordoubleData(size);
doubleData.SetArray(size);
doubleData.ShowArray(size);
cout << \"\ Enter an index to retrieve the data\ \";
cin >> userInput;
cout << \"\ Getting an element of array by \ \";
cout << \"1. GetElementAt function : \";
cout << doubleData.GetElementAt(userInput);
cout << \"\ 2. overloaded operator [] : \";
cout << doubleData[.
CounterTest.java:
import static org.junit.Assert.*;
import org.junit.Test;
public class CounterTest {
// FIRST
// Write a class Counter such that the following test works
@Test
public void testZero() {
Counter cnt = new Counter(0);
assertEquals(\"initial value of (0) failed\", 0, cnt.getCount());
cnt.increase();
assertEquals(\"increased value of (0) failed\", 0, cnt.getCount());
cnt.decrease();
assertEquals(\"decreased value of (0) failed\", 0, cnt.getCount());
}
// SECOND
// Uncomment the following method,
// modify your Counter class so that this test works.
/*
@Test
public void testIncrease() {
Counter cnt = new Counter(7);
assertEquals(\"initial value of (7) failed\", 0, cnt.getCount());
cnt.increase();
assertEquals(\"increased once value of (7) failed\", 7, cnt.getCount());
cnt.increase();
assertEquals(\"twice increased once value of (7) failed\", 14,
cnt.getCount());
}
*/
// THIRD
// Uncomment the following method,
// modify your Counter class so that this test works.
/*
@Test
public void testDecrease() {
Counter cnt = new Counter(11);
cnt.decrease();
assertEquals(\"decreased value of (11) failed\", -11, cnt.getCount());
cnt.decrease();
assertEquals(\"twice decreased value of (11) failed\", -22,
cnt.getCount());
}
*/
// FOURTH
// Uncomment the following method,
// modify your Counter class so that this test works.
/*
@Test
public void testNegative() {
Counter cnt = new Counter(-1);
cnt.decrease();
assertEquals(\"decreased value of (-1) failed\", 1, cnt.getCount());
cnt.increase();
assertEquals(\"decreased/increased value of (-1) failed\", 0,
cnt.getCount());
cnt.increase();
assertEquals(\"decreased/increased/increased value of (-1) failed\", -1,
cnt.getCount());
}
*/
}
Date.java:
/**
*
* This class represents a date given the month and the day of the month. For the
* given date, this class provides a method for determining the season in the northern hemisphere
for the date.
*
* For example, the given code fragment the output to the console should be WINTER.
*
* Date jan1 = new Date(1, 1);
* String season = jan1.getSeason();
* System.out.println(season);
*
* @author parks
*
*/
public class Date
{
private static final Month year[] = {
new Month(\"January\", 1, 31),
new Month(\"February\", 2, 29),
new Month(\"March\", 3, 31),
new Month(\"April\", 4, 30),
new Month(\"May\", 5, 31),
new Month(\"June\", 6, 30),
new Month(\"July\", 7, 31),
new Month(\"August\", 8, 31),
new Month(\"September\", 9, 30),
new Month(\"October\", 10, 31),
new Month(\"November\", 11, 30),
new Month(\"December\", 12, 31),
};
private int month;
private int day;
/**
* Constructs a new Date object. The month should be a value
* from 1 -12 and the day from 1 - 31.
*
* @param theMonth the month
* @param theDay the day
*/
public Date(int theMonth, int theDay)
{
month = theMonth;
day = theDay;
}
/**
* This method returns the String representation for the month. For example:
* \"January\" for month == 1, \"February\" for month == 2, etc
*
* @return string representation of th.
How do I fix it in LinkedList.javathis is what i didLabProgra.pdfmail931892
How do I fix it in LinkedList.java?
this is what i did
LabProgram.java
LinkedList.java:
/**
* Defines a doubly-linked list class
* @author
* @author
*/
import java.util.NoSuchElementException;
public class LinkedList {
private class Node {
private T data;
private Node next;
private Node prev;
public Node(T data) {
this.data = data;
this.next = null;
this.prev = null;
}
}
private int length;
private Node first;
private Node last;
private Node iterator;
/**** CONSTRUCTORS ****/
/**
* Instantiates a new LinkedList with default values
* @postcondition
*/
public LinkedList() {
first = null;
last = null;
iterator = null;
length = 0;
}
/**
* Converts the given array into a LinkedList
* @param array the array of values to insert into this LinkedList
* @postcondition
*/
public LinkedList(T[] array) {
}
/**
* Instantiates a new LinkedList by copying another List
* @param original the LinkedList to copy
* @postcondition a new List object, which is an identical,
* but separate, copy of the LinkedList original
*/
public LinkedList(LinkedList original) {
}
/**** ACCESSORS ****/
public T getFirst() throws NoSuchElementException {
if (isEmpty()){
throw new NoSuchElementException("The list is empty");
}
return first.data;
}
public T getLast() throws NoSuchElementException {
if (isEmpty()){
throw new NoSuchElementException("The list is empty");
}
return last.data;
}
/**
* Returns the data stored in the iterator node
* @precondition
* @return the data stored in the iterator node
* @throw NullPointerException
*/
public T getIterator() throws NullPointerException {
if (iterator != null){
return iterator.data;
}else{
throw new NullPointerException("Iterator is off the end opf the list.");
}
}
/**
* Returns the current length of the LinkedList
* @return the length of the LinkedList from 0 to n
*/
public int getLength() {
return length;
}
/**
* Returns whether the LinkedList is currently empty
* @return whether the LinkedList is empty
*/
public boolean isEmpty() {
return length == 0;
}
/**
* Returns whether the iterator is offEnd, i.e. null
* @return whether the iterator is null
*/
public boolean offEnd() {
return iterator == null;
}
/**** MUTATORS ****/
public void addFirst(T data) {
Node newNode = new Node(data);
if(isEmpty()){
first = newNode;
last = newNode;
}
else{
newNode.next = first;
first.prev = newNode;
first = newNode;
}
length++;
}
public void addLast(T data) {
Node newNode = new Node(data);
if(isEmpty()){
first = newNode;
last = newNode;
}
else{
last.next = newNode;
newNode.prev = last;
last = newNode;
}
length++;
}
/**
* Inserts a new element after the iterator
* @param data the data to insert
* @precondition
* @throws NullPointerException
*/
public void addIterator(T data) throws NullPointerException{
if(iterator != null){
Node newNode = new Node(data);
newNode.next = iterator.next;
iterator.next = newNode;
if (iterator == first){
first = newNode;
}
}else{
throw new NullPointerException("Iterator is off the end opf the list.");
}
}
/
public void remov.
Please do Part A, Ill be really gratefulThe main.c is the skeleto.pdfaioils
Please do Part A, I'll be really grateful
The main.c is the skeleton code, the content of main.c is given below:
#include
#include
/* a rtpkt is the packet sent from one router to
another*/
struct rtpkt {
int sourceid; /* id of sending router sending this pkt */
int destid; /* id of router to which pkt being sent
(must be an directly connected neighbor) */
int *mincost; /* min cost to all the node */
};
struct distance_table
{
int **costs; // the distance table of curr_node, costs[i][j] is the cost from node i to node j
};
/*****************************************************************
***************** NETWORK EMULATION CODE STARTS BELOW ***********
The code below emulates the layer 2 and below network environment:
- emulates the transmission and delivery (with no loss and no
corruption) between two physically connected nodes
- calls the initializations routine rtinit once before
beginning emulation for each node.
You should read and understand the code below. For Part A, you should fill all parts with
annotation starting with "Todo". For Part B and Part C, you need to add additional routines for
their features.
******************************************************************/
struct event {
float evtime; /* event time */
int evtype; /* event type code */
int eventity; /* entity (node) where event occurs */
struct rtpkt *rtpktptr; /* ptr to packet (if any) assoc w/ this event */
struct event *prev;
struct event *next;
};
struct event *evlist = NULL; /* the event list */
struct distance_table *dts;
int **link_costs; /*This is a 2D matrix stroing the content defined in topo file*/
int num_nodes;
/* possible events: */
/*Note in this lab, we only have one event, namely FROM_LAYER2.It refer to that the packet
will pop out from layer3, you can add more event to emulate other activity for other layers. Like
FROM_LAYER3*/
#define FROM_LAYER2 1
float clocktime = 0.000;
/********************* EVENT HANDLINE ROUTINES *******/
/* The next set of routines handle the event list */
/*****************************************************/
void rtinit(struct distance_table *dt, int node, int *link_costs, int num_nodes)
{
/* Todo: Please write the code here*/
}
void rtupdate(struct distance_table *dt, struct rtpkt recv_pkt)
{
/* Todo: Please write the code here*/
}
void main(int argc, char *argv[])
{
struct event *eventptr;
/* Todo: Please write the code here to process the input.
Given different flag, you have different number of input for part A, B, C.
Please write your own code to parse the input for each part.
Specifically, in part A you need parse the input file and get num_nodes,
and fill in the content of dts and link_costs */
dts = (struct distance_table *) malloc(num_nodes * sizeof(struct distance_table));
link_costs = (int **) malloc(num_nodes * sizeof(int *));
for (int i = 0; i < num_nodes; i++)
{
link_costs[i] = (int *)malloc(num_nodes * sizeof(int));
}
for (int i = 0; i < num_nodes; i++)
{
rtinit(&dts[i], i, link_costs[i], num_nodes);
}
whil.
JavaScript is evolving. It’s an exciting time to be involved with this ubiquitous language of the web. Every year, we get exciting new features landing as part of the language. Let’s explore the freshly released features that were part of the 2019 ECMAScript specification. We’ll also briefly explore the process of how new features get proposed and added to the language, as well as the leading contenders expected to land in ES2020.
This is Class 5 on a 6 week course I taught on Software Design Patterns.
This course discusses the Observer and Decorator patterns.
Class based on "Head First Design Patterns."
1
CMIS 102 Hands-On Lab
Week 8
Overview
This hands-on lab allows you to follow and experiment with the critical steps of developing a program
including the program description, analysis, test plan, and implementation with C code. The example
provided uses sequential, repetition, selection statements, functions, strings and arrays.
Program Description
This program will input and store meteorological data into an array. The program will prompt the user to
enter the average monthly rainfall for a specific region and then use a loop to cycle through the array
and print out each value. The program should store up 5 years of meteorological data. Data is collected
once per month. The program should provide the option to the user of not entering any data.
Analysis
I will use sequential, selection, and repetition programming statements and an array to store data.
I will define a 2-D array of Float number: Raindata[][] to store the Float values input by the user. To store
up to 5 years of monthly data, the array size should be at least 5*12 = 60 elements. In a 2D array this will
be RainData[5][12]. We can use #defines to set the number of years and months to eliminate hard-
coding values.
A float number (rain) will also be needed to input the individual rain data.
A nested for loop can be used to iterate through the array to enter Raindata. A nested for loop can also
be used to print the data in the array.
A array of strings can be used to store year and month names. This will allow a tabular display with
labels for the printout.
Functions will be used to separate functionality into smaller work units. Functions for displaying the data
and inputting the data will be used.
A selection statement will be used to determine if data should be entered.
Test Plan
To verify this program is working properly the input values could be used for testing:
Test Case Input Expected Output
1 Enter data? = y
1.2
2.2
3.3
2.2
10.2
12.2
2.3
0.4
0.2
1.1
2.1
year month rain
2011 Jan 1.20
2011 Feb 2.20
2011 Mar 3.30
2011 Apr 2.20
2011 May 10.20
2011 Jun 12.20
2011 Jul 2.30
2011 Aug 0.40
2011 Sep 0.20
2011 Oct 1.10
2011 Nov 2.10
2011 Dec 0.40
2
0.4
1.1
2.2
3.3
2.2
10.2
12.2
2.3
0.4
0.2
1.1
2.1
0.4
1.1
2.2
3.3
2.2
10.2
12.2
2.3
0.4
0.2
1.1
2.1
0.4
1.1
2.2
3.3
2.2
10.2
12.2
2.3
0.4
0.2
1.1
2.1
0.4
1.1
2.2
3.3
2.2
10.2
12.2
2.3
0.4
0.2
1.1
2.1
0.4
2012 Jan 1.10
2012 Feb 2.20
2012 Mar 3.30
2012 Apr 2.20
2012 May 10.20
2012 Jun 12.20
2012 Jul 2.30
2012 Aug 0.40
2012 Sep 0.20
2012 Oct 1.10
2012 Nov 2.10
2012 Dec 0.40
2013 Jan 1.10
2013 Feb 2.20
2013 Mar 3.30
2013 Apr 2.20
2013 May 10.20
2013 Jun 12.20
2013 Jul 2.30
2013 Aug 0.40
2013 Sep 0 ...
Here is the code- I can't get it to work- I need a function that finds.pdfdoshirajesh75
Here is the code: I can't get it to work. I need a function that finds the maximum of two integers.
#include <stdio.h>
#include <stdlib.h>
#include <limits.h>
/* declare global variables including a table structure to hold scheduling
information */
/* optional: define a function that finds the maximum of two integers */
int total_processes = 0;
struct node{
int id;
int arrival;
int total_cycles;
int total_remaining;
int done;
int start;
int already_started;
int end;
int turnaround;
}* table = NULL;
typedef struct node table_type;
/***************************************************************/
void print_table() {
/*
1.declare local variables
2. print table header
3. for each process
4. print the contents (id, arrival time, total_cycles) of
each field of the table's index
5. if process has been scheduled ("done" field is 1,
6. print other contents (start time, end time, turnaround time)
*/
printf("ID/tArrival/tTotal/tStart/tEnd/tTurnaround/n");
printf("--------------------------------------------\n");
int i;
for(i=0; i < total_processes; i++){
printf("%d\t", table[i].id);
printf("%d\t", table[i].arrival);
printf("%d\t", table[i].total_cycles);
printf("%d\t", table[i].start);
printf("%d\t", table[i].end);
printf("%d\t", table[i].turnaround);
}
return;
}
/***************************************************************/
void procedure_1() {
/*"PROCEDURE FOR OPTION #1"
/* declare local variables */
/* prompt for total number of processes */
/* allocate memory for table to hold process parameters */
/* for each process */
/* prompt for process id, arrival time, and total cycle
time */
/* print contents of table */
int i;
printf("Enter total number of processes: ");
scanf("%d", &table[i].arrival);
table = (table_type *)malloc(total_processes * sizeof(table_type));
for(i = 0; i < total_processes; i++){
int arrival = -1;
int total_cycles = -1;
printf("Enter process id: ");
scanf("%d", &table[i].id);
}
printf("Enter arrival cycle for process P[%d]: ", i);
scanf("%d", &table[i].total_cycles);
/*
table[i].id = i;
table[i].arrival = -1;
table[i].total_cycles = -1;
table[i].start = -1;
table[i].end = -1;
table[i].turnaround = -1;
*/
print_table();
return;
}
/***************************************************************/
void procedure_2() {
/* "PROCEDURE FOR OPTION #2"
/* declare (and initilize when appropriate) local variables */
/* for each process, reset "done" field to 0 */
/* while there are still processes to schedule */
/* initilize the earliest arrival time to INT_MAX
(largest integer value) */
/* for each process not yet scheduled */
/* check if process has earlier arrival time
than current earliest and update */
/* set start time, end time, turnaround time, done fields
for unscheduled process with earliest arrival time */
/* update current cycle time and increment number of
processes scheduled */
/* print contents of table */
int i;
int done;
int min_value;
int current_cycle = 0;
int max;
int min_index;
table[i].done = 0;
while(done < 1){
min.
How do I fix it in LinkedList.javaLabProgram.javaLinkedList.jav.pdfmail931892
How do I fix it in LinkedList.java?
LabProgram.java
LinkedList.java:
/**
* Defines a doubly-linked list class
* @author
* @author
*/
import java.util.NoSuchElementException;
public class LinkedList {
private class Node {
private T data;
private Node next;
private Node prev;
public Node(T data) {
this.data = data;
this.next = null;
this.prev = null;
}
}
private int length;
private Node first;
private Node last;
private Node iterator;
/**** CONSTRUCTORS ****/
/**
* Instantiates a new LinkedList with default values
* @postcondition
*/
public LinkedList() {
first = null;
last = null;
iterator = null;
length = 0;
}
/**
* Converts the given array into a LinkedList
* @param array the array of values to insert into this LinkedList
* @postcondition
*/
public LinkedList(T[] array) {
}
/**
* Instantiates a new LinkedList by copying another List
* @param original the LinkedList to copy
* @postcondition a new List object, which is an identical,
* but separate, copy of the LinkedList original
*/
public LinkedList(LinkedList original) {
}
/**** ACCESSORS ****/
public T getFirst() throws NoSuchElementException {
if (isEmpty()){
throw new NoSuchElementException("The list is empty");
}
return first.data;
}
public T getLast() throws NoSuchElementException {
if (isEmpty()){
throw new NoSuchElementException("The list is empty");
}
return last.data;
}
/**
* Returns the data stored in the iterator node
* @precondition
* @return the data stored in the iterator node
* @throw NullPointerException
*/
public T getIterator() throws NullPointerException {
if (iterator != null){
return iterator.data;
}else{
throw new NullPointerException("Iterator is off the end opf the list.");
}
}
/**
* Returns the current length of the LinkedList
* @return the length of the LinkedList from 0 to n
*/
public int getLength() {
return length;
}
/**
* Returns whether the LinkedList is currently empty
* @return whether the LinkedList is empty
*/
public boolean isEmpty() {
return length == 0;
}
/**
* Returns whether the iterator is offEnd, i.e. null
* @return whether the iterator is null
*/
public boolean offEnd() {
return iterator == null;
}
/**** MUTATORS ****/
public void addFirst(T data) {
Node newNode = new Node(data);
if(isEmpty()){
first = newNode;
last = newNode;
}
else{
newNode.next = first;
first.prev = newNode;
first = newNode;
}
length++;
}
public void addLast(T data) {
Node newNode = new Node(data);
if(isEmpty()){
first = newNode;
last = newNode;
}
else{
last.next = newNode;
newNode.prev = last;
last = newNode;
}
length++;
}
/**
* Inserts a new element after the iterator
* @param data the data to insert
* @precondition
* @throws NullPointerException
*/
public void addIterator(T data) throws NullPointerException{
if(iterator != null){
Node newNode = new Node(data);
newNode.next = iterator.next;
iterator.next = newNode;
if (iterator == first){
first = newNode;
}
}else{
throw new NullPointerException("Iterator is off the end opf the list.");
}
}
/
public void removeFirst() throws NoS.
Part 1 - Written AnswersDownload the GridWriter.zip file and exami.pdfkamdinrossihoungma74
Operating leases have historically been controversial because there was no requirement for
disclosure of the lease arrangements anywhere in the financial statements.True
Solution
Lease is defined as a contract between two parties for use of assets of one parties by paying rent
for using assets. the owner of assets is calls Lessor and the person who use assets is called
Lessee.
Theer is two type lease contract, Operating lease and financial lease. in operating lease, periodic
lease payment is reported in income statement as expense and in financig lease, assets are
reported in balance sheet.
So, given statement is false..
FOR MORE CLASSES VISIT
tutorialoutletdotcom
CMIS 102 Hands-On Lab
Week 8
Overview
This hands-on lab allows you to follow and experiment with the critical steps of developing a program
including the program description, analysis, test plan, and implementation with C code. The example
provided uses sequential, repetition, selection statements, functions, strings and arrays.
Lab Assignment 4 CSE330 Spring 2014 Skeleton Code for ex.docxMARRY7
/* Lab Assignment 4 CSE330 Spring 2014 */
/* Skeleton Code for ex0 of lab4 */
/* No code will be provided for ex1 of lab4 */
#include <stdio.h> /* for NULL */
#include <ctype.h> /* for atoi() */
#include <errno.h> /* for perror() */
#include <signal.h> /* for sigvec() etc. */
#include <sys/types.h> /* for <arpa/inet.h> */
#include <sys/socket.h> /* for PF_INET, etc. */
#include <netinet/in.h> /* for struct sockaddr_in */
#include <arpa/inet.h> /* for inet_addr() */
#include <sys/time.h>
#include "lab4.h"
/* this is in netinet/in.h; included here for reference only.
struct sockaddr_in {
short sin_family;
u_short sin_port;
struct in_addr sin_addr;
char sin_zero[8];
};
*/
/***************************************************************************/
#define LINESIZE 80
#define TYPE0TIMEOUT 3
#define TYPE1TIMEOUT 30
/* You should give a long timeout, like 30sec, otherwise */
/* duplicated responses from the server may cause some problem */
#define MAXRETRY 3
/***************************************************************************/
static char *RCSId="$Id: client2.c,v 4 2014/04/20 03:15:07 cse3300 Exp $";
/***************************************************************************/
/* some functions you may find useful if you implement them */
extern int stringToAddress(char *s, struct sockaddr_in *a);
extern int msgok(LABMSG *);
extern u_short msgchecksum(u_short *);
extern void alarmCatcher(void);
extern int tries; /* for retransmission routines */
int numtries;
/***** this will die ****/
FILE *logFile;
void die(char *s)
{
perror(s);
exit(2);
}
void startTimer(int secs)
{
alarm(secs);
}
void stopTimer(void)
{
alarm(0);
}
/* should change it by yourself if needed!!! */
void printResponse(LABMSG *mp, int ck)
{
int type;
mp->courseEtc = ntohs(mp->courseEtc);
type = ( (mp->courseEtc & MESSAGETYPE) !=0)?1:0;
printf("course=%d, Type=%d\n", mp->courseEtc&0x3fff,type);
if (ntohl(mp->cookie) != ck)
printf("Cookies don't match: sent %x received %x\n",mp->cookie,ck);
if (mp->courseEtc & REQRESP)
printf("response ");
else {
printf("request??\n");
return;
}
mp->result = ntohs(mp->result);
/*printf(" result = %x: ",mp->result);*/
if (mp->result&TRANSOUTCOME) { /* Check outcome */
printf("error: ");
switch (mp->result & 0x7fff) {
case ERROR_CHECKSUM:
printf("checksum failure\n");
break;
case ERROR_SYNTAX:
printf("syntax error\n");
break;
case ERROR_UNKSSN:
printf("unknown SSN %d\n", ntohl(mp->reqSSN) );
break;
case ERROR_SERVER:
printf("Unspecified Server Error\n");
default:
printf("Unknown Error.\n");
} /* case switch */
} else { /* successful transaction */
if(type)printf("Test succeeded.");
if (!type) /* Type 0 -- print SSN and Response */
printf(": %d -> %d\n", ntohl(mp->reqSSN), mp->result&0x7fff);
else
printf("\n"); /* XXX print number of responses */
}
}
/*-----------------------------------*/
/* added by ZXC:
this fun ...
Define the terms adulteration and misbranding How are these concept.pdfinfo48697
Define the terms adulteration and misbranding? How are these concepts different and when can
they overlap? What is economic adulteration? Provide a historical example of adulteration or
misbranding that caused harm to consumers. Do you see similar incidents of adulteration or
misbranding today?.
Define medical futility. Does the definition of futility change with.pdfinfo48697
Define medical futility. Does the definition of futility change with the age of the patient (child,
young adult, or senior)? Should patients always be given complete autonomy with regard to their
healthcare decisions? Why or why not?.
More Related Content
Similar to DO NOT use System.exit().DO NOT add the project or package stateme.pdf
How do I fix it in LinkedList.javathis is what i didLabProgra.pdfmail931892
How do I fix it in LinkedList.java?
this is what i did
LabProgram.java
LinkedList.java:
/**
* Defines a doubly-linked list class
* @author
* @author
*/
import java.util.NoSuchElementException;
public class LinkedList {
private class Node {
private T data;
private Node next;
private Node prev;
public Node(T data) {
this.data = data;
this.next = null;
this.prev = null;
}
}
private int length;
private Node first;
private Node last;
private Node iterator;
/**** CONSTRUCTORS ****/
/**
* Instantiates a new LinkedList with default values
* @postcondition
*/
public LinkedList() {
first = null;
last = null;
iterator = null;
length = 0;
}
/**
* Converts the given array into a LinkedList
* @param array the array of values to insert into this LinkedList
* @postcondition
*/
public LinkedList(T[] array) {
}
/**
* Instantiates a new LinkedList by copying another List
* @param original the LinkedList to copy
* @postcondition a new List object, which is an identical,
* but separate, copy of the LinkedList original
*/
public LinkedList(LinkedList original) {
}
/**** ACCESSORS ****/
public T getFirst() throws NoSuchElementException {
if (isEmpty()){
throw new NoSuchElementException("The list is empty");
}
return first.data;
}
public T getLast() throws NoSuchElementException {
if (isEmpty()){
throw new NoSuchElementException("The list is empty");
}
return last.data;
}
/**
* Returns the data stored in the iterator node
* @precondition
* @return the data stored in the iterator node
* @throw NullPointerException
*/
public T getIterator() throws NullPointerException {
if (iterator != null){
return iterator.data;
}else{
throw new NullPointerException("Iterator is off the end opf the list.");
}
}
/**
* Returns the current length of the LinkedList
* @return the length of the LinkedList from 0 to n
*/
public int getLength() {
return length;
}
/**
* Returns whether the LinkedList is currently empty
* @return whether the LinkedList is empty
*/
public boolean isEmpty() {
return length == 0;
}
/**
* Returns whether the iterator is offEnd, i.e. null
* @return whether the iterator is null
*/
public boolean offEnd() {
return iterator == null;
}
/**** MUTATORS ****/
public void addFirst(T data) {
Node newNode = new Node(data);
if(isEmpty()){
first = newNode;
last = newNode;
}
else{
newNode.next = first;
first.prev = newNode;
first = newNode;
}
length++;
}
public void addLast(T data) {
Node newNode = new Node(data);
if(isEmpty()){
first = newNode;
last = newNode;
}
else{
last.next = newNode;
newNode.prev = last;
last = newNode;
}
length++;
}
/**
* Inserts a new element after the iterator
* @param data the data to insert
* @precondition
* @throws NullPointerException
*/
public void addIterator(T data) throws NullPointerException{
if(iterator != null){
Node newNode = new Node(data);
newNode.next = iterator.next;
iterator.next = newNode;
if (iterator == first){
first = newNode;
}
}else{
throw new NullPointerException("Iterator is off the end opf the list.");
}
}
/
public void remov.
Please do Part A, Ill be really gratefulThe main.c is the skeleto.pdfaioils
Please do Part A, I'll be really grateful
The main.c is the skeleton code, the content of main.c is given below:
#include
#include
/* a rtpkt is the packet sent from one router to
another*/
struct rtpkt {
int sourceid; /* id of sending router sending this pkt */
int destid; /* id of router to which pkt being sent
(must be an directly connected neighbor) */
int *mincost; /* min cost to all the node */
};
struct distance_table
{
int **costs; // the distance table of curr_node, costs[i][j] is the cost from node i to node j
};
/*****************************************************************
***************** NETWORK EMULATION CODE STARTS BELOW ***********
The code below emulates the layer 2 and below network environment:
- emulates the transmission and delivery (with no loss and no
corruption) between two physically connected nodes
- calls the initializations routine rtinit once before
beginning emulation for each node.
You should read and understand the code below. For Part A, you should fill all parts with
annotation starting with "Todo". For Part B and Part C, you need to add additional routines for
their features.
******************************************************************/
struct event {
float evtime; /* event time */
int evtype; /* event type code */
int eventity; /* entity (node) where event occurs */
struct rtpkt *rtpktptr; /* ptr to packet (if any) assoc w/ this event */
struct event *prev;
struct event *next;
};
struct event *evlist = NULL; /* the event list */
struct distance_table *dts;
int **link_costs; /*This is a 2D matrix stroing the content defined in topo file*/
int num_nodes;
/* possible events: */
/*Note in this lab, we only have one event, namely FROM_LAYER2.It refer to that the packet
will pop out from layer3, you can add more event to emulate other activity for other layers. Like
FROM_LAYER3*/
#define FROM_LAYER2 1
float clocktime = 0.000;
/********************* EVENT HANDLINE ROUTINES *******/
/* The next set of routines handle the event list */
/*****************************************************/
void rtinit(struct distance_table *dt, int node, int *link_costs, int num_nodes)
{
/* Todo: Please write the code here*/
}
void rtupdate(struct distance_table *dt, struct rtpkt recv_pkt)
{
/* Todo: Please write the code here*/
}
void main(int argc, char *argv[])
{
struct event *eventptr;
/* Todo: Please write the code here to process the input.
Given different flag, you have different number of input for part A, B, C.
Please write your own code to parse the input for each part.
Specifically, in part A you need parse the input file and get num_nodes,
and fill in the content of dts and link_costs */
dts = (struct distance_table *) malloc(num_nodes * sizeof(struct distance_table));
link_costs = (int **) malloc(num_nodes * sizeof(int *));
for (int i = 0; i < num_nodes; i++)
{
link_costs[i] = (int *)malloc(num_nodes * sizeof(int));
}
for (int i = 0; i < num_nodes; i++)
{
rtinit(&dts[i], i, link_costs[i], num_nodes);
}
whil.
JavaScript is evolving. It’s an exciting time to be involved with this ubiquitous language of the web. Every year, we get exciting new features landing as part of the language. Let’s explore the freshly released features that were part of the 2019 ECMAScript specification. We’ll also briefly explore the process of how new features get proposed and added to the language, as well as the leading contenders expected to land in ES2020.
This is Class 5 on a 6 week course I taught on Software Design Patterns.
This course discusses the Observer and Decorator patterns.
Class based on "Head First Design Patterns."
1
CMIS 102 Hands-On Lab
Week 8
Overview
This hands-on lab allows you to follow and experiment with the critical steps of developing a program
including the program description, analysis, test plan, and implementation with C code. The example
provided uses sequential, repetition, selection statements, functions, strings and arrays.
Program Description
This program will input and store meteorological data into an array. The program will prompt the user to
enter the average monthly rainfall for a specific region and then use a loop to cycle through the array
and print out each value. The program should store up 5 years of meteorological data. Data is collected
once per month. The program should provide the option to the user of not entering any data.
Analysis
I will use sequential, selection, and repetition programming statements and an array to store data.
I will define a 2-D array of Float number: Raindata[][] to store the Float values input by the user. To store
up to 5 years of monthly data, the array size should be at least 5*12 = 60 elements. In a 2D array this will
be RainData[5][12]. We can use #defines to set the number of years and months to eliminate hard-
coding values.
A float number (rain) will also be needed to input the individual rain data.
A nested for loop can be used to iterate through the array to enter Raindata. A nested for loop can also
be used to print the data in the array.
A array of strings can be used to store year and month names. This will allow a tabular display with
labels for the printout.
Functions will be used to separate functionality into smaller work units. Functions for displaying the data
and inputting the data will be used.
A selection statement will be used to determine if data should be entered.
Test Plan
To verify this program is working properly the input values could be used for testing:
Test Case Input Expected Output
1 Enter data? = y
1.2
2.2
3.3
2.2
10.2
12.2
2.3
0.4
0.2
1.1
2.1
year month rain
2011 Jan 1.20
2011 Feb 2.20
2011 Mar 3.30
2011 Apr 2.20
2011 May 10.20
2011 Jun 12.20
2011 Jul 2.30
2011 Aug 0.40
2011 Sep 0.20
2011 Oct 1.10
2011 Nov 2.10
2011 Dec 0.40
2
0.4
1.1
2.2
3.3
2.2
10.2
12.2
2.3
0.4
0.2
1.1
2.1
0.4
1.1
2.2
3.3
2.2
10.2
12.2
2.3
0.4
0.2
1.1
2.1
0.4
1.1
2.2
3.3
2.2
10.2
12.2
2.3
0.4
0.2
1.1
2.1
0.4
1.1
2.2
3.3
2.2
10.2
12.2
2.3
0.4
0.2
1.1
2.1
0.4
2012 Jan 1.10
2012 Feb 2.20
2012 Mar 3.30
2012 Apr 2.20
2012 May 10.20
2012 Jun 12.20
2012 Jul 2.30
2012 Aug 0.40
2012 Sep 0.20
2012 Oct 1.10
2012 Nov 2.10
2012 Dec 0.40
2013 Jan 1.10
2013 Feb 2.20
2013 Mar 3.30
2013 Apr 2.20
2013 May 10.20
2013 Jun 12.20
2013 Jul 2.30
2013 Aug 0.40
2013 Sep 0 ...
Here is the code- I can't get it to work- I need a function that finds.pdfdoshirajesh75
Here is the code: I can't get it to work. I need a function that finds the maximum of two integers.
#include <stdio.h>
#include <stdlib.h>
#include <limits.h>
/* declare global variables including a table structure to hold scheduling
information */
/* optional: define a function that finds the maximum of two integers */
int total_processes = 0;
struct node{
int id;
int arrival;
int total_cycles;
int total_remaining;
int done;
int start;
int already_started;
int end;
int turnaround;
}* table = NULL;
typedef struct node table_type;
/***************************************************************/
void print_table() {
/*
1.declare local variables
2. print table header
3. for each process
4. print the contents (id, arrival time, total_cycles) of
each field of the table's index
5. if process has been scheduled ("done" field is 1,
6. print other contents (start time, end time, turnaround time)
*/
printf("ID/tArrival/tTotal/tStart/tEnd/tTurnaround/n");
printf("--------------------------------------------\n");
int i;
for(i=0; i < total_processes; i++){
printf("%d\t", table[i].id);
printf("%d\t", table[i].arrival);
printf("%d\t", table[i].total_cycles);
printf("%d\t", table[i].start);
printf("%d\t", table[i].end);
printf("%d\t", table[i].turnaround);
}
return;
}
/***************************************************************/
void procedure_1() {
/*"PROCEDURE FOR OPTION #1"
/* declare local variables */
/* prompt for total number of processes */
/* allocate memory for table to hold process parameters */
/* for each process */
/* prompt for process id, arrival time, and total cycle
time */
/* print contents of table */
int i;
printf("Enter total number of processes: ");
scanf("%d", &table[i].arrival);
table = (table_type *)malloc(total_processes * sizeof(table_type));
for(i = 0; i < total_processes; i++){
int arrival = -1;
int total_cycles = -1;
printf("Enter process id: ");
scanf("%d", &table[i].id);
}
printf("Enter arrival cycle for process P[%d]: ", i);
scanf("%d", &table[i].total_cycles);
/*
table[i].id = i;
table[i].arrival = -1;
table[i].total_cycles = -1;
table[i].start = -1;
table[i].end = -1;
table[i].turnaround = -1;
*/
print_table();
return;
}
/***************************************************************/
void procedure_2() {
/* "PROCEDURE FOR OPTION #2"
/* declare (and initilize when appropriate) local variables */
/* for each process, reset "done" field to 0 */
/* while there are still processes to schedule */
/* initilize the earliest arrival time to INT_MAX
(largest integer value) */
/* for each process not yet scheduled */
/* check if process has earlier arrival time
than current earliest and update */
/* set start time, end time, turnaround time, done fields
for unscheduled process with earliest arrival time */
/* update current cycle time and increment number of
processes scheduled */
/* print contents of table */
int i;
int done;
int min_value;
int current_cycle = 0;
int max;
int min_index;
table[i].done = 0;
while(done < 1){
min.
How do I fix it in LinkedList.javaLabProgram.javaLinkedList.jav.pdfmail931892
How do I fix it in LinkedList.java?
LabProgram.java
LinkedList.java:
/**
* Defines a doubly-linked list class
* @author
* @author
*/
import java.util.NoSuchElementException;
public class LinkedList {
private class Node {
private T data;
private Node next;
private Node prev;
public Node(T data) {
this.data = data;
this.next = null;
this.prev = null;
}
}
private int length;
private Node first;
private Node last;
private Node iterator;
/**** CONSTRUCTORS ****/
/**
* Instantiates a new LinkedList with default values
* @postcondition
*/
public LinkedList() {
first = null;
last = null;
iterator = null;
length = 0;
}
/**
* Converts the given array into a LinkedList
* @param array the array of values to insert into this LinkedList
* @postcondition
*/
public LinkedList(T[] array) {
}
/**
* Instantiates a new LinkedList by copying another List
* @param original the LinkedList to copy
* @postcondition a new List object, which is an identical,
* but separate, copy of the LinkedList original
*/
public LinkedList(LinkedList original) {
}
/**** ACCESSORS ****/
public T getFirst() throws NoSuchElementException {
if (isEmpty()){
throw new NoSuchElementException("The list is empty");
}
return first.data;
}
public T getLast() throws NoSuchElementException {
if (isEmpty()){
throw new NoSuchElementException("The list is empty");
}
return last.data;
}
/**
* Returns the data stored in the iterator node
* @precondition
* @return the data stored in the iterator node
* @throw NullPointerException
*/
public T getIterator() throws NullPointerException {
if (iterator != null){
return iterator.data;
}else{
throw new NullPointerException("Iterator is off the end opf the list.");
}
}
/**
* Returns the current length of the LinkedList
* @return the length of the LinkedList from 0 to n
*/
public int getLength() {
return length;
}
/**
* Returns whether the LinkedList is currently empty
* @return whether the LinkedList is empty
*/
public boolean isEmpty() {
return length == 0;
}
/**
* Returns whether the iterator is offEnd, i.e. null
* @return whether the iterator is null
*/
public boolean offEnd() {
return iterator == null;
}
/**** MUTATORS ****/
public void addFirst(T data) {
Node newNode = new Node(data);
if(isEmpty()){
first = newNode;
last = newNode;
}
else{
newNode.next = first;
first.prev = newNode;
first = newNode;
}
length++;
}
public void addLast(T data) {
Node newNode = new Node(data);
if(isEmpty()){
first = newNode;
last = newNode;
}
else{
last.next = newNode;
newNode.prev = last;
last = newNode;
}
length++;
}
/**
* Inserts a new element after the iterator
* @param data the data to insert
* @precondition
* @throws NullPointerException
*/
public void addIterator(T data) throws NullPointerException{
if(iterator != null){
Node newNode = new Node(data);
newNode.next = iterator.next;
iterator.next = newNode;
if (iterator == first){
first = newNode;
}
}else{
throw new NullPointerException("Iterator is off the end opf the list.");
}
}
/
public void removeFirst() throws NoS.
Part 1 - Written AnswersDownload the GridWriter.zip file and exami.pdfkamdinrossihoungma74
Operating leases have historically been controversial because there was no requirement for
disclosure of the lease arrangements anywhere in the financial statements.True
Solution
Lease is defined as a contract between two parties for use of assets of one parties by paying rent
for using assets. the owner of assets is calls Lessor and the person who use assets is called
Lessee.
Theer is two type lease contract, Operating lease and financial lease. in operating lease, periodic
lease payment is reported in income statement as expense and in financig lease, assets are
reported in balance sheet.
So, given statement is false..
FOR MORE CLASSES VISIT
tutorialoutletdotcom
CMIS 102 Hands-On Lab
Week 8
Overview
This hands-on lab allows you to follow and experiment with the critical steps of developing a program
including the program description, analysis, test plan, and implementation with C code. The example
provided uses sequential, repetition, selection statements, functions, strings and arrays.
Lab Assignment 4 CSE330 Spring 2014 Skeleton Code for ex.docxMARRY7
/* Lab Assignment 4 CSE330 Spring 2014 */
/* Skeleton Code for ex0 of lab4 */
/* No code will be provided for ex1 of lab4 */
#include <stdio.h> /* for NULL */
#include <ctype.h> /* for atoi() */
#include <errno.h> /* for perror() */
#include <signal.h> /* for sigvec() etc. */
#include <sys/types.h> /* for <arpa/inet.h> */
#include <sys/socket.h> /* for PF_INET, etc. */
#include <netinet/in.h> /* for struct sockaddr_in */
#include <arpa/inet.h> /* for inet_addr() */
#include <sys/time.h>
#include "lab4.h"
/* this is in netinet/in.h; included here for reference only.
struct sockaddr_in {
short sin_family;
u_short sin_port;
struct in_addr sin_addr;
char sin_zero[8];
};
*/
/***************************************************************************/
#define LINESIZE 80
#define TYPE0TIMEOUT 3
#define TYPE1TIMEOUT 30
/* You should give a long timeout, like 30sec, otherwise */
/* duplicated responses from the server may cause some problem */
#define MAXRETRY 3
/***************************************************************************/
static char *RCSId="$Id: client2.c,v 4 2014/04/20 03:15:07 cse3300 Exp $";
/***************************************************************************/
/* some functions you may find useful if you implement them */
extern int stringToAddress(char *s, struct sockaddr_in *a);
extern int msgok(LABMSG *);
extern u_short msgchecksum(u_short *);
extern void alarmCatcher(void);
extern int tries; /* for retransmission routines */
int numtries;
/***** this will die ****/
FILE *logFile;
void die(char *s)
{
perror(s);
exit(2);
}
void startTimer(int secs)
{
alarm(secs);
}
void stopTimer(void)
{
alarm(0);
}
/* should change it by yourself if needed!!! */
void printResponse(LABMSG *mp, int ck)
{
int type;
mp->courseEtc = ntohs(mp->courseEtc);
type = ( (mp->courseEtc & MESSAGETYPE) !=0)?1:0;
printf("course=%d, Type=%d\n", mp->courseEtc&0x3fff,type);
if (ntohl(mp->cookie) != ck)
printf("Cookies don't match: sent %x received %x\n",mp->cookie,ck);
if (mp->courseEtc & REQRESP)
printf("response ");
else {
printf("request??\n");
return;
}
mp->result = ntohs(mp->result);
/*printf(" result = %x: ",mp->result);*/
if (mp->result&TRANSOUTCOME) { /* Check outcome */
printf("error: ");
switch (mp->result & 0x7fff) {
case ERROR_CHECKSUM:
printf("checksum failure\n");
break;
case ERROR_SYNTAX:
printf("syntax error\n");
break;
case ERROR_UNKSSN:
printf("unknown SSN %d\n", ntohl(mp->reqSSN) );
break;
case ERROR_SERVER:
printf("Unspecified Server Error\n");
default:
printf("Unknown Error.\n");
} /* case switch */
} else { /* successful transaction */
if(type)printf("Test succeeded.");
if (!type) /* Type 0 -- print SSN and Response */
printf(": %d -> %d\n", ntohl(mp->reqSSN), mp->result&0x7fff);
else
printf("\n"); /* XXX print number of responses */
}
}
/*-----------------------------------*/
/* added by ZXC:
this fun ...
Similar to DO NOT use System.exit().DO NOT add the project or package stateme.pdf (20)
Define the terms adulteration and misbranding How are these concept.pdfinfo48697
Define the terms adulteration and misbranding? How are these concepts different and when can
they overlap? What is economic adulteration? Provide a historical example of adulteration or
misbranding that caused harm to consumers. Do you see similar incidents of adulteration or
misbranding today?.
Define medical futility. Does the definition of futility change with.pdfinfo48697
Define medical futility. Does the definition of futility change with the age of the patient (child,
young adult, or senior)? Should patients always be given complete autonomy with regard to their
healthcare decisions? Why or why not?.
Define or explain CHAPTER 7 � Types of Tangible and Intan.pdfinfo48697
Define or explain:
CHAPTER 7
Types of Tangible and Intangible Property
Distinguish between Abandoned, Lost, and Mislaid
Gifts Delivery (Constructive included), Donative Intent, and Acceptance
Accession be able to distinguish when it applies
Tenants in Common, Joint Tenants, Tenants by the Entirety
Collateral
Easement
Lien
Deficiency
Fee Simple, Life Estate
Different types of Deeds
Bailments be able to distinguish between sole benefit of the bailee, sole benefit of the bailor,
and
mutual benefit bailment
CHAPTER 8
Elements: Agreement, Consideration, Capacity, and Legality - Implied in Fact Contracts Bi-
Lateral and Uni-Lateral Contracts Prior Dealings Duress Promissory Estoppel Mailbox Rule
Statute-of-Frauds and exceptions thereto Quasi Contracts Minors & Capacity Valid, Void, and
Voidable Contracts Validity of Electronic Contracts
CHAPTER 9
Conditions: Precedent, Subsequent, Concurrent
Transferring Interests in Land must be in Writing
Material Breach
Substantial Performance
Specific Performance When is it appropriate
Impossibility of Performance
Effect of Handwritten Terms
Ambiguous Terms
Waiver
Accord and Satisfaction
CHAPTER 10
Intentional Torts, Negligence, and Strict Liability
Distinguish Conversion from Trespass to Personal Property
Assault/Battery
Defamation (Libel or Slander) & Defenses
Fraudulent Misrepresentation
Intentional Infliction of Emotional Distress
Appropriation
Wrongful Interference with a Business Relationship or
Contractual Relationship
Distinguish Comparative Negligence from Contributory Negligence
Define or explain:
CHAPTER 7
Types of Tangible and Intangible Property
Distinguish between Abandoned, Lost, and Mislaid
Gifts Delivery (Constructive included), Donative Intent, and Acceptance
Accession be able to distinguish when it applies
Tenants in Common, Joint Tenants, Tenants by the Entirety
Collateral
Easement
Lien
Deficiency
Fee Simple, Life Estate
Different types of Deeds
Bailments be able to distinguish between sole benefit of the bailee, sole benefit of the bailor,
and
mutual benefit bailment
CHAPTER 8
Elements: Agreement, Consideration, Capacity, and Legality - Implied in Fact Contracts Bi-
Lateral and Uni-Lateral Contracts Prior Dealings Duress Promissory Estoppel Mailbox Rule
Statute-of-Frauds and exceptions thereto Quasi Contracts Minors & Capacity Valid, Void, and
Voidable Contracts Validity of Electronic Contracts
CHAPTER 9
Conditions: Precedent, Subsequent, Concurrent
Transferring Interests in Land must be in Writing
Material Breach
Substantial Performance
Specific Performance When is it appropriate
Impossibility of Performance
Effect of Handwritten Terms
Ambiguous Terms
Waiver
Accord and Satisfaction
CHAPTER 10
Intentional Torts, Negligence, and Strict Liability
Distinguish Conversion from Trespass to Personal Property
Assault/Battery
Defamation (Libel or Slander) & Defenses
Fraudulent Misrepresentation
Intentional Infliction of Emotional Distress
Appropriation
Wrongful Interference with a Business Relations.
Define and explain social entrepreneurship Describe the corporate pu.pdfinfo48697
Define and explain social entrepreneurship Describe the corporate public affairs function today
What is the difference between integrated reporting and a social performance report? Why are
integrated reports increasing in popularity? Identify and explain the steps involved in the
strategic management process..
Define divisors(x) as {y Z y x}. Let a and b be two integers. Pr.pdfinfo48697
Define divisors(x) as {y Z: y | x}. Let a and b be two integers. Prove that divisors(a) divisors(b)
= divisors(b) divisors(a b), We will only prove one direction; the other is very similar. That is,
prove that divisors(b) divisors(a b) divisors(a) divisors(b).
Define artificial intelligence. What does it mean to say that artifi.pdfinfo48697
Define artificial intelligence. What does it mean to say that artificial intelligence uses an anarchy
of methods? Define philosophy. Does philosophy employ an anarchy of methods? Provide
reasons for your answer.
What is supervised learning? What are the advantages and disadvantages of supervised learning?
Is it a bottom-up style of learning or a top-down style of learning? Explain your answer.
What is Lady Lovelaces Objection? What is Turings response to her objection? Do you find it
convincing? Briefly explain your answer..
Cualquier resultado, resultado o elemento medible, tangible y verifi.pdfinfo48697
Cualquier resultado, resultado o elemento medible, tangible y verificable que deba producirse
para completar un proyecto o parte de un proyecto es: (2 puntos)
producto
entregable
tangible
producto de trabajo
Ninguna de las anteriores.
Daniel, Steven ve Chris CTde m�hendis olarak �almaktadr. irketlerin.pdfinfo48697
Daniel, Steven ve Chris CT'de mhendis olarak almaktadr. irketlerinin krlar dmeye baladka
mhendislere olan talep azalmaya balar. Bu nedenle Daniel ve Steven ilerinden izin alrlar. Daniel
ve Steven u ekilde snflandrlr:
friksiyonel isiz
cesareti krlm iiler.
yapsal olarak isiz
fazla alan
dngsel olarak isiz
friksiyonel isiz
cesareti krlm iiler.
yapsal olarak isiz
fazla alan
dngsel olarak isiz.
Cuando un auditor descubre m�s de una condici�n que requiere la desv.pdfinfo48697
Cuando un auditor descubre ms de una condicin que requiere la desviacin o modificacin del
informe de auditora estndar de opinin sin reservas, qu debe incluir el informe del auditor?
A. El informe debe modificarse para cada condicin, excepto cuando haya una desviacin
justificada de los GAAP.
B. El informe debe modificarse para cada condicin, sin excepcin.
C. El informe debe modificarse para cada condicin, excepto cuando haya otro auditor
involucrado.
D. El informe debe modificarse para cada condicin, excepto cuando una condicin neutraliza a
otra..
De cara al futuro, creo que la importancia subyacente de la educaci�.pdfinfo48697
De cara al futuro, creo que la importancia subyacente de la educacin superior, de la ciencia, de la
tecnologa, de la investigacin y la erudicin para nuestra calidad de vida, para la solidez de nuestra
economa, para nuestra seguridad en muchas dimensiones seguir siendo el mensaje ms
importante. .
Cul es el significado de esta cita de charles vest?.
david and liam have entered into a limited partnership where david i.pdfinfo48697
david and liam have entered into a limited partnership where david is the general partner and
liam is the limited partner. as part of the agreement, liam will reveive 40% of the profits . david
has invested $50,000 in the business and liam has invested $40000. suppose the firm has $1
million in debt and becomes bankrupt. liams potential liability is?.
Dave borrowed $1,150 on January 1, 2022. The bank charged him a $4.5.pdfinfo48697
Dave borrowed $1,150 on January 1, 2022. The bank charged him a $4.50 service charge, and
interest was $94.40. If Dave paid the $1,150 in 12 equal monthly payments, what was the APR?
Note: Do not round intermediate calculations. Enter your answer as a percent rounded to 1
decimal place..
Data Security Read the article below and answer the following questi.pdfinfo48697
Data Security Read the article below and answer the following questions: Answer the following
questions: Identify and describe the security and control weaknesses discussed in this case. What
management, organization, and technology factors contributed to these problems? Discuss the
impact of the Equifax hack. How can future data breaches like this one be prevented? Is the
Equifax Hack the Worst Everand Why? Equifax (along with TransUnion and Experian) is one of
the three main U.S. credit bureaus, which maintain vast repositories of personal and financial
data used by lenders to determine credit-worthiness when consumers apply for a credit card,
mortgage, or other loans. The company handles data on more than 820 million consumers and
more than 91 million businesses worldwide and manages a database with employee information
from more than 7,100 employers, according to its website. These data are provided by banks and
other companies directly to Equifax and the other credit bureaus. Consumers have little choice
over how credit bureaus collect and store their personal and financial data. Equifax has more data
on you than just about anyone else. If any company needs airtight security for its information
systems, it should be credit reporting bureaus such as Equifax. Unfortunately, this has not been
the case. On September 7, 2017 Equifax reported that from mid-May through July 2017 hackers
had gained access to some of its systems and potentially the personal information of about 143
million U.S. consumers, including Social Security numbers and driver's license numbers. Credit
card numbers for 209,000 consumers and personal information used in disputes for 182,000
people were also compromised. Equifax reported the breach to law enforcement and also hired a
cybersecurity firm to investigate. The size of the breach, importance, and quantity of personal
information compromised by this breach are considered unprecedented. Immediately after
Equifax discovered the breach, three top executives, including Chief Financial Officer John
Gamble, sold shares worth a combined $1.8 million, according to Securities and Exchange
Commission filings. A company spokesman claimed the three executives had no knowledge that
an intrusion had occurred at the time they sold their shares on August 1 and August 2.
Bloomberg reported that the share sales were not planned in advance. On October 4, 2017
Equifax CEO Richard Smith testified before Congress and apologized for the breach. The size of
the Equifax data breach was second only to the Yahoo breach of 2013, which affected data of all
of Yahoo's 3 billion customers. The Equifax breach was especially damaging because of the
amount of sensitive personal and financial data stored by Equifax that was stolen, and the role
such data play in securing consumers' bank accounts, medical histories, and access to financing.
In one swoop the hackers gained access to several essential pieces of personal information that
could help attac.
Daniel Browning Smith has been named the most flexible man alive. Sm.pdfinfo48697
Daniel Browning Smith has been named the most flexible man alive. Smith discovered his
extreme flexibility when he was barely four years old. He could jump off a bunk bed and land in
a split as a four-year-old in his home in Mississippi. Daniel Browning Smith is known as a
contortionist, or a person who is much more flexible than the average human. Contortionists
move their limbs and bodies in ways beyond what most people are capable of doing.
Question: Subjectively assess your flexibility: If 10 is Daniel Browning Smith, and 1 is stiff as a
board, where do you fall? Enter that number here..
d. What is the total value of the company as of year 0 e. What is.pdfinfo48697
d. What is the total value of the company as of year 0?
e. What is the price per share for year 0? Income Statements for the Year Ending December 31
(Millions of Dollars Except for Per Share Data) Balance Sheets for December 31 (Millions of
Dollars).
D) good genes ^^^ Which of the following isare example(s) of as.pdfinfo48697
D) good genes ^^^ Which of the following is/are example(s) of asexual reproduction: (select
ALL that apply) the binary fission of a species of bacteria the runners of a strawberry plant that
grow genetically identical offspring self-fertilization of a hermaphroditic flower a female lizard
that uses parthenogenesis
Female sticklebacks prefer males with brighter red coloration on their belly. Given the results
depicted in the graph below, what do females that choose redder males benefit from? a) nuptial
gifts b) sensory bias c) direct benefits.
Donita Murphy is a primary care physician at a local community pract.pdfinfo48697
Donita Murphy is a primary care physician at a local community practice clinic. She was
recently asked to consult with the local health department to help develop programs that will
improve the health of community residents. In the past decade, community organizations, health
departments, and healthcare systems have begun to transform and reevaluate health and
healthcare. A significant rise in the cost of healthcare services has community health leaders
focused on the importance of health promotion programs that engage community members to
participate in programs that will foster a culture of health. Affordability and quality care should
be synonymous as community health leaders determine ways to provide preventive health
services to the local community.
At the first meeting with health department leaders, Murphy listened intently as officials
discussed what they believed to be the most serious health disparities and concerns in the
community. Some of the responses included a recent rise in crime rates, obesity, smoking,
diabetes, substance and drug abuse, poverty, and lack of funding for services. After a half hour of
discussion, no one had yet asked Murphy, a physician who has been treating residents for nearly
30 years, what she thought about the health of the community. When she finally had the chance
to speak, she asked everyone in the room several questions, to which none of the other attendees
had clear answers:
What do the residents of this community feel are the most important factors positively or
negatively affecting health?
How do you perceive or value your own health? What does health mean to you, and what
experiences have shaped your interpretation of health?
How does community leadership support improving the quality of health?
Murphy's patients are predominantly residents of low-income housing, receiving financial
assistance for medical care government subsidies to support the cost of living. They have
struggled to find employment in a community that has seen factories close and companies
outsource. She has witnessed firsthand the daily struggles of residents to afford quality care;
access preventive health; participate in health and wellness activities; improve their education
and job skills; and afford fresh, healthful food.
Murphy believes community health leaders who wish to change the culture of health should use
their knowledge and education to influence change by teaching people the value of health,
providing them with the knowledge and tools to make informed decisions regarding health and
health behaviors, and providing an avenue for educational and economic opportunities to better
health. Transformative leadership focuses on the ability of the leader to reach the souls of others
in a fashion which raises human consciousness, builds meanings, and inspires human intent that
is the source of power (Bennis 1986, 70). In underserved communities, the barriers to better
health are often caused by a lack of shared power betwe.
Dolphin Co., 2017 ylnda 1.500 $ �cret ald ve bunun 13� 2018de kaz.pdfinfo48697
Dolphin Co., 2017 ylnda 1.500 $ cret ald ve bunun 1/3' 2018'de kazanlacak. Geri kalan, tutar
alndnda kazanld. irket 2017 ylnda aadaki tutarlardan hangilerini gelir olarak beyan etmelidir?
Birini se:
A.
$1000 dolar
B.
$500 dolar
C.
0 $
D.
1.500 dolar.
Do you agree with how countries in this part of the world have been .pdfinfo48697
Do you agree with how countries in this part of the world have been categorized into a region?
c. What is the difference between the below four maps from a recently-viral post? How would
you explain the differences?.
Does the presence or absence of property rights make any difference .pdfinfo48697
Does the presence or absence of property rights make any difference to people who own no
property? For example, are tenants affected economically by whether the community in which
they rent apartments or houses allows unbridled property rights or reduces those property rights
through zoning laws, open space laws, height restrictions on buildings, or rent control laws?.
Embracing GenAI - A Strategic ImperativePeter Windle
Artificial Intelligence (AI) technologies such as Generative AI, Image Generators and Large Language Models have had a dramatic impact on teaching, learning and assessment over the past 18 months. The most immediate threat AI posed was to Academic Integrity with Higher Education Institutes (HEIs) focusing their efforts on combating the use of GenAI in assessment. Guidelines were developed for staff and students, policies put in place too. Innovative educators have forged paths in the use of Generative AI for teaching, learning and assessments leading to pockets of transformation springing up across HEIs, often with little or no top-down guidance, support or direction.
This Gasta posits a strategic approach to integrating AI into HEIs to prepare staff, students and the curriculum for an evolving world and workplace. We will highlight the advantages of working with these technologies beyond the realm of teaching, learning and assessment by considering prompt engineering skills, industry impact, curriculum changes, and the need for staff upskilling. In contrast, not engaging strategically with Generative AI poses risks, including falling behind peers, missed opportunities and failing to ensure our graduates remain employable. The rapid evolution of AI technologies necessitates a proactive and strategic approach if we are to remain relevant.
June 3, 2024 Anti-Semitism Letter Sent to MIT President Kornbluth and MIT Cor...Levi Shapiro
Letter from the Congress of the United States regarding Anti-Semitism sent June 3rd to MIT President Sally Kornbluth, MIT Corp Chair, Mark Gorenberg
Dear Dr. Kornbluth and Mr. Gorenberg,
The US House of Representatives is deeply concerned by ongoing and pervasive acts of antisemitic
harassment and intimidation at the Massachusetts Institute of Technology (MIT). Failing to act decisively to ensure a safe learning environment for all students would be a grave dereliction of your responsibilities as President of MIT and Chair of the MIT Corporation.
This Congress will not stand idly by and allow an environment hostile to Jewish students to persist. The House believes that your institution is in violation of Title VI of the Civil Rights Act, and the inability or
unwillingness to rectify this violation through action requires accountability.
Postsecondary education is a unique opportunity for students to learn and have their ideas and beliefs challenged. However, universities receiving hundreds of millions of federal funds annually have denied
students that opportunity and have been hijacked to become venues for the promotion of terrorism, antisemitic harassment and intimidation, unlawful encampments, and in some cases, assaults and riots.
The House of Representatives will not countenance the use of federal funds to indoctrinate students into hateful, antisemitic, anti-American supporters of terrorism. Investigations into campus antisemitism by the Committee on Education and the Workforce and the Committee on Ways and Means have been expanded into a Congress-wide probe across all relevant jurisdictions to address this national crisis. The undersigned Committees will conduct oversight into the use of federal funds at MIT and its learning environment under authorities granted to each Committee.
• The Committee on Education and the Workforce has been investigating your institution since December 7, 2023. The Committee has broad jurisdiction over postsecondary education, including its compliance with Title VI of the Civil Rights Act, campus safety concerns over disruptions to the learning environment, and the awarding of federal student aid under the Higher Education Act.
• The Committee on Oversight and Accountability is investigating the sources of funding and other support flowing to groups espousing pro-Hamas propaganda and engaged in antisemitic harassment and intimidation of students. The Committee on Oversight and Accountability is the principal oversight committee of the US House of Representatives and has broad authority to investigate “any matter” at “any time” under House Rule X.
• The Committee on Ways and Means has been investigating several universities since November 15, 2023, when the Committee held a hearing entitled From Ivory Towers to Dark Corners: Investigating the Nexus Between Antisemitism, Tax-Exempt Universities, and Terror Financing. The Committee followed the hearing with letters to those institutions on January 10, 202
The French Revolution, which began in 1789, was a period of radical social and political upheaval in France. It marked the decline of absolute monarchies, the rise of secular and democratic republics, and the eventual rise of Napoleon Bonaparte. This revolutionary period is crucial in understanding the transition from feudalism to modernity in Europe.
For more information, visit-www.vavaclasses.com
How to Make a Field invisible in Odoo 17Celine George
It is possible to hide or invisible some fields in odoo. Commonly using “invisible” attribute in the field definition to invisible the fields. This slide will show how to make a field invisible in odoo 17.
2024.06.01 Introducing a competency framework for languag learning materials ...Sandy Millin
http://sandymillin.wordpress.com/iateflwebinar2024
Published classroom materials form the basis of syllabuses, drive teacher professional development, and have a potentially huge influence on learners, teachers and education systems. All teachers also create their own materials, whether a few sentences on a blackboard, a highly-structured fully-realised online course, or anything in between. Despite this, the knowledge and skills needed to create effective language learning materials are rarely part of teacher training, and are mostly learnt by trial and error.
Knowledge and skills frameworks, generally called competency frameworks, for ELT teachers, trainers and managers have existed for a few years now. However, until I created one for my MA dissertation, there wasn’t one drawing together what we need to know and do to be able to effectively produce language learning materials.
This webinar will introduce you to my framework, highlighting the key competencies I identified from my research. It will also show how anybody involved in language teaching (any language, not just English!), teacher training, managing schools or developing language learning materials can benefit from using the framework.
Unit 8 - Information and Communication Technology (Paper I).pdfThiyagu K
This slides describes the basic concepts of ICT, basics of Email, Emerging Technology and Digital Initiatives in Education. This presentations aligns with the UGC Paper I syllabus.
A Strategic Approach: GenAI in EducationPeter Windle
Artificial Intelligence (AI) technologies such as Generative AI, Image Generators and Large Language Models have had a dramatic impact on teaching, learning and assessment over the past 18 months. The most immediate threat AI posed was to Academic Integrity with Higher Education Institutes (HEIs) focusing their efforts on combating the use of GenAI in assessment. Guidelines were developed for staff and students, policies put in place too. Innovative educators have forged paths in the use of Generative AI for teaching, learning and assessments leading to pockets of transformation springing up across HEIs, often with little or no top-down guidance, support or direction.
This Gasta posits a strategic approach to integrating AI into HEIs to prepare staff, students and the curriculum for an evolving world and workplace. We will highlight the advantages of working with these technologies beyond the realm of teaching, learning and assessment by considering prompt engineering skills, industry impact, curriculum changes, and the need for staff upskilling. In contrast, not engaging strategically with Generative AI poses risks, including falling behind peers, missed opportunities and failing to ensure our graduates remain employable. The rapid evolution of AI technologies necessitates a proactive and strategic approach if we are to remain relevant.
Macroeconomics- Movie Location
This will be used as part of your Personal Professional Portfolio once graded.
Objective:
Prepare a presentation or a paper using research, basic comparative analysis, data organization and application of economic information. You will make an informed assessment of an economic climate outside of the United States to accomplish an entertainment industry objective.
The Roman Empire A Historical Colossus.pdfkaushalkr1407
The Roman Empire, a vast and enduring power, stands as one of history's most remarkable civilizations, leaving an indelible imprint on the world. It emerged from the Roman Republic, transitioning into an imperial powerhouse under the leadership of Augustus Caesar in 27 BCE. This transformation marked the beginning of an era defined by unprecedented territorial expansion, architectural marvels, and profound cultural influence.
The empire's roots lie in the city of Rome, founded, according to legend, by Romulus in 753 BCE. Over centuries, Rome evolved from a small settlement to a formidable republic, characterized by a complex political system with elected officials and checks on power. However, internal strife, class conflicts, and military ambitions paved the way for the end of the Republic. Julius Caesar’s dictatorship and subsequent assassination in 44 BCE created a power vacuum, leading to a civil war. Octavian, later Augustus, emerged victorious, heralding the Roman Empire’s birth.
Under Augustus, the empire experienced the Pax Romana, a 200-year period of relative peace and stability. Augustus reformed the military, established efficient administrative systems, and initiated grand construction projects. The empire's borders expanded, encompassing territories from Britain to Egypt and from Spain to the Euphrates. Roman legions, renowned for their discipline and engineering prowess, secured and maintained these vast territories, building roads, fortifications, and cities that facilitated control and integration.
The Roman Empire’s society was hierarchical, with a rigid class system. At the top were the patricians, wealthy elites who held significant political power. Below them were the plebeians, free citizens with limited political influence, and the vast numbers of slaves who formed the backbone of the economy. The family unit was central, governed by the paterfamilias, the male head who held absolute authority.
Culturally, the Romans were eclectic, absorbing and adapting elements from the civilizations they encountered, particularly the Greeks. Roman art, literature, and philosophy reflected this synthesis, creating a rich cultural tapestry. Latin, the Roman language, became the lingua franca of the Western world, influencing numerous modern languages.
Roman architecture and engineering achievements were monumental. They perfected the arch, vault, and dome, constructing enduring structures like the Colosseum, Pantheon, and aqueducts. These engineering marvels not only showcased Roman ingenuity but also served practical purposes, from public entertainment to water supply.
Acetabularia Information For Class 9 .docxvaibhavrinwa19
Acetabularia acetabulum is a single-celled green alga that in its vegetative state is morphologically differentiated into a basal rhizoid and an axially elongated stalk, which bears whorls of branching hairs. The single diploid nucleus resides in the rhizoid.
Instructions for Submissions thorugh G- Classroom.pptxJheel Barad
This presentation provides a briefing on how to upload submissions and documents in Google Classroom. It was prepared as part of an orientation for new Sainik School in-service teacher trainees. As a training officer, my goal is to ensure that you are comfortable and proficient with this essential tool for managing assignments and fostering student engagement.
Operation “Blue Star” is the only event in the history of Independent India where the state went into war with its own people. Even after about 40 years it is not clear if it was culmination of states anger over people of the region, a political game of power or start of dictatorial chapter in the democratic setup.
The people of Punjab felt alienated from main stream due to denial of their just demands during a long democratic struggle since independence. As it happen all over the word, it led to militant struggle with great loss of lives of military, police and civilian personnel. Killing of Indira Gandhi and massacre of innocent Sikhs in Delhi and other India cities was also associated with this movement.
DO NOT use System.exit().DO NOT add the project or package stateme.pdf
1. DO NOT use System.exit().
DO NOT add the project or package statements.
DO NOT change the class name.
DO NOT change the headers of ANY of the given methods.
DO NOT add any new class fields.
ONLY display the result as specified by the example for each problem.
DO NOT print other messages, follow the examples for each problem.
USE StdIn, StdOut, and StdRandom libraries.
No SCANNER PLEASE!
/*
*
* @author
*
* To generate weather for location at longitude -98.76 and latitude 26.70 for
* the month of February do:
* java WeatherGenerator -98.76 26.70 3
*/
public class WeatherGenerator {
static final int WET = 1; // Use this value to represent a wet day
static final int DRY = 2; // Use this value to represent a dry day
// Number of days in each month, January is index 0, February is index 1...
static final int[] numberOfDaysInMonth = {31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31};
/*
* Description:
* this method works under the assumption that under the same directory as
WeatherGenerator.java,
* there exist drywet.txt and wetwet.txt that contains probabilities of the next day being wet
* with today being a dry/wet day.
* Parameters:
* drywet & wetwet:
* 2 empty 2D arrays that will be populated, with each row in the format of:
* {Longitude, Latitude, January, February, March, April, May, June, July, August, September,
October, November, December}
2. * {-97.58, 26.02, 0.76, 0.75, 0.77, 0.74, 0.80, 0.86, 0.94, 0.97, 0.89, 0.77, 0.74, 0.77}
* you can assume that there more than enough data in the txt file,
* when there are more data in the txt files than what drywet & wetwet can store, store it up to the
array size
* Return:
* this method does not return data, the method is used to populate two 2D arrays with 14
* columns - drywet and wetwet.
* Example:
* double[][] drywet = new double[4100][14];
* double[][] wetwet = new double[4100][14];
* populateArrays(drywet, wetwet);
*/
public static void populateArrays(double[][] drywet, double[][] wetwet) {
StdIn.setFile("drywet.txt");
for(int i=0; i < drywet.length; i++){
for(int j=0; j<14; j++){
drywet[i][j] = StdIn.readDouble();
}
}
StdIn.setFile("wetwet.txt");
for(int i=0; i < drywet.length; i++){
for(int j=0; j<14; j++){
wetwet[i][j] = StdIn.readDouble();
}
}
}
/*
* Description:
* this method uses drywet and wetwet arrays populated by populateArrays, and longitude and
latitude
* of the target location to populate drywetProbability and wetwetProbability with the
3. * probability of dry/wet day is followed by a wet day each month at that location.
* In other words, extracting the probabilities of the location.
* parameters:
* drywetProbability: array of size 12 that will be populated with by the probability of dry days
* followed by a wet day each month
* wetwetProbability: array of size 12 that will be populated with by the probability of wet days
* followed by a wet day each month
* longitude:
* the longitude of the location
* latitude:
* the latitude of the location
* drywet:
* a 2D array of doubles populated by the method populateArrays() using drywet.txt
* wetwet:
* a 2D array of doubles populated by the method populateArrays() using wetwet.txt
* return:
* this method does not return data. The method is used to populate two 1D arrays of length
* 12 - drywetProbability and wetwetProbability.
* The probability of January is stored at index 0, February stored at index 1...
* example:
* //drywet, wetwet are populated by the method populateArrays
* double[] drywetProbability = new double[12];
* double[] wetwetProbability = new double[12];
* populateLocationProbabilities(drywetProbability, wetwetProbability, -97.58, 26.02, drywet,
wetwet);
* drywetProbability will contain the value of:
* [0.37, 0.43, 0.38, 0.48, 0.42, 0.49, 0.57, 0.70, 0.48, 0.44, 0.44, 0.36]
* wetwetProbability will contain the value of:
* [0.76, 0.75, 0.77, 0.74, 0.80, 0.86, 0.94, 0.97, 0.89, 0.77, 0.74, 0.77]
*/
public static void populateLocationProbabilities( double[] drywetProbability, double[]
wetwetProbability,
double longitude, double latitude,
double[][] drywet, double[][] wetwet){
// COMPLETE THIS METHOD
4. }
/*
* Description:
* Given the number of days in a month, and probabilities of weather changing at a certain
location,
* the method should return the forecast for the month.
* The first day of the month has a 50% chance to be a wet day, [0,0.5) (wet), [0.5,1) (dry)
* Use StdRandom.uniform() to generate a real number uniformly in [0,1)
* parameters:
* drywetProbability:
* a double representing the probability of next day being a wet day when the current day is a dry
day.
* wetwetProbability:
* a double representing the probability of next day being a wet day when the current day is a wet
day.
* numberOfDays:
* an integer representing how many days are in this month.
* return:
* The return should be an integer array of 1 and 2s, with the size equal to the size of the month
* 1 meaning the day is a wet day, 2 being a dry day. Index 0 being the first day of the month;
* example:
* int[] forecast = forecastGenerator( 0.27, 0.55, 31);
* Here, forecast shoule be a size 31 array of 1s and 2s, although the probability is determined,
the
* return result will still be different for each run since it is randomly generated.
*/
public static int[] forecastGenerator( double drywetProbability, double wetwetProbability, int
numberOfDays) {
// COMPLETE THIS METHOD
}
/*
* Description:
* This method takes the number of locations that is stored in wetwet.txt and drywet.txt (the
number of
5. * lines in each file), and takes in the month number (January is index 0, February is index 1... ),
* and the longitude and the latitude of the location we want to make the prediction on.
* This method calls all previous methods (populateArrays(), populateLocationProbabilities(),
* forecastGenerator() in this order).
* This is the only method directly called by main method to generate a forecast
* The general flow of the method:
* Firstly, use populateArrays() to extract all data into 2D arrays.
* Secondly, use populateLocationProbabilities to get the probability data of the target location
* Lastly, pass in the probability data of the month into forecastGenerator to generate a forecast
* parameters:
* numberOfLocations:
* an interger representing how many lines exists in wetwet.txt and drywet.txt
* month:
* an integer representing the month of the prediction (January is index 0, February is index 1...)
* longitude:
* a double representing the longitude of the target location.
* latitude:
* a double representing the latitude of the target location.
* return:
* return should be an integer array of 1 and 2s, with the size equal to the size of the month
* 1 meaning the day is a wet day, 2 being a dry day. index 0 being the first day of the month;
* example:
* oneMonthForecast( 4100, 0, -97.58, 26.02);
* this method call should returns an size 31 array with 1s and 2s,
* the return result will be different for each run since it is randomly generated.
*/
public static int[] oneMonthForecast(int numberOfLocations, int month, double longitude,
double latitude ){
// COMPLETE THIS METHOD
}
/********
*
* * Methods to analyze forecasts
*
******/
6. /*
* Description:
* Returns the number of mode (WET or DRY) days in forecast.
* parameters:
* forecast:
* an integer array of 1 and 2s, with the size equal to the size of the month
* 1 represents that the day is a wet day, 2 represents a dry day.
* index 0 is the first day of the month;
* mode:
* an integer with value of 1 (WET) or 2 (DRY).
* 1 means the method returns the number wet days.
* 2 means the method returns the number dry days.
* return:
* returns the number of mode (WET or DRY) days in forecast
* example:
* int[] arr1 = {WET,DRY,DRY,DRY};
* System.out.println(lengthOfLongestSpell(arr, DRY)); //prints out 3
* System.out.println(lengthOfLongestSpell(arr, WET)); //prints out 1
*/
public static int numberOfWetDryDays (int[] forecast, int mode) {
// COMPLETE THIS METHOD
}
/*
* Description:
* Find the longest number of consecutive mode (WET or DRY) days in forecast.
* parameters:
* forecast:
* an integer array of 1 and 2s, with the size equal to the month number of days
* represents that the day is a wet day, 2 represents a dry day.
* index 0 is the first day of the month;
* mode:
* an integer with value of 1 or 2.
* 1 means the method returns the longest stretch of consecutive wet days.
* 2 means the method returns the longest stretch of consecutive dry days.
7. * return:
* returns the longest number of consecutive mode (WET or DRY) days in forecast.
* example:
* int[] arr = {1,2,2,1,2,1,2,2,1,1,2,1, 2,2,2,2,2,2,2,2,2, 1,2,1,2,1,2,1,2}
* System.out.println(lengthOfLongestSpell(arr), DRY); //prints out 9
*/
public static int lengthOfLongestSpell (int[] forecast, int mode) {
// COMPLETE THIS METHOD
}
/*
* Description:
* Given the forecast of a month at certain location, this method finds the index of the
* first day of a 7 day period with the least amount of rain. If multiple exist, return
* the earliest.
* parameters:
* forecast:
* an integer array of 1 and 2s, with the size equal to the month number of days
* 1 represents the day is a wet day, 2 being a dry day.
* index 0 is the first day of the month;
* return:
* returns the index of the first day of the 7 days period with the most dry days in forecast.
* (use the earliest 7 days period with the most dry days)
* example:
* //index: 0 1 2 3 4 5 6 7 8 9 10 11 12...
* int[] arr = {1,2,2,1,2,1,2,2,1,1,2, 1, 2,2,2,2,2,2,2,2,2, 1,2,1,2,1,2,1,2}
* System.out.println(lengthOfLongestSpell(arr)); //prints out 12
*/
public static int bestWeekToTravel(int[] forecast){
// COMPLETE THIS METHOD
}
/*
* Reads the files containing the transition probabilities for US locations.
* Execution:
* java WeatherGenerator -97.58 26.02 3
8. */
public static void main (String[] args) {
int numberOfRows = 4100; // Total number of locations
int numberOfColumns = 14; // Total number of 14 columns in file
// File format: longitude, latitude, 12 months of transition probabilities
double longitude = Double.parseDouble(args[0]);
double latitude = Double.parseDouble(args[1]);
int month = Integer.parseInt(args[2]);
int[] forecast = oneMonthForecast( numberOfRows, month, longitude, latitude );
int drySpell = lengthOfLongestSpell(forecast, DRY);
int wetSpell = lengthOfLongestSpell(forecast, WET);
int bestWeek = bestWeekToTravel(forecast);
StdOut.println("There are " + forecast.length + " days in the forecast for month " + month);
StdOut.println(drySpell + " days of dry spell.");
StdOut.println("The bestWeekToTravel starts on:" + bestWeek );
for ( int i = 0; i < forecast.length; i++ ) {
// This is the ternary operator. (conditional) ? executed if true : executed if false
String weather = (forecast[i] == WET) ? "Wet" : "Dry";
StdOut.println("Day " + (i) + " is forecasted to be " + weather);
}
}
}
A weather generator produces a "synthetic" time series of weather data for a location based on
the statistical characteristics of observed weather at that observations generated sequentially
through time. The special feature of a time series is that successive observations are usually
expected to be dent, in the case of forecasting a day's weather depends on the previous day's
weather. YouTube has literally thousands of videos about weather fronts and how they are
connected to the weather. This one from the UK has graphics supporting the idea of persistence
(though that word is not used). As you watch it, consider that whatever is causing weather today
(high pressure and a warm mass air creating a sunny, warm day or low pressure and a cool mass
of air creating a cloudy, cool day) is possibly still going to be affecting weather tomorrow. This
is the idea of persistence. The goal of this assignment will be to see how computation is used in
9. predicting long-range climate patterns. But, you might wonder how we can think about this when
we can't even predict the weather with certainty from one day to the next. Part of the answer is
that, with climate, we are trying to identify broad trends like "hotter", "wetter", "drier", not the
weather that will be experienced on any particular day. Imagine you are a farmer. Does knowing
the number of wet or dry days tell the whole story? Would the pattern be important? If so, what
pattern would you like to see? How would you measure this pattern? Weather and climate rely
on probability. It is perhaps the case that most people get their first exposure to probability
concepts from listening to weather reports. A forecaster might say "there is a 10% chance of
rain" or that "afternoon showers are likely." Probability and statistics are an integral part of day-
to-day weather forecasting because models of real-world phenomena must take into account
randomness. Randomness or uncertainty might imply ack of predictability, but it does not
necessarily imply a lack of knowledge or understanding. Weather data depends on both the time
of year and the location. This means that the probabilities used in the simulation need to be
associated with both a location and a time of year.The transition probabilities that we will use for
Norman are based on historical data, and you might use them to get a sense likelihood of certain
weather phenomena in the near future. For instance, a farmer might want to run many, many
simulations to get an idea of the likood of going 20 or more days without rain, and the results
might influence the crops that he or she plants. Just as we can base the transition probabies
historical data, we can also base them on future predictions. For instance, the National Center for
Atmospheric Research (NCAR) simulates weather as it responds to assumptions about how
various "forcings" (e.g., greenhouse gasses) will evolve in the future. Typically, these models
couple an atmospheric model with an ocean model, but more recent versions, the so-called Earth
system models, incorporate more components, including land use, sea, and land ice, etc. The
models can be used to predict future precipitation patterns and transition probabilities that are
based on these forecasts rather than past data.
Assignment Gioal Since we are just beginning as weather forecasters, we will simplify our
predictions to just whether measurable precipitation will fall from the sky. If there is measurable
precipitation, we call it a "wet" day. Otherwise, we call it a "dry" day. We will also simplify our
next day prediction based on: 1. The previous day's weather. 2. The probability of the weather
changing from dry/wet to wet of that location in that month. (Weather data) 3. A random number
Weather data depends on both the time of year and the location. This means the probabilities
used in our simulation need to be associated with location and a month. The table below lists the
probabilities that a day will be wet, given that the previous day was dry/wet for each month for a
weather station near Norman, OK. This table gives the probability of a change from dry to wet or
wet to wet. These are "real" numbers that reflect how often the weather changed from dry to wet
10. in that specific location, during the month indicated, over the 30-year period from 1970-2000.
Armed with these probabilities, we can turn our simulation into a weather generator for this
location. Here's what it would look like for July in Norman, OK. The box called "Random
Outcome" means that we observe some random event whose outcomes occur with the
probabilities shown on the arrows emanating from the box. If it is a dry day, we want the
outcome to simulate "next day being wet" 12% of the time and "next day being dry"
88%(100%12%) of the time. A common practice would be to use a random number generator to
generate some value between 0 and 1 . If the random value is less than .12, we can forecast the
next day to be wet, and if it is greater than .12, we can forecast the next day to be dry. If it's a wet
day, we want to simulate " next day being wet " 45% of the time and " next day being dry" 55%
of the time. To do this with our random number generator, we say there is " next day being wet "
if the random number is less than .45 and "next day being dry" if it is greater. In the simulation
flowchart to the right, note that two of the four probabilities came from the table. These are the
values shown in bold. The probabilities on the other arrows are calculated using the fact that the
probabilities must sum to 1.
Implementation You are given 2 text files named drywet.txt and wetwet.txt. wetwet.txt data file
refers to the probability of next day being a wet day if the current day is wet. drywet.txt data file
refers to the probability of next day being a wet day if the current day is dry. NOTE: the data for
the same location in wetwet.txt and drywet.txt will have the same line number. These files are in
the format of: (excerpt from wetwet.txt) In each line, the first and second numbers represent the
location's longitude and latitude. The following 12 numbers represent the probability of the next
day being a wet day of the month. For example, on the first line of the excerpt above 0.75 means
that in February (4th column), there is a 75% of chance that the next day is a wet day if today is a
wet day. Pseudocode to predict the weather for the month of June in Norman, OK (probabilities
from the table above): The first day of the month has a 50o chance to be a wet day. A value in
the range (0,0.50) means the first day is wet, a value in the range [0.501) means the first day is
dry. WHILE not all days for the month have been forecasted READ a random value between 0
and 1 IF today is a wet day THEN IF the random value is less than or equal to 0.45 THEN The
next day will be a wet day ELSE The next day will be a dry day ENDIF ELSE IF the random
value is less than or equal 0.12 THEN The next day will be a wet day ELSE The next day will be
a dry day ENDIF ENDIF ENDWHILE The weather generator methods you will be writing for
this assignment will: 1. populateLocationProbabilities: populates two arrays with the weather
data of a certain location. 2. forecastGenerator: predict future precipitation pattern for one month.
3. oneMonthForcast: use previous methods to prepare the data and predict the weather for a
month. 4. numberOfWetDryDays: find the number of wet or dry days in a given month's
11. forecast. 5. lengthOfLongestWetDrySpell: find the longest wet or dry spell in a given month's
forecast. 6. bestWeekToTravel: find the 7-day period with the most amount of dry days.
More details about the methods in the comments in the Java file For this assignment, since we
are dealing with randomized numbers, it can be very difficult to debug your code if it, so
AutoLab will provide you with something called a "seed" if your code fails a certain test case to
help you reproduce the error. Use StdRandom.setSeed(someLongNumber); to set the seed
provided. Doing so will cause all your future calls on StdRandom.uniform() to give the same
result on different runs of the program, allowing your program to reproduce the exact numbers
generated by Autolab. A bit more on seeds: seed (also known as random seed) is basically what
computers use to generate random numbers. True randomness does not really exist in computers.
One way to generate a random number is to take some unrelated information and process it in a
certain way such that it will generate an evenly distributed number. Oftenly, if the user(you) does
not provide StdRandom with a seed, it will generate a random seed itself. But we can manually
set seed at the beginning of your program by using StdRandom.setSeed(someLongNumber);
doing so will cause all your future calls on StdRandom.uniform() to give the same result on
different runs of the program. For example: StdRandom. setSeed ( 1617155768130L);
system.out.println( stdRandom. uniform() ); System.out.println( StdRandom. uniform() );
system. out.println( stdRandom. uniform() ); Will always result in the following numbers being
generated (in any computer): 0.8686254179738488 0.04875107145027979
0.5747992812879426 Use the provided main method to test your methods. To generate the
weather for location at longitude -98.76 and latitude 26.70 for the month of February do: java
WeatherGenerator 98.7626.703 Always start reading code at the main() method. That will help
you understand the structure of the program.