publicclass Date {
privatestatic String DATE_SEPARATOR = \"/\";
privatestaticintDAYS_PER_WEEK = 7;
//Attributes
privateint day;
privateint month;
privateint year;
/**
* Default Constructor
* Instantiates an object of type Date to 1/1/2000
*/
public Date() {
this.day = 1;
this.month = 1;
this.year = 2000;
}
/**
* Constructs a new date object to represent the given date.
* @param day
* @param month
* @param year
*/
public Date(int day, int month, int year) {
if(isValid(day, month, year)) {
this.day = day;
this.month = month;
this.year = year;
} else
System.out.println(\"Invalid Date.\");
}
/**
* Returns the day value of this date for example, for the date 2006/07/22, returns 22.
* @return
*/
publicint getDay() {
return day;
}
/**
* Returns the month value of this date ,for example, for the date 2006/07/22, returns 7.
* @return
*/
publicint getMonth() {
return month;
}
/**
* Returns the year value of this date, for example , the date 2006/07/22, returns 2006.
* @return
*/
publicint getYear() {
return year;
}
/**
* @param day the day to set
*/
publicvoid setDay(int day) {
this.day = day;
}
/**
* @param month the month to set
*/
publicvoid setMonth(int month) {
this.month = month;
}
/**
* @param year the year to set
*/
publicvoid setYear(int year) {
this.year = year;
}
/**
* Returns true if the year of this date is a leap year.
* A leap year occurs every 4 years , except for multiples of 100 that are not multiples of 400.
* For example, 1956,1844,1600,and 2000 are leap years, but 1983,2002,1700,and 1900 are not.
* @return
*/
publicboolean isLeapYear(){
if(((this.year % 400) == 0) || (((this.year % 4) == 0) && ((this.year % 100) != 0)))
returntrue;
else
returnfalse;
}
/**
* Checks if the date is valid
* @param day
* @param month
* @param year
* @return
*/
publicboolean isValid(int day, int month, int year) {
if((month < 1) || (12 < month))
returnfalse;
else {
if(((month == 1) || (month == 3) || (month == 5) || (month == 7) ||
(month == 8) || (month == 10) || (month == 12)) && ((day < 1) || (31 < day)))
returnfalse;
elseif(((month == 4) || (month == 6) || (month == 9) || (month == 11)) && ((day < 1) || (30 <
day)))
returnfalse;
elseif(month == 2) {
if(isLeapYear() && ((day < 1) || (29 < day)))
returnfalse;
elseif((day < 1) || (28 < day))
returnfalse;
}
}
returntrue;
}
/**
* Returns the maximum number of days in a month
* @return
*/
publicint maxMonthDays() {
if(this.month == 2) {
if(isLeapYear())
return 29;
else
return 28;
} elseif((this.month == 1) || (this.month == 3) || (this.month == 5) || (this.month == 7) ||
(this.month == 8) || (this.month == 10) || (this.month == 12))
return 31;
else
return 30;
}
/**
* Checks if this dat is same as other date
* @param other
* @return
*/
publicboolean isEqual(Date other) {
if((this.day == other.day) && (this.month == other.month) && (this.year == other.year))
returntrue;
else
returnfalse;
}
/**
* Moves this Date object forward in time by the given number of days .
* @param days
*/
publicvoid addDays(int days).
Date class that represents a date consisting of a year, month, and a.pdfanilgoelslg
Date class that represents a date consisting of a year, month, and a day
import java.util.TimeZone;
public class Date {
// constants
private static final int JANUARY = 1;
private static final int FEBRUARY = 2;
private static final int DECEMBER = 12;
private static final int DAYS_PER_WEEK = 7;
private static final int DAYS_PER_YEAR = 365;
private static final int DAYS_PER_LEAP_YEAR = 366;
private static final String[] DAY_NAMES = {\"SUNDAY\", \"MONDAY\", \"TUESDAY\",
\"WEDNESDAY\", \"THURSDAY\", \"FRIDAY\", \"SATRDAY\"};
private static final int[] DAYS_PER_MONTH = { -1,
// 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12
31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31,
};
// fields
private int year;
private int month;
private int day;
/**
Constructs a new object representing the given year, month, and day.
@throws IllegalArgumentException if month is not between 1 and 12, or if day is not between 1
and the number of days in that month.
*/
public Date(int year, int month, int day) {
this.year = year;
this.month = month;
this.day = day;
if (month < 1 || month > 12 || day < 1 || day > getDaysInMonth()) {
throw new IllegalArgumentException(\"Invalid day or month: \" + toString());
}
}
/** Constructs a new object representing today\'s date. */
public Date() {
this(2006, july
, 22);
int daysSinceEpoch = (int) ((System.currentTimeMillis() +
TimeZone.getDefault().getRawOffset()) / 1000 / 60 / 60 / 24);
for (int i = 0; i < daysSinceEpoch; i++) {
nextDay();
}
}
/**
Adds the given number of days to this Date.
@throws IllegalArgumentException if days < 0.
*/
public void addDays(int days) {
while (days > getDaysInYear()) {
days -= getDaysInYear();
year++;
}
for (int i = 1; i <= days; i++) {
nextDay();
}
}
/**
Returns whether o refers to a Date object representing the same
year, month, and day as this one.
*/
public boolean equals(Object o) {
Date other = (Date) o;
return day == other.day &&
month == other.month &&
year == other.year;
}
/**
Returns the day represented by this Date object.
@return the day, between 1 and the number of days in this Date\'s month
(which varies from 28 to 31)
*/
public int getDay() {
return day;
}
/** Returns the number of days in the month represented by the current Date. */
public int getDaysInMonth() {
int result = DAYS_PER_MONTH[month];
if (month == FEBRUARY && isLeapYear()) {
result++;
}
return result;
}
public int getDaysInYear() {
if (isLeapYear()) {
return 366;
} else {
return 365;
}
}
/**
Returns a string such as \"Monday\" representing what day of the week
this Date fell on.
@return the day as either \"Sunday\", \"Monday\", \"Tuesday, \"Wednesday\", \"Thursday\",
\"Friday\", or \"Satrday\"
*/
public String getDayOfWeek() {
int index = 1;
Date temp = new Date(1753, JANUARY, 1);
while (temp != this) {
temp.nextDay();
index = (index + 1) % DAYS_PER_WEEK;
}
return DAY_NAMES[index];
}
/**
Returns the month represented by this Date object.
@return the month, between 1 and 12
*/
public int getMonth() {
return month;
}
/**
Returns the yea.
Hi,I have implemented increment() method. Please find the below up.pdfAnkitchhabra28
Hi,
I have implemented increment() method. Please find the below updated code.
DaysBetween Class:
import java.text.DateFormatSymbols;
import java.util.Calendar;
import java.util.Scanner;
class DateClass {
protected int year;
protected int month;
protected int day;
public static final int MINYEAR = 1583;
// Constructor
public DateClass(int newMonth, int newDay, int newYear)
{
month = newMonth;
day = newDay;
year = newYear;
}
// Observers
public int getYear()
{
return year;
}
public int getMonth()
{
return month;
}
public int getDay()
{
return day;
}
public int lilian()
{
// Returns the Lilian Day Number of this date.
// Precondition: This Date is a valid date after 10/14/1582.
//
// Computes the number of days between 1/1/0 and this date as if no calendar
// reforms took place, then subtracts 578,100 so that October 15, 1582 is day 1.
final int subDays = 578100; // number of calculated days from 1/1/0 to 10/14/1582 November
17, 1858
int numDays;
// Add days in years.
numDays = year * 365;
// Add days in the months.
if (month <= 2)
numDays = numDays + (month - 1) * 31;
else
numDays = numDays + ((month - 1) * 31) - ((4 * (month-1) + 27) / 10);
// Add days in the days.
numDays = numDays + day;
// Take care of leap years.
numDays = numDays + (year / 4) - (year / 100) + (year / 400);
// Handle special case of leap year but not yet leap day.
if (month < 3)
{
if ((year % 4) == 0) numDays = numDays - 1;
if ((year % 100) == 0) numDays = numDays + 1;
if ((year % 400) == 0) numDays = numDays - 1;
}
// Subtract extra days up to 10/14/1582.
numDays = numDays - subDays;
return numDays;
}
Override
public String toString()
// Returns this date as a String.
{
String monthString = new DateFormatSymbols().getMonths()[month-1];
return(monthString + \"/\" + day + \"/\" + year);
}
public class mjd
{
public int mjd()
{
final int subDays = 678941;
int numDays;
numDays = year * 365;
if (month <= 2)
numDays = numDays + (month - 1) * 31;
else
numDays = numDays + ((month -1) * 31) - ((4 * (month-1) + 27)/10);
numDays = numDays + day;
numDays = numDays + (year / 4) - (year / 100) + (year / 400);
if (month < 3)
{
if ((year % 4) == 0) numDays = numDays -1;
if ((year % 100) == 0) numDays = numDays + 1;
if ((year % 400) == 0) numDays -= numDays -1;
}
// Days subtracted up to 10/14/1582
numDays = numDays - subDays;
return numDays;
}
}
public class djd
{
public int djd()
{
final int subDays = 693961; // number of calculated days from 1/1/0 to January 1,1900
int numDays;
// Add days in years.
numDays = year * 365;
// Add days in the months.
if (month <= 2)
numDays = numDays + (month - 1) * 31;
else
numDays = numDays + ((month - 1) * 31) - ((4 * (month-1) + 27) / 10);
// Add days in the days.
numDays = numDays + day;
// Take care of leap years.
numDays = numDays + (year / 4) - (year / 100) + (year / 400);
// Handle special case of leap year but not yet leap day.
if (month < 3)
{
if ((year % 4) == 0) numDays = numDays - 1;
if ((year % 100) == 0) numDays = numDays + 1;
if ((year % .
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.
Modify the Date class that was covered in the lecture which overload.pdfsaxenaavnish1
Modify the Date class that was covered in the lecture which overloaded the increment and stream
insertion operators.
The new version of the class should have the following overloaded operators:
(=) subtraction assignment operator :: subtracts the right operand from the left operand and
assigns the result to the left operand.
This operator should cause appropriate number of decrements to the object's 'day' member. It
also checks appropriate decrements to the 'month' and 'year' data members, if necessary.
(>>) cin 's stream extraction operator :: This operator should prompt the user for a date to be
stored in a Date object (you can specify your own format and prompt the user for the same).
Write a driver program and test the operators with the Date objects.
The program should have the following additional requirements:
The operator overloaded functions should be non-member functions.
Input validation (day, month) for the Date object.
The subtraction assignment operator (=) should work with end of month, end of year, and leap
year conditions as shown in the example output below.
Minimum three files (main.cpp, Date.h, Date.cpp). Submit your code as:
LastName_FirstName_Q2.zip (containing all files).
Example output:
Enter a date in format mm-dd-yyyy
01-01-2023
Date d1 is: January 1, 2023 // Check a valid date
Date (d1 -= 3) is: December 29, 2022 // Decrement by 3 days
Date d2 is: March 2, 2008
Date (d2-=2) is: February 29, 2008 // leap year has 29 days
Date.h
// Fig. 10.6: Date.h
// Date class definition with overloaded increment operators.
#ifndef DATE_H
#define DATE_H
#include
#include
class Date {
friend std::ostream& operator<<(std::ostream&, const Date&);
public:
Date(int m = 1, int d = 1, int y = 1900); // default constructor
void setDate(int, int, int); // set month, day, year
Date& operator++(); // prefix increment operator
Date operator++(int); // postfix increment operator
Date& operator+=(unsigned int); // add days, modify object
static bool leapYear(int); // is year a leap year?
bool endOfMonth(int) const; // is day at the end of month?
private:
unsigned int month;
unsigned int day;
unsigned int year;
static const std::array days; // days per month
void helpIncrement(); // utility function for incrementing date
};
#endif
Date.cpp
#include
#include
#include "Date.h"
using namespace std;
// initialize static member; one classwide copy
const array Date::days{
0, 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31};
// Date constructor
Date::Date(int month, int day, int year) {
setDate(month, day, year);
}
// set month, day and year
void Date::setDate(int mm, int dd, int yy) {
if (mm >= 1 && mm <= 12) {
month = mm;
}
else {
throw invalid_argument{"Month must be 1-12"};
}
if (yy >= 1900 && yy <= 2100) {
year = yy;
}
else {
throw invalid_argument{"Year must be >= 1900 and <= 2100"};
}
// test for a leap year
if ((month == 2 && leapYear(year) && dd >= 1 && dd <= 29) ||
(dd >= 1 && dd <= days[month])) {
day = dd;
}
else {
throw invalid_argument{
"Da.
Problem DefinitionBuild a Date class and a main function to test i.pdfsmitaguptabootique
Problem Definition
Build a Date class and a main function to test it.
Specifications
Below is the interface for the Date class: it is our \"contract\" with you: you have to implement
everything it describes, and show us that it works with a test harness that puts it through its
paces. The comments in the interface below should be sufficient for you to understand the
project (use these comments in your Date declaration), without the need of any further
documentation. But of course, as always, you can ask us any questions you may have on Piazza.
Note: Placing the error messages into the constructors like is not necessarily a good way to
handle constructor errors, but until you learn about exceptions in CS 14, it\'s the best we can do.
Private Member Functions
The functions declared private above, isLeap, daysPerMonth, name, number, are helper functions
- member functions that will never be needed by a user of the class, and so do not belong to the
public interface (which is why they are \"private\"). They are, however, needed by the interface
functions (public member functions), which use them to test the validity of arguments and
construct valid dates. For example, the constructor that passes in the month as a string will call
the number function to assign a value to the unsigned member variable month.
isLeap: The rule for whether a year is a leap year is:
(year % 4 == 0) implies leap year
except (year % 100 == 0) implies NOT leap year
except (year % 400 == 0) implies leap year
So, for instance, year 2000 is a leap year, but 1900 is NOT a leap year. Years 2004, 2008, 2012,
2016, etc. are all leap years. Years 2005, 2006, 2007, 2009, 2010, etc. are NOT leap years.
Output Specifications
Read the specifications for the print function carefully. The only cout statements within your
Date member functions should be:
the \"Invalid Date\" warnings in the constructors
in your two print functions
Required Main Function
You must use this main function and global function getDate as they are here. You may not
change these functions at all. Copy-and-paste these into your main.cpp file and then add the Date
class.
Solution
// Date.h
#include
#include
#include
#include
using namespace std;
class Date
{
private:
unsigned day;
unsigned month;
string monthName;
unsigned year;
public:
Date();
Date(unsigned m, unsigned d, unsigned y);
Date(const string &mn, unsigned d, unsigned y);
void printNumeric() const;
void printAlpha() const;
private:
bool isLeap(unsigned y) const;
unsigned daysPerMonth(unsigned m, unsigned y) const;
string name(unsigned m) const;
unsigned number(const string &mn) const;
};
//Date.cpp
#include
#include
#include
#include
using namespace std;
#include \"Date.h\"
// creates the date January 1st, 2000.
Date::Date()
{
day = 1;
month = 1;
monthName = \"January\";
year = 2000;
}
/* parameterized constructor: month number, day, year
- e.g. (3, 1, 2010) will construct the date March 1st, 2010
If any of the arguments are invalid (e.g. 15 for month o.
struct procedure { Date dateOfProcedure; int procedureID.pdfanonaeon
struct procedure
{
Date dateOfProcedure;
int procedureID;
int procedureProviderID;
};
Data.h
#include
#include
class Date
{
friend ostream& operator<<( ostream &, const Date & );
// allows easy output to a ostream
public:
Date( int m = 1, int d = 1, int y = 1900 ); // constructor, note the default values
void setDate( int, int, int ); // set the date const
Date &operator+=( int ); // add days, modify object
bool leapYear( int) const; // is this a leap year?
bool endOfMonth( int ) const; // is this end of month?
int getMonth ( ) const;
int getDay ( ) const;
int getYear ( ) const;
string getMonthString( ) const;
private:
int month;
int day;
int year;
static const int days[]; // array of days per month static const string monthName[]; // array of
month names
void helpIncrement();
// utility function
}; #endif Data.cpp // Member function definitions for Date
class in separate
date.cpp
#include
#include \"date.h\"
#include // Initialize static members at file scope; // one class-wide copy.
const int Date::days[] = { 0, 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 }; const string
Date::monthName[] = { \"January\", \"February\", \"March\", \"April\", \"May\", \"June\",
\"July\", \"August\", \"September\", \"October\", \"November\", \"December\" };
// Date constructor
Date::Date(int m, int d, int y)
{
setDate(m, d, y); } // Set the date
void Date::setDate(int mm, int dd, int yy)
{
month = (mm >= 1 && mm <= 12) ? mm : 1; year = (yy >=1900&& yy <= 2100) ? yy
: 1900; // test for a leap year
if (month == 2 && leapYear(year)) day = (dd >= 1 && dd <= 29) ? dd : 1;
else
day =(dd >= 1 && dd <= days[month]) ? dd : 1;
} // Add a specific number of days to a date
const Date &Date::operator+=(int additionalDays)
{
for (int i = 0; i < additionalDays; i++) helpIncrement();
return *this; // enables cascading
} // If the year is leap year, return true; //
otherwise, return false
bool Date::leapYear(int testYear)
const
{
if (testYear % 400 == 0 || (testYear %100 != 0 && testYear % 4 == 0)) return true; // a
leap year
else
return false; // not a leap year
} // Determine if the day is the end of the month
bool Date::endOfMonth(int testDay)
const
{
if (month == 2 && leapYear(year))
return (testDay == 29); // last day of Feb. in leap year
else
return (testDay == days[month]);
} // Function to help increment the date
void Date::helpIncrement()
{
if (!endOfMonth(day))
{
// date is not at the end of the month
day++;
}
else if (month < 12)
{
// date is at the end of the month, but month < 12 day = 1; ++month;
}
else
{
// end of month and year: last day of the year
day = 1;
month = 1;
++year;
} }
// Overloaded output operator
ostream &operator<<(ostream& output, const Date &d)
{
output << d.monthName[d.month] << \' \' << d.day << \", \"<< d.year;
return output; // enables cascading
}
int Date::getMonth() const //
{
Public:
int month[20];
If(month[]!=”/0”)
Cout<<”Enter Month :-<>month;
Elseif (month[]<12)
{
Cout<>month[];
else
return month;
}
int Date::getDay() const //
{
Pu.
Date class that represents a date consisting of a year, month, and a.pdfanilgoelslg
Date class that represents a date consisting of a year, month, and a day
import java.util.TimeZone;
public class Date {
// constants
private static final int JANUARY = 1;
private static final int FEBRUARY = 2;
private static final int DECEMBER = 12;
private static final int DAYS_PER_WEEK = 7;
private static final int DAYS_PER_YEAR = 365;
private static final int DAYS_PER_LEAP_YEAR = 366;
private static final String[] DAY_NAMES = {\"SUNDAY\", \"MONDAY\", \"TUESDAY\",
\"WEDNESDAY\", \"THURSDAY\", \"FRIDAY\", \"SATRDAY\"};
private static final int[] DAYS_PER_MONTH = { -1,
// 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12
31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31,
};
// fields
private int year;
private int month;
private int day;
/**
Constructs a new object representing the given year, month, and day.
@throws IllegalArgumentException if month is not between 1 and 12, or if day is not between 1
and the number of days in that month.
*/
public Date(int year, int month, int day) {
this.year = year;
this.month = month;
this.day = day;
if (month < 1 || month > 12 || day < 1 || day > getDaysInMonth()) {
throw new IllegalArgumentException(\"Invalid day or month: \" + toString());
}
}
/** Constructs a new object representing today\'s date. */
public Date() {
this(2006, july
, 22);
int daysSinceEpoch = (int) ((System.currentTimeMillis() +
TimeZone.getDefault().getRawOffset()) / 1000 / 60 / 60 / 24);
for (int i = 0; i < daysSinceEpoch; i++) {
nextDay();
}
}
/**
Adds the given number of days to this Date.
@throws IllegalArgumentException if days < 0.
*/
public void addDays(int days) {
while (days > getDaysInYear()) {
days -= getDaysInYear();
year++;
}
for (int i = 1; i <= days; i++) {
nextDay();
}
}
/**
Returns whether o refers to a Date object representing the same
year, month, and day as this one.
*/
public boolean equals(Object o) {
Date other = (Date) o;
return day == other.day &&
month == other.month &&
year == other.year;
}
/**
Returns the day represented by this Date object.
@return the day, between 1 and the number of days in this Date\'s month
(which varies from 28 to 31)
*/
public int getDay() {
return day;
}
/** Returns the number of days in the month represented by the current Date. */
public int getDaysInMonth() {
int result = DAYS_PER_MONTH[month];
if (month == FEBRUARY && isLeapYear()) {
result++;
}
return result;
}
public int getDaysInYear() {
if (isLeapYear()) {
return 366;
} else {
return 365;
}
}
/**
Returns a string such as \"Monday\" representing what day of the week
this Date fell on.
@return the day as either \"Sunday\", \"Monday\", \"Tuesday, \"Wednesday\", \"Thursday\",
\"Friday\", or \"Satrday\"
*/
public String getDayOfWeek() {
int index = 1;
Date temp = new Date(1753, JANUARY, 1);
while (temp != this) {
temp.nextDay();
index = (index + 1) % DAYS_PER_WEEK;
}
return DAY_NAMES[index];
}
/**
Returns the month represented by this Date object.
@return the month, between 1 and 12
*/
public int getMonth() {
return month;
}
/**
Returns the yea.
Hi,I have implemented increment() method. Please find the below up.pdfAnkitchhabra28
Hi,
I have implemented increment() method. Please find the below updated code.
DaysBetween Class:
import java.text.DateFormatSymbols;
import java.util.Calendar;
import java.util.Scanner;
class DateClass {
protected int year;
protected int month;
protected int day;
public static final int MINYEAR = 1583;
// Constructor
public DateClass(int newMonth, int newDay, int newYear)
{
month = newMonth;
day = newDay;
year = newYear;
}
// Observers
public int getYear()
{
return year;
}
public int getMonth()
{
return month;
}
public int getDay()
{
return day;
}
public int lilian()
{
// Returns the Lilian Day Number of this date.
// Precondition: This Date is a valid date after 10/14/1582.
//
// Computes the number of days between 1/1/0 and this date as if no calendar
// reforms took place, then subtracts 578,100 so that October 15, 1582 is day 1.
final int subDays = 578100; // number of calculated days from 1/1/0 to 10/14/1582 November
17, 1858
int numDays;
// Add days in years.
numDays = year * 365;
// Add days in the months.
if (month <= 2)
numDays = numDays + (month - 1) * 31;
else
numDays = numDays + ((month - 1) * 31) - ((4 * (month-1) + 27) / 10);
// Add days in the days.
numDays = numDays + day;
// Take care of leap years.
numDays = numDays + (year / 4) - (year / 100) + (year / 400);
// Handle special case of leap year but not yet leap day.
if (month < 3)
{
if ((year % 4) == 0) numDays = numDays - 1;
if ((year % 100) == 0) numDays = numDays + 1;
if ((year % 400) == 0) numDays = numDays - 1;
}
// Subtract extra days up to 10/14/1582.
numDays = numDays - subDays;
return numDays;
}
Override
public String toString()
// Returns this date as a String.
{
String monthString = new DateFormatSymbols().getMonths()[month-1];
return(monthString + \"/\" + day + \"/\" + year);
}
public class mjd
{
public int mjd()
{
final int subDays = 678941;
int numDays;
numDays = year * 365;
if (month <= 2)
numDays = numDays + (month - 1) * 31;
else
numDays = numDays + ((month -1) * 31) - ((4 * (month-1) + 27)/10);
numDays = numDays + day;
numDays = numDays + (year / 4) - (year / 100) + (year / 400);
if (month < 3)
{
if ((year % 4) == 0) numDays = numDays -1;
if ((year % 100) == 0) numDays = numDays + 1;
if ((year % 400) == 0) numDays -= numDays -1;
}
// Days subtracted up to 10/14/1582
numDays = numDays - subDays;
return numDays;
}
}
public class djd
{
public int djd()
{
final int subDays = 693961; // number of calculated days from 1/1/0 to January 1,1900
int numDays;
// Add days in years.
numDays = year * 365;
// Add days in the months.
if (month <= 2)
numDays = numDays + (month - 1) * 31;
else
numDays = numDays + ((month - 1) * 31) - ((4 * (month-1) + 27) / 10);
// Add days in the days.
numDays = numDays + day;
// Take care of leap years.
numDays = numDays + (year / 4) - (year / 100) + (year / 400);
// Handle special case of leap year but not yet leap day.
if (month < 3)
{
if ((year % 4) == 0) numDays = numDays - 1;
if ((year % 100) == 0) numDays = numDays + 1;
if ((year % .
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.
Modify the Date class that was covered in the lecture which overload.pdfsaxenaavnish1
Modify the Date class that was covered in the lecture which overloaded the increment and stream
insertion operators.
The new version of the class should have the following overloaded operators:
(=) subtraction assignment operator :: subtracts the right operand from the left operand and
assigns the result to the left operand.
This operator should cause appropriate number of decrements to the object's 'day' member. It
also checks appropriate decrements to the 'month' and 'year' data members, if necessary.
(>>) cin 's stream extraction operator :: This operator should prompt the user for a date to be
stored in a Date object (you can specify your own format and prompt the user for the same).
Write a driver program and test the operators with the Date objects.
The program should have the following additional requirements:
The operator overloaded functions should be non-member functions.
Input validation (day, month) for the Date object.
The subtraction assignment operator (=) should work with end of month, end of year, and leap
year conditions as shown in the example output below.
Minimum three files (main.cpp, Date.h, Date.cpp). Submit your code as:
LastName_FirstName_Q2.zip (containing all files).
Example output:
Enter a date in format mm-dd-yyyy
01-01-2023
Date d1 is: January 1, 2023 // Check a valid date
Date (d1 -= 3) is: December 29, 2022 // Decrement by 3 days
Date d2 is: March 2, 2008
Date (d2-=2) is: February 29, 2008 // leap year has 29 days
Date.h
// Fig. 10.6: Date.h
// Date class definition with overloaded increment operators.
#ifndef DATE_H
#define DATE_H
#include
#include
class Date {
friend std::ostream& operator<<(std::ostream&, const Date&);
public:
Date(int m = 1, int d = 1, int y = 1900); // default constructor
void setDate(int, int, int); // set month, day, year
Date& operator++(); // prefix increment operator
Date operator++(int); // postfix increment operator
Date& operator+=(unsigned int); // add days, modify object
static bool leapYear(int); // is year a leap year?
bool endOfMonth(int) const; // is day at the end of month?
private:
unsigned int month;
unsigned int day;
unsigned int year;
static const std::array days; // days per month
void helpIncrement(); // utility function for incrementing date
};
#endif
Date.cpp
#include
#include
#include "Date.h"
using namespace std;
// initialize static member; one classwide copy
const array Date::days{
0, 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31};
// Date constructor
Date::Date(int month, int day, int year) {
setDate(month, day, year);
}
// set month, day and year
void Date::setDate(int mm, int dd, int yy) {
if (mm >= 1 && mm <= 12) {
month = mm;
}
else {
throw invalid_argument{"Month must be 1-12"};
}
if (yy >= 1900 && yy <= 2100) {
year = yy;
}
else {
throw invalid_argument{"Year must be >= 1900 and <= 2100"};
}
// test for a leap year
if ((month == 2 && leapYear(year) && dd >= 1 && dd <= 29) ||
(dd >= 1 && dd <= days[month])) {
day = dd;
}
else {
throw invalid_argument{
"Da.
Problem DefinitionBuild a Date class and a main function to test i.pdfsmitaguptabootique
Problem Definition
Build a Date class and a main function to test it.
Specifications
Below is the interface for the Date class: it is our \"contract\" with you: you have to implement
everything it describes, and show us that it works with a test harness that puts it through its
paces. The comments in the interface below should be sufficient for you to understand the
project (use these comments in your Date declaration), without the need of any further
documentation. But of course, as always, you can ask us any questions you may have on Piazza.
Note: Placing the error messages into the constructors like is not necessarily a good way to
handle constructor errors, but until you learn about exceptions in CS 14, it\'s the best we can do.
Private Member Functions
The functions declared private above, isLeap, daysPerMonth, name, number, are helper functions
- member functions that will never be needed by a user of the class, and so do not belong to the
public interface (which is why they are \"private\"). They are, however, needed by the interface
functions (public member functions), which use them to test the validity of arguments and
construct valid dates. For example, the constructor that passes in the month as a string will call
the number function to assign a value to the unsigned member variable month.
isLeap: The rule for whether a year is a leap year is:
(year % 4 == 0) implies leap year
except (year % 100 == 0) implies NOT leap year
except (year % 400 == 0) implies leap year
So, for instance, year 2000 is a leap year, but 1900 is NOT a leap year. Years 2004, 2008, 2012,
2016, etc. are all leap years. Years 2005, 2006, 2007, 2009, 2010, etc. are NOT leap years.
Output Specifications
Read the specifications for the print function carefully. The only cout statements within your
Date member functions should be:
the \"Invalid Date\" warnings in the constructors
in your two print functions
Required Main Function
You must use this main function and global function getDate as they are here. You may not
change these functions at all. Copy-and-paste these into your main.cpp file and then add the Date
class.
Solution
// Date.h
#include
#include
#include
#include
using namespace std;
class Date
{
private:
unsigned day;
unsigned month;
string monthName;
unsigned year;
public:
Date();
Date(unsigned m, unsigned d, unsigned y);
Date(const string &mn, unsigned d, unsigned y);
void printNumeric() const;
void printAlpha() const;
private:
bool isLeap(unsigned y) const;
unsigned daysPerMonth(unsigned m, unsigned y) const;
string name(unsigned m) const;
unsigned number(const string &mn) const;
};
//Date.cpp
#include
#include
#include
#include
using namespace std;
#include \"Date.h\"
// creates the date January 1st, 2000.
Date::Date()
{
day = 1;
month = 1;
monthName = \"January\";
year = 2000;
}
/* parameterized constructor: month number, day, year
- e.g. (3, 1, 2010) will construct the date March 1st, 2010
If any of the arguments are invalid (e.g. 15 for month o.
struct procedure { Date dateOfProcedure; int procedureID.pdfanonaeon
struct procedure
{
Date dateOfProcedure;
int procedureID;
int procedureProviderID;
};
Data.h
#include
#include
class Date
{
friend ostream& operator<<( ostream &, const Date & );
// allows easy output to a ostream
public:
Date( int m = 1, int d = 1, int y = 1900 ); // constructor, note the default values
void setDate( int, int, int ); // set the date const
Date &operator+=( int ); // add days, modify object
bool leapYear( int) const; // is this a leap year?
bool endOfMonth( int ) const; // is this end of month?
int getMonth ( ) const;
int getDay ( ) const;
int getYear ( ) const;
string getMonthString( ) const;
private:
int month;
int day;
int year;
static const int days[]; // array of days per month static const string monthName[]; // array of
month names
void helpIncrement();
// utility function
}; #endif Data.cpp // Member function definitions for Date
class in separate
date.cpp
#include
#include \"date.h\"
#include // Initialize static members at file scope; // one class-wide copy.
const int Date::days[] = { 0, 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 }; const string
Date::monthName[] = { \"January\", \"February\", \"March\", \"April\", \"May\", \"June\",
\"July\", \"August\", \"September\", \"October\", \"November\", \"December\" };
// Date constructor
Date::Date(int m, int d, int y)
{
setDate(m, d, y); } // Set the date
void Date::setDate(int mm, int dd, int yy)
{
month = (mm >= 1 && mm <= 12) ? mm : 1; year = (yy >=1900&& yy <= 2100) ? yy
: 1900; // test for a leap year
if (month == 2 && leapYear(year)) day = (dd >= 1 && dd <= 29) ? dd : 1;
else
day =(dd >= 1 && dd <= days[month]) ? dd : 1;
} // Add a specific number of days to a date
const Date &Date::operator+=(int additionalDays)
{
for (int i = 0; i < additionalDays; i++) helpIncrement();
return *this; // enables cascading
} // If the year is leap year, return true; //
otherwise, return false
bool Date::leapYear(int testYear)
const
{
if (testYear % 400 == 0 || (testYear %100 != 0 && testYear % 4 == 0)) return true; // a
leap year
else
return false; // not a leap year
} // Determine if the day is the end of the month
bool Date::endOfMonth(int testDay)
const
{
if (month == 2 && leapYear(year))
return (testDay == 29); // last day of Feb. in leap year
else
return (testDay == days[month]);
} // Function to help increment the date
void Date::helpIncrement()
{
if (!endOfMonth(day))
{
// date is not at the end of the month
day++;
}
else if (month < 12)
{
// date is at the end of the month, but month < 12 day = 1; ++month;
}
else
{
// end of month and year: last day of the year
day = 1;
month = 1;
++year;
} }
// Overloaded output operator
ostream &operator<<(ostream& output, const Date &d)
{
output << d.monthName[d.month] << \' \' << d.day << \", \"<< d.year;
return output; // enables cascading
}
int Date::getMonth() const //
{
Public:
int month[20];
If(month[]!=”/0”)
Cout<<”Enter Month :-<>month;
Elseif (month[]<12)
{
Cout<>month[];
else
return month;
}
int Date::getDay() const //
{
Pu.
Write a program to generate the entire calendar for one year. The pr.pdfarihantmobileselepun
Write a program to generate the entire calendar for one year. The program must get two values
from the user: (1) the year and (2) the day of the week for January 1st of that year. The year,
which should be positive, is needed to check for and handle leap years1. The day of the week for
January 1st is needed so that you know where to start the calendar. The user should enter 0 for
Sunday, 1 for Monday, ... or 6 for Saturday. As always, you need to validate the user\'s input. To
actually print the calendar, you must use a single method that prints out the calendar for one
month and then call this function 12 times from main(), once for each month in the year. To
check for a leap year you will need to write another method that takes the year as a parameter
and returns true if it’s a leap year, or false otherwise. Stubs (i.e. method signatures without any
code) for both of these methods have been provided for you.
The calendar should be printed in the form below. In this example, January starts on a Saturday
(day 6). Note that February starts on a Tuesday in this example because January ended on a
Monday.
January
1
2 3 4 5 6 7 8
9 10 11 12 13 14 15
16 17 18 19 20 21 22
23 24 25 26 27 2829
30 31
February
1 2 3 4 5
6 7 8 9 10 11 12 ...
The format he gave us is as follows:
public class PA6a {
/**
* Error to output if year is not positive
*/
static final String E_YEAR = \"The year must be positive!\";
/**
* Error to output if the day is not between 0 and 6
*/
static final String E_DAY = \"The day of January 1st must be between 0 and 6!\";
/**
* Determines if an input is a leap year
*
* @param year year in question
* @ereturn true if a leap year
*/
public static boolean isLeapYear(int year) {
return false; // TODO: replace with your code
}
/**
* Outputs a month to the console
*
* @param month title
* @param startDay 0=Sunday ... 6=Saturday
* @param numDays number of days in the month
* @return day of the week of the last day of the month
*/
public static int printMonth(String month, int startDay, int numDays) {
return 0; // TODO: replace with your code
}
/**
* Program execution point:
* input year, day of the week (0-6) of january 1
* output calendar for that year
*
* @param args command-line arguments (ignored)
*/
public static void main(String[] args) {
// TODO: write your code here
}
I am confused especially with the print month method, help is greatly appreciated.
Solution
package org.students;
import java.util.Scanner;
import com.sun.org.apache.bcel.internal.generic.IUSHR;
public class Calander {
//declaring static variables
static final String E_YEAR = \"The year must be positive!\";
static final String E_DAY = \"The day of January 1st must be between 0 and 6!\";
public static void main(String[] args) {
//Declaring variables
int getFirstDay;
int year;
Scanner scanner = new Scanner(System.in);
//This while loop continue to execute until user enters valid year
while (true) {
//Getting the year entered by the user
System.out.print(\"Enter the year:.
@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.
Please I am posting the fifth time and hoping to get this r.pdfankit11134
"Please I am posting the fifth time and hoping to get this resolved. I want the year to
change from 2014 to 2015 but the days of the month change to 32 rather than 1/1/2015.
Also, Please I want personal information in the heading as well Name: Last: and Course
Name:"
Modify the Time class(attached) to be able to work with Date class. The Time object should
always
remain in a consistent state.
Modify the Date class(attached) to include a Time class object as a composition, a tick member
function that increments the time stored in a Date object by one second, and increaseADay
function to
increase day, month and year when it is proper. Please use CISP400V10A4.cpp that tests the tick
member function in a loop that prints the time in standard format during iteration of the loop to
illustrate that the tick member function works correctly. Be aware that we are testing the following
cases:
a) Incrementing into the next minute.
b) Incrementing into the next hour.
c) Incrementing into the next day (i.e., 11:59:59 PM to 12:00:00 AM).
d) Incrementing into the next month and next year.
Time class
The Time class has three private integer data members, hour (0 - 23 (24-hour clock format)),
minute (0
59), and second (0 59).
It also has Time, setTime, setHour, setMinute, setSecond, getHour(), getMinute,
getSecond,~Time,
printUniversal, and printStandard public functions.
1. The Time function is a default constructor. It takes three integers and they all have 0 as default
values. It also displays "Time object constructor is called." message and calls
printStandard
and printUniversal functions.
2. The setTime function takes three integers but does not return any value. It initializes the
private data members (hour, minute and second) data.
3. The setHour function takes one integer but doesnt return anything. It validates and stores the
integer to the hour private data member.
4. The setMinute function takes one integer but doesnt return anything. It validates and stores
the integer to the minute private data member.
5. The setSecond function takes one integer but doesnt return anything. It validates and stores
the integer to the second private data member.
Page 3 of 11 CISP400V10A4
6. The getHour constant function returns one integer but doesnt take anything. It returns the
private data member hours data.
7. The getMinute constant function returns one integer but doesnt take anything. It returns the
private data member minutes data.
8. The getSecond constant function returns one integer but doesnt take anything. It returns the
private data member seconds data.
9. The Time destructor does not take anything. It displays "Time object destructor is
called."
message and calls printStandard and printUniversal functions.
10. The printUniversal constant function does not return or accept anything. It displays time in
universal-time format.
11. The printStandard constant function does not return or accept anything. It displays time in
standard-time f.
C++ Please I am posting the fifth time and hoping to get th.pdfjaipur2
C++
"Please I am posting the fifth time and hoping to get this resolved. I want the year to
change from 2014 to 2015 but the days of the month change to 32 rather than 1/1/2015.
Also, Please I want personal information in the heading as well Name: Last: and Course
Name:"
Modify the Time class(attached) to be able to work with Date class. The Time object should
always
remain in a consistent state.
Modify the Date class(attached) to include a Time class object as a composition, a tick member
function that increments the time stored in a Date object by one second, and increaseADay
function to
increase day, month and year when it is proper. Please use CISP400V10A4.cpp that tests the tick
member function in a loop that prints the time in standard format during iteration of the loop to
illustrate that the tick member function works correctly. Be aware that we are testing the following
cases:
a) Incrementing into the next minute.
b) Incrementing into the next hour.
c) Incrementing into the next day (i.e., 11:59:59 PM to 12:00:00 AM).
d) Incrementing into the next month and next year.
Time class
The Time class has three private integer data members, hour (0 - 23 (24-hour clock format)),
minute (0
59), and second (0 59).
It also has Time, setTime, setHour, setMinute, setSecond, getHour(), getMinute,
getSecond,~Time,
printUniversal, and printStandard public functions.
1. The Time function is a default constructor. It takes three integers and they all have 0 as default
values. It also displays "Time object constructor is called." message and calls
printStandard
and printUniversal functions.
2. The setTime function takes three integers but does not return any value. It initializes the
private data members (hour, minute and second) data.
3. The setHour function takes one integer but doesnt return anything. It validates and stores the
integer to the hour private data member.
4. The setMinute function takes one integer but doesnt return anything. It validates and stores
the integer to the minute private data member.
5. The setSecond function takes one integer but doesnt return anything. It validates and stores
the integer to the second private data member.
Page 3 of 11 CISP400V10A4
6. The getHour constant function returns one integer but doesnt take anything. It returns the
private data member hours data.
7. The getMinute constant function returns one integer but doesnt take anything. It returns the
private data member minutes data.
8. The getSecond constant function returns one integer but doesnt take anything. It returns the
private data member seconds data.
9. The Time destructor does not take anything. It displays "Time object destructor is
called."
message and calls printStandard and printUniversal functions.
10. The printUniversal constant function does not return or accept anything. It displays time in
universal-time format.
11. The printStandard constant function does not return or accept anything. It displays time in
standard-ti.
Need to make a Java program which calculates the number of days betw.pdfanjandavid
Need to make a Java program which calculates the number of days between two dates. I am NOT
able to use anything too advanced yet such as import.java.util.Calender, import.java.util.Date; or
import.java.util.GregorianCalender; Here are a couple of examples of what is should look like
when complete. I am having troubles getting my calculations to come out correctly. I’ve also
written the code I have so far.
EXAMPLE
“Enter first date now:
Enter Month: 1
Enter Day: 1
Enter Year: 1900
Enter the second date:
Enter Month: 1
Enter Day: 1
Enter Year: 2400
The first date is: 1/1/1900
The other date is: 1/1/2400
The total number of days between the dates is 182621”
AND
“Enter first date now:
Enter Month: 2
Enter Day: 23
Enter Year: 2016
Enter the second date:
Enter Month: 11
Enter Day: 30
Enter Year: 1955
The first date is: 2/23/2016
The other date is: 11/30/1955
The total number of days between the dates is 22000”
Here is what I have so far:
Import java.util.Scanner;
Public class dates {
Public static void main ( String args [] ) {
int monthOne;
int monthTwo;
int dayOne;
int dayTwo;
intyearOne;
intyearTwo;
Scanner get = new Scanner (System.in );
System.out.println ( “Enter first date now: “ );
do {
System.out.print ( “Enter Month: “);
monthOne = get.nextInt();
System.out.print ( “Enter Day: “ );
dayOne = get.nextInt();
System.out.print ( “Enter Year : “ );
yearOne = get.nextInt();
if (monthOne < 1 || monthOne > 12 ) {
System.out.printf ( “%d is not a valid month\ ”, monthOne ); }
If ( (!(yearOne % 4 == 0 && yearOne & 100 !=0 || yearOne % 400 == 0) && (monthOne == 2
&& dayOne >= 29)) || ((yearOne % 4 == 0 && yearOne % 100 != 0 || yearOne % 400 == 0) &&
(monthOne == 2 && dayOne >= 30))) {
System.out.printf ( “%d is not a valid day.\ ”, dayOne ); }
If ( (monthOne == 4 && dayOne > 30) || (monthOne ==6 && dayOne > 30) || (monthOne == 9
&& dayOne > 30) || (monthOne == 11 && dayOne > 30) || (dayOne < 1 || dayOne > 31)) {
System.out.printf ( “%d is not a valid day.\ ”, dayOne );
If ( yearOne < 1900 || yearOne > 2400 ) {
System.out.printf ( “%d is not a valid year.\ ”, yearOne ); }
} while (( (!(yearOne % 4 == 0 && yearOne % 100 !=0 || yearOne % 400 == 0) && (monthOne
== 2 && dayOne >= 29)) || ((yearOne % 4 == 0 && yearOne % 100 != 0 || yearOne % 400 ==
0) && (monthOne == 2 && dayOne >= 30 )) || (monthOne == 4 && dayOne > 30) || (monthOne
== 6 && dayOne > 30) || (monthOne == 9 && dayOne > 30) || (monthOne == 11 && dayOne >
30) || (monthOne < 1 || monthOne > 12) || (dayOne < 1 || dayOne > 31) || (yearOne < 1900 ||
yearOne > 2400) ));
System.out.printf ( “\ Enter the second date: \ ” );
do {
System.out.print ( “Enter Month: “);
monthTwo = get.nextInt();
System.out.print ( “Enter Day: “ );
dayTwo = get.nextInt();
System.out.print ( “Enter Year : “ );
yearTwo = get.nextInt();
if (monthTwo < 1 || monthTwo > 12 ) {
System.out.printf ( “%d is not a valid month\ ”, monthTwo ); }
If ( (!(yearTwo % 4 == 0 && yearTwo & 100 !=0 || yearTwo % 400 == 0) && (monthTwo == 2
&& .
In this assignment, you will continue working on your application..docxjaggernaoma
In this assignment, you will continue working on your application. In Week 4, you used 2 arrays to represent the list of products and their quantities. Memory needs were determined before program execution. This week, you will use dynamic allocation so the memory needs are determined during runtime. The functionality of the program is not expected to change. You may use the sample code
as the template.
Create a new C++ empty project titled "CS115_IP5_YourName" in the IDE.
For the quantities, use a pointer to the first item of an array of int. An example of the declaration code may look like the following:
For the products, use an array of pointers to strings, and dynamically allocate space for each of the strings. An example of the declaration code may look like the following:
To fill in the products array, read one product name from the user, check the length, and then allocate memory based on the length of the entered word. The following code is provided as an example:
Use the previous structure to provide the same functionality that was provided in Week 4.
Complete the following in your code:
Provide a list of available products
Ask the customer to select products and quantities
Save the provided details in the new data structure
Read from the arrays to print the order summary; that is, the products, quantities, and the total price for each product
Calculate and print the total price for the order
Release the allocated memory
Compile and run the application to demonstrate a working program.
Insert the screenshots into a Word document, and add a short explanation on each screenshot.
Finally, save your Word document as “yourname_IP4.docx”. Click the “Edit” button on this submission node to submit the saved document.
// Use of Classes and dynamic allocation
#include <iostream>
using namespace std;
// Employee class definition
class Employee
{
private:
string empName;
string empAddress;
string empEmail;
int vacationMonths;
int * empVacationDays; // hold vacation days taken for every month
public:
void setEmpName(string);
string getEmpName();
void setEmpAddress(string);
string getEmpAddress();
void setEmpEmail(string);
string getEmpEmail();
void setEmpVacationDays(int, int); // sets vacation days for a specific month
int getEmpVacationDays(int); //gets vacation days taken in a specific month
int getTotalEmpVacationDays(); //gets the total vacation days
// Constructor
Employee();
Employee(int); // this constructor sets up the size of the emplyee vacation array
// Destructor
~Employee();
};
//definition of set/get member functions of Employee class
void Employee::setEmpName(string name)
{
empName=name;
}
void Employee::setEmpAddress(string address)
{
empAddress=address;
}
void Employee::setEmpVacationDays(int month, int vDays)
{
empVacationDays[month-1]=vDays;
}
void Employee::setEmpEmail(string email)
{
empEmail=email;
}
string Employee::g.
Presented at ACCU Oxford (14th September 2015)
Functional C++? As opposed to what — dysfunctional? Well, kind of, yeah. Sure, in C++ the principal unit of composition is called a function, but that doesn't mean it's a functional language. And the idea of restricting mutability of state gets a nod with const, but it's a nod not a hug. And the STL shows influences of functional programming, although it falls short of being compositional. And, yes, sure, C++11 has lambdas, but then again, these days, who doesn't? Lambda calculus was invented in the 1930s.
This talk looks at how to express functional programming ideas in (post)modern C++ in a way that can be considered idiomatic to C++, rather than trying to use the power of overloading and meta-programming to pretend C++ is Haskell or Lisp. In short, immutability beyond const and into shared and persistent data structures, concurrency beyond threading and locks, and thinking about functions as transformations and units of composition rather than actions.
DO NOT use System.exit().DO NOT add the project or package stateme.pdfinfo48697
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.
Write a program to generate the entire calendar for one year. The pr.pdfarihantmobileselepun
Write a program to generate the entire calendar for one year. The program must get two values
from the user: (1) the year and (2) the day of the week for January 1st of that year. The year,
which should be positive, is needed to check for and handle leap years1. The day of the week for
January 1st is needed so that you know where to start the calendar. The user should enter 0 for
Sunday, 1 for Monday, ... or 6 for Saturday. As always, you need to validate the user\'s input. To
actually print the calendar, you must use a single method that prints out the calendar for one
month and then call this function 12 times from main(), once for each month in the year. To
check for a leap year you will need to write another method that takes the year as a parameter
and returns true if it’s a leap year, or false otherwise. Stubs (i.e. method signatures without any
code) for both of these methods have been provided for you.
The calendar should be printed in the form below. In this example, January starts on a Saturday
(day 6). Note that February starts on a Tuesday in this example because January ended on a
Monday.
January
1
2 3 4 5 6 7 8
9 10 11 12 13 14 15
16 17 18 19 20 21 22
23 24 25 26 27 2829
30 31
February
1 2 3 4 5
6 7 8 9 10 11 12 ...
The format he gave us is as follows:
public class PA6a {
/**
* Error to output if year is not positive
*/
static final String E_YEAR = \"The year must be positive!\";
/**
* Error to output if the day is not between 0 and 6
*/
static final String E_DAY = \"The day of January 1st must be between 0 and 6!\";
/**
* Determines if an input is a leap year
*
* @param year year in question
* @ereturn true if a leap year
*/
public static boolean isLeapYear(int year) {
return false; // TODO: replace with your code
}
/**
* Outputs a month to the console
*
* @param month title
* @param startDay 0=Sunday ... 6=Saturday
* @param numDays number of days in the month
* @return day of the week of the last day of the month
*/
public static int printMonth(String month, int startDay, int numDays) {
return 0; // TODO: replace with your code
}
/**
* Program execution point:
* input year, day of the week (0-6) of january 1
* output calendar for that year
*
* @param args command-line arguments (ignored)
*/
public static void main(String[] args) {
// TODO: write your code here
}
I am confused especially with the print month method, help is greatly appreciated.
Solution
package org.students;
import java.util.Scanner;
import com.sun.org.apache.bcel.internal.generic.IUSHR;
public class Calander {
//declaring static variables
static final String E_YEAR = \"The year must be positive!\";
static final String E_DAY = \"The day of January 1st must be between 0 and 6!\";
public static void main(String[] args) {
//Declaring variables
int getFirstDay;
int year;
Scanner scanner = new Scanner(System.in);
//This while loop continue to execute until user enters valid year
while (true) {
//Getting the year entered by the user
System.out.print(\"Enter the year:.
@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.
Please I am posting the fifth time and hoping to get this r.pdfankit11134
"Please I am posting the fifth time and hoping to get this resolved. I want the year to
change from 2014 to 2015 but the days of the month change to 32 rather than 1/1/2015.
Also, Please I want personal information in the heading as well Name: Last: and Course
Name:"
Modify the Time class(attached) to be able to work with Date class. The Time object should
always
remain in a consistent state.
Modify the Date class(attached) to include a Time class object as a composition, a tick member
function that increments the time stored in a Date object by one second, and increaseADay
function to
increase day, month and year when it is proper. Please use CISP400V10A4.cpp that tests the tick
member function in a loop that prints the time in standard format during iteration of the loop to
illustrate that the tick member function works correctly. Be aware that we are testing the following
cases:
a) Incrementing into the next minute.
b) Incrementing into the next hour.
c) Incrementing into the next day (i.e., 11:59:59 PM to 12:00:00 AM).
d) Incrementing into the next month and next year.
Time class
The Time class has three private integer data members, hour (0 - 23 (24-hour clock format)),
minute (0
59), and second (0 59).
It also has Time, setTime, setHour, setMinute, setSecond, getHour(), getMinute,
getSecond,~Time,
printUniversal, and printStandard public functions.
1. The Time function is a default constructor. It takes three integers and they all have 0 as default
values. It also displays "Time object constructor is called." message and calls
printStandard
and printUniversal functions.
2. The setTime function takes three integers but does not return any value. It initializes the
private data members (hour, minute and second) data.
3. The setHour function takes one integer but doesnt return anything. It validates and stores the
integer to the hour private data member.
4. The setMinute function takes one integer but doesnt return anything. It validates and stores
the integer to the minute private data member.
5. The setSecond function takes one integer but doesnt return anything. It validates and stores
the integer to the second private data member.
Page 3 of 11 CISP400V10A4
6. The getHour constant function returns one integer but doesnt take anything. It returns the
private data member hours data.
7. The getMinute constant function returns one integer but doesnt take anything. It returns the
private data member minutes data.
8. The getSecond constant function returns one integer but doesnt take anything. It returns the
private data member seconds data.
9. The Time destructor does not take anything. It displays "Time object destructor is
called."
message and calls printStandard and printUniversal functions.
10. The printUniversal constant function does not return or accept anything. It displays time in
universal-time format.
11. The printStandard constant function does not return or accept anything. It displays time in
standard-time f.
C++ Please I am posting the fifth time and hoping to get th.pdfjaipur2
C++
"Please I am posting the fifth time and hoping to get this resolved. I want the year to
change from 2014 to 2015 but the days of the month change to 32 rather than 1/1/2015.
Also, Please I want personal information in the heading as well Name: Last: and Course
Name:"
Modify the Time class(attached) to be able to work with Date class. The Time object should
always
remain in a consistent state.
Modify the Date class(attached) to include a Time class object as a composition, a tick member
function that increments the time stored in a Date object by one second, and increaseADay
function to
increase day, month and year when it is proper. Please use CISP400V10A4.cpp that tests the tick
member function in a loop that prints the time in standard format during iteration of the loop to
illustrate that the tick member function works correctly. Be aware that we are testing the following
cases:
a) Incrementing into the next minute.
b) Incrementing into the next hour.
c) Incrementing into the next day (i.e., 11:59:59 PM to 12:00:00 AM).
d) Incrementing into the next month and next year.
Time class
The Time class has three private integer data members, hour (0 - 23 (24-hour clock format)),
minute (0
59), and second (0 59).
It also has Time, setTime, setHour, setMinute, setSecond, getHour(), getMinute,
getSecond,~Time,
printUniversal, and printStandard public functions.
1. The Time function is a default constructor. It takes three integers and they all have 0 as default
values. It also displays "Time object constructor is called." message and calls
printStandard
and printUniversal functions.
2. The setTime function takes three integers but does not return any value. It initializes the
private data members (hour, minute and second) data.
3. The setHour function takes one integer but doesnt return anything. It validates and stores the
integer to the hour private data member.
4. The setMinute function takes one integer but doesnt return anything. It validates and stores
the integer to the minute private data member.
5. The setSecond function takes one integer but doesnt return anything. It validates and stores
the integer to the second private data member.
Page 3 of 11 CISP400V10A4
6. The getHour constant function returns one integer but doesnt take anything. It returns the
private data member hours data.
7. The getMinute constant function returns one integer but doesnt take anything. It returns the
private data member minutes data.
8. The getSecond constant function returns one integer but doesnt take anything. It returns the
private data member seconds data.
9. The Time destructor does not take anything. It displays "Time object destructor is
called."
message and calls printStandard and printUniversal functions.
10. The printUniversal constant function does not return or accept anything. It displays time in
universal-time format.
11. The printStandard constant function does not return or accept anything. It displays time in
standard-ti.
Need to make a Java program which calculates the number of days betw.pdfanjandavid
Need to make a Java program which calculates the number of days between two dates. I am NOT
able to use anything too advanced yet such as import.java.util.Calender, import.java.util.Date; or
import.java.util.GregorianCalender; Here are a couple of examples of what is should look like
when complete. I am having troubles getting my calculations to come out correctly. I’ve also
written the code I have so far.
EXAMPLE
“Enter first date now:
Enter Month: 1
Enter Day: 1
Enter Year: 1900
Enter the second date:
Enter Month: 1
Enter Day: 1
Enter Year: 2400
The first date is: 1/1/1900
The other date is: 1/1/2400
The total number of days between the dates is 182621”
AND
“Enter first date now:
Enter Month: 2
Enter Day: 23
Enter Year: 2016
Enter the second date:
Enter Month: 11
Enter Day: 30
Enter Year: 1955
The first date is: 2/23/2016
The other date is: 11/30/1955
The total number of days between the dates is 22000”
Here is what I have so far:
Import java.util.Scanner;
Public class dates {
Public static void main ( String args [] ) {
int monthOne;
int monthTwo;
int dayOne;
int dayTwo;
intyearOne;
intyearTwo;
Scanner get = new Scanner (System.in );
System.out.println ( “Enter first date now: “ );
do {
System.out.print ( “Enter Month: “);
monthOne = get.nextInt();
System.out.print ( “Enter Day: “ );
dayOne = get.nextInt();
System.out.print ( “Enter Year : “ );
yearOne = get.nextInt();
if (monthOne < 1 || monthOne > 12 ) {
System.out.printf ( “%d is not a valid month\ ”, monthOne ); }
If ( (!(yearOne % 4 == 0 && yearOne & 100 !=0 || yearOne % 400 == 0) && (monthOne == 2
&& dayOne >= 29)) || ((yearOne % 4 == 0 && yearOne % 100 != 0 || yearOne % 400 == 0) &&
(monthOne == 2 && dayOne >= 30))) {
System.out.printf ( “%d is not a valid day.\ ”, dayOne ); }
If ( (monthOne == 4 && dayOne > 30) || (monthOne ==6 && dayOne > 30) || (monthOne == 9
&& dayOne > 30) || (monthOne == 11 && dayOne > 30) || (dayOne < 1 || dayOne > 31)) {
System.out.printf ( “%d is not a valid day.\ ”, dayOne );
If ( yearOne < 1900 || yearOne > 2400 ) {
System.out.printf ( “%d is not a valid year.\ ”, yearOne ); }
} while (( (!(yearOne % 4 == 0 && yearOne % 100 !=0 || yearOne % 400 == 0) && (monthOne
== 2 && dayOne >= 29)) || ((yearOne % 4 == 0 && yearOne % 100 != 0 || yearOne % 400 ==
0) && (monthOne == 2 && dayOne >= 30 )) || (monthOne == 4 && dayOne > 30) || (monthOne
== 6 && dayOne > 30) || (monthOne == 9 && dayOne > 30) || (monthOne == 11 && dayOne >
30) || (monthOne < 1 || monthOne > 12) || (dayOne < 1 || dayOne > 31) || (yearOne < 1900 ||
yearOne > 2400) ));
System.out.printf ( “\ Enter the second date: \ ” );
do {
System.out.print ( “Enter Month: “);
monthTwo = get.nextInt();
System.out.print ( “Enter Day: “ );
dayTwo = get.nextInt();
System.out.print ( “Enter Year : “ );
yearTwo = get.nextInt();
if (monthTwo < 1 || monthTwo > 12 ) {
System.out.printf ( “%d is not a valid month\ ”, monthTwo ); }
If ( (!(yearTwo % 4 == 0 && yearTwo & 100 !=0 || yearTwo % 400 == 0) && (monthTwo == 2
&& .
In this assignment, you will continue working on your application..docxjaggernaoma
In this assignment, you will continue working on your application. In Week 4, you used 2 arrays to represent the list of products and their quantities. Memory needs were determined before program execution. This week, you will use dynamic allocation so the memory needs are determined during runtime. The functionality of the program is not expected to change. You may use the sample code
as the template.
Create a new C++ empty project titled "CS115_IP5_YourName" in the IDE.
For the quantities, use a pointer to the first item of an array of int. An example of the declaration code may look like the following:
For the products, use an array of pointers to strings, and dynamically allocate space for each of the strings. An example of the declaration code may look like the following:
To fill in the products array, read one product name from the user, check the length, and then allocate memory based on the length of the entered word. The following code is provided as an example:
Use the previous structure to provide the same functionality that was provided in Week 4.
Complete the following in your code:
Provide a list of available products
Ask the customer to select products and quantities
Save the provided details in the new data structure
Read from the arrays to print the order summary; that is, the products, quantities, and the total price for each product
Calculate and print the total price for the order
Release the allocated memory
Compile and run the application to demonstrate a working program.
Insert the screenshots into a Word document, and add a short explanation on each screenshot.
Finally, save your Word document as “yourname_IP4.docx”. Click the “Edit” button on this submission node to submit the saved document.
// Use of Classes and dynamic allocation
#include <iostream>
using namespace std;
// Employee class definition
class Employee
{
private:
string empName;
string empAddress;
string empEmail;
int vacationMonths;
int * empVacationDays; // hold vacation days taken for every month
public:
void setEmpName(string);
string getEmpName();
void setEmpAddress(string);
string getEmpAddress();
void setEmpEmail(string);
string getEmpEmail();
void setEmpVacationDays(int, int); // sets vacation days for a specific month
int getEmpVacationDays(int); //gets vacation days taken in a specific month
int getTotalEmpVacationDays(); //gets the total vacation days
// Constructor
Employee();
Employee(int); // this constructor sets up the size of the emplyee vacation array
// Destructor
~Employee();
};
//definition of set/get member functions of Employee class
void Employee::setEmpName(string name)
{
empName=name;
}
void Employee::setEmpAddress(string address)
{
empAddress=address;
}
void Employee::setEmpVacationDays(int month, int vDays)
{
empVacationDays[month-1]=vDays;
}
void Employee::setEmpEmail(string email)
{
empEmail=email;
}
string Employee::g.
Presented at ACCU Oxford (14th September 2015)
Functional C++? As opposed to what — dysfunctional? Well, kind of, yeah. Sure, in C++ the principal unit of composition is called a function, but that doesn't mean it's a functional language. And the idea of restricting mutability of state gets a nod with const, but it's a nod not a hug. And the STL shows influences of functional programming, although it falls short of being compositional. And, yes, sure, C++11 has lambdas, but then again, these days, who doesn't? Lambda calculus was invented in the 1930s.
This talk looks at how to express functional programming ideas in (post)modern C++ in a way that can be considered idiomatic to C++, rather than trying to use the power of overloading and meta-programming to pretend C++ is Haskell or Lisp. In short, immutability beyond const and into shared and persistent data structures, concurrency beyond threading and locks, and thinking about functions as transformations and units of composition rather than actions.
DO NOT use System.exit().DO NOT add the project or package stateme.pdfinfo48697
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.
Let us assume the conc of Ba(OH)2 is known to us .pdfmukhtaransarcloth
Let us assume the conc of Ba(OH)2 is known to us and initially we have known
amount of Ba(OH)2 in the flask which is completely dissociated in form of Ba2+ and OH- ions.
Now H2SO4 is added. H2SO4 dissociates to form H+ and SO42- ions. H+ and OH- ions form
water while Ba2+ and SO42- form insoluble BaSO4 when enough H2SO4 is added to consume
the Ba(OH)2 completely the conductance of the analyte which is being monitored continuosly
shows a sharp decrease and is at its lowest point. at this point H2SO4 addition is stopped and
titration ends. Now you know the molarity of Ba(OH)2 ...(M1) volume of Ba(OH)2 taken
initially ...(V1) and volume of H2SO4 consumed ...(V2) use M1V1 = M2V2 only unknown M2
which is molarity of H2SO4 can be calculated !!
Solution
Let us assume the conc of Ba(OH)2 is known to us and initially we have known
amount of Ba(OH)2 in the flask which is completely dissociated in form of Ba2+ and OH- ions.
Now H2SO4 is added. H2SO4 dissociates to form H+ and SO42- ions. H+ and OH- ions form
water while Ba2+ and SO42- form insoluble BaSO4 when enough H2SO4 is added to consume
the Ba(OH)2 completely the conductance of the analyte which is being monitored continuosly
shows a sharp decrease and is at its lowest point. at this point H2SO4 addition is stopped and
titration ends. Now you know the molarity of Ba(OH)2 ...(M1) volume of Ba(OH)2 taken
initially ...(V1) and volume of H2SO4 consumed ...(V2) use M1V1 = M2V2 only unknown M2
which is molarity of H2SO4 can be calculated !!.
Methods a, b, c, and e are formal additions of H2.pdfmukhtaransarcloth
Methods a, b, c, and e are formal additions of H2O or OH to the double bond, so no
carbonyl compound. Method d splits molecule by the double bond and usually produces two
carbonyl compounds (one in a few cases). So it\'s d)
Solution
Methods a, b, c, and e are formal additions of H2O or OH to the double bond, so no
carbonyl compound. Method d splits molecule by the double bond and usually produces two
carbonyl compounds (one in a few cases). So it\'s d).
h2s4 structure is H-S-S-S-S-H there for two middl.pdfmukhtaransarcloth
h2s4 structure is H-S-S-S-S-H there for two middle two s atoms are in 0 oxidation
state and and sidd s atoms have -1 oxidation state
Solution
h2s4 structure is H-S-S-S-S-H there for two middle two s atoms are in 0 oxidation
state and and sidd s atoms have -1 oxidation state.
We are currently living in the so-called information age which can b.pdfmukhtaransarcloth
We are currently living in the so-called information age which can be described as an era were
economic activities are mainly information based (an age of informationalization). This is due to
the development and use of technology. The main characteristics of this era can be summarized
as a rise in the number of knowledge workers, a world that has become more open - in the sense
of communication (global village/Gutenberg galaxy) and internationalization (trans-border flow
of data).
This paradigm shift brings new ethical and juridical problems which are mainly related to issues
such as the right of access to information, the right of privacy which is threatened by the
emphasis on the free flow of information, and the protection of the economic interest of the
owners of intellectual property.
In this paper the ethical questions related to the right to privacy of the individual which is
threatened by the use of technology will be discussed. Specific attention will be given to the
challenges these ethical problems pose to the information professional. A number of practical
guidelines, based on ethical norms will be laid down.
Definition of Privacy
Privacy can be defined as an individual condition of life characterized by exclusion from
publicity (Neetling et al., 1996, p. 36). The concept follows from the right to be left alone (Stair,
1992, p. 635; Shank, 1986, p. 12)1 . Shank (1986, p. 13) states that such a perception of privacy
set the course for passing of privacy laws in the United States for the ninety years that followed.
As such privacy could be regarded as a natural right which provides the foundation for the legal
right. The right to privacy is therefore protected under private law.
The legal right to privacy is constitutionally protected in most democratic societies. This
constitutional right is expressed in a variety of legislative forms. Examples include the Privacy
Act (1974) in the USA, the proposed Open Democracy Act in South Africa (1996) and the Data
Protection Act in England. During 1994 Australia also accepted a Privacy Charter containing 18
privacy principles which describe the right of a citizen concerning personal privacy as effected
by handling of information by the state (Collier, 1994, p. 44-45). The Organization for Economic
and Coordination and Development (OECD) also accepted in 1980 the Guidelines for the
Protection of Privacy and Transborder Flow of Personal Data (Collier, 1994, p. 41).
Privacy is an important right because it is a necessary condition for other rights such as freedom
and personal autonomy. There is thus a relationship between privacy, freedom and human
dignity. Respecting a person\'s privacy is to acknowledge such a person\'s right to freedom and to
recognize that individual as an autonomous human being.
Private communications. This category of privacy concerns all forms of personal communication
which a person wishes to keep private. The information exchanged during a reference interview
between t.
Tay-Sachs disease is caused by a mutation (abnormal change) in the g.pdfmukhtaransarcloth
Tay-Sachs disease is caused by a mutation (abnormal change) in the gene that codes for Hex-A,
and it is a recessive trait. This means that people will have the disease if they have two copies of
the defective gene, but they will not have the disease if they have at least one unaffected copy.
People with one normal copy and one defective copy are called carriers, because they can pass
the disease on to their children.
Seizures are sudden altacks of disease, often referring to some type of violent spasms.
Just about anyone can be a carrier of the gene for Tay-Sachs disease. In the general population,
about 1 in 250 people carries the gene.
People inherit Tay-Sachs disease when they inherit a defective gene from both parents, resulting
in two defective genes that make the body unable to produce Hex-A correctly. People who have
only one defective gene are called carriers. Carriers do not have the disease, because they have
inherited one healthy gene to code for Hex-A, but they may pass the defective gene on to their
children. If both parents are carriers, each child born to them has a 1 in 4 liklihood of having the
disease.
However, some populations of people include more carriers than others. For example, 1 in 27
people of eastern European Jewish (Ashkenazi) descent in the United States is a carrier. People
of French-Canadian ancestry from one part of Quebec and the Cajunpopulation in Louisiana also
have a higher than usual risk of carrying the Tay-Sachs gene.
Solution
Tay-Sachs disease is caused by a mutation (abnormal change) in the gene that codes for Hex-A,
and it is a recessive trait. This means that people will have the disease if they have two copies of
the defective gene, but they will not have the disease if they have at least one unaffected copy.
People with one normal copy and one defective copy are called carriers, because they can pass
the disease on to their children.
Seizures are sudden altacks of disease, often referring to some type of violent spasms.
Just about anyone can be a carrier of the gene for Tay-Sachs disease. In the general population,
about 1 in 250 people carries the gene.
People inherit Tay-Sachs disease when they inherit a defective gene from both parents, resulting
in two defective genes that make the body unable to produce Hex-A correctly. People who have
only one defective gene are called carriers. Carriers do not have the disease, because they have
inherited one healthy gene to code for Hex-A, but they may pass the defective gene on to their
children. If both parents are carriers, each child born to them has a 1 in 4 liklihood of having the
disease.
However, some populations of people include more carriers than others. For example, 1 in 27
people of eastern European Jewish (Ashkenazi) descent in the United States is a carrier. People
of French-Canadian ancestry from one part of Quebec and the Cajunpopulation in Louisiana also
have a higher than usual risk of carrying the Tay-Sachs gene..
E.) is less acidic in other A ,B triple bond an.pdfmukhtaransarcloth
E.) is less acidic in other A ,B triple bond and double bond are responsible for
acidity In C,D steric hinderance from -CH3 is responsible for more acidicity than rest thus E is
the answer
Solution
E.) is less acidic in other A ,B triple bond and double bond are responsible for
acidity In C,D steric hinderance from -CH3 is responsible for more acidicity than rest thus E is
the answer.
Solution when user sending the email, then user should select eithe.pdfmukhtaransarcloth
Solution
: when user sending the email, then user should select either POP3 or IMAP protocol to send the
mails. Some of the differences are giving below.
POP3 e-mail protocol:
IMAP e-mail protocol:
SMTP (simple mail transfer protocol):
SMTP is not normally used as intermediate mail servers for sending mail. Because SMTP cannot
transmit the executable files or any binary objects.
Similarly it cannot transmit the text data that contains the national language characters. It will
have certain size limit to have an e-mail. So if the mail size is over the limit then it will be
rejected..
please give me points as nobody ecen noticed the qusetion as it is u.pdfmukhtaransarcloth
please give me points as nobody ecen noticed the qusetion as it is ununderstandable
Solution
please give me points as nobody ecen noticed the qusetion as it is ununderstandable.
Part-IQuestion 1. What is Dr. Warren’s hypothesis regarding the ba.pdfmukhtaransarcloth
Part-I
Question 1. What is Dr. Warren’s hypothesis regarding the bacteria he found in the stomach?
Give at least three alternative hypotheses that could explain these findings.
Answer: Dr. Warren\'s hypothesis was that there was a definite correlation between active,
chronic gastritis and the presence of the bacteria found in stomachs.
hypothesis 1. Dr. Warren noticed a thin blue line on the surface of the tissue.
hypothesis 2: Warren found numerous spiral shaped bacteria when stained with a Warthin-Starry
silver stain of the histological section.
hypothesis 3: Dr. Warren also observed that the number of bacteria observed seemed to correlate
with the degree of inflammation of the stomach lining—the more severe the inflammation, the
more abundant the bacteria.
Question 2.What should Dr. Warren do next?
Answer: Dr. Warren started Warthin-Starry silver stain for all the gastric biopsies he examined.
Part-II:
Question: At this stage of the story, what type(s) of data do Warren and Marshall have on the
spiral bacteria found in stomachs? Is it quantitative or qualitative? Is it experimental of
observational?
Answer: Dr. Warren and Marshall had the quantitative data based on the observations made by
various researchers, such as Italian pathologist Giulio Bizzozero, Polish clinical researcher, Dr.
W. Jaworski. The results that obtained from the previous reports are purely observational, not
experimental.
Part-III:
Question: At this stage of the study, what type(s) of data do Warren and Marshall have on the
spiral bacteria found in stomachs? Is it quantitative or qualitative? Is it experimental of
observational?
Answer: Now, at this stage, Warren and Marshall had electron microscopy data of the bacteria
that was colonized in the lab culture media, and therefore, the data was now experimentally
proven qualitative data.
Question: What other information would you like to have about this bacterium now that it can be
successfully cultured in the lab?
Answer: The bacteria that was isolated from the biopsy of patient\'s stomach for lab culture, was
a slow grower, and it took 5-6 days for colonization instead of 2 days which has taken by many
identified bacteria.
Part IV:
Question: At this stage of the study, what type(s) of data do Warren and Marshall have on the
spiral bacteria found in stomachs? Is it quantitative or qualitative? Is it experimental of
observational?
Answer: The data was generated by pilot studies from 100 patients and the data was
experimental and also statistically analyzed, therefore it was qualitative as well as quantitative
data.
CANNOT SEE FIGURE 3. UNABLE TO ANSWER FURTHER.
Solution
Part-I
Question 1. What is Dr. Warren’s hypothesis regarding the bacteria he found in the stomach?
Give at least three alternative hypotheses that could explain these findings.
Answer: Dr. Warren\'s hypothesis was that there was a definite correlation between active,
chronic gastritis and the presence of the bacteria found in stomachs.
hypothesis 1. Dr. W.
Combustion of glucose is respiration. The equatio.pdfmukhtaransarcloth
Combustion of glucose is respiration. The equation for the combustion of glucose
is: C6H12O6(s) + 6O2(g) --> 6CO2(g) + 6H2O(g) Essentially, sugar (C6H12O6) is burned, or
oxidized, down to CO2 and H2O, releasing energy (ATP) in the process. Why do cells need
ATP? ALL cellular work -all the activities of life - requires energy, either from ATP or from
related molecules. A lot of oxygen is required for this process! The sugar AND the oxygen are
delivered to your cells via your bloodstream. This process occurs partially in the cytoplasm, and
partially in the mitochondria. The mitochondria is another organelle in eukaryotic cells. like the
chloroplast, the mitochondria has two lipid bilayers around it, and its own genome (indicating
that it may be the result of endosymbiosis long ago). In some ways similar to the chloroplast, the
mitochondria also has two main sites for the reactions: The matrix, a liquidy part of the
mitochondrion, and the christae, the folded membranes in the mitochondrion. 1: Glycolysis
(\"splitting of sugar\"): This step happens in the cytoplasm. One Glucose (C6H12O6) is broken
down to 2 molecules of pyruvic acid. Results in the production of 2 ATPs for every glucose.
(page 113 of your book goes into painful detail about this process, but all YOU need to know is
that glucose is split into to 2 molecules of pyruvate!) 2: Transition Reaction: Pyruvic Acid is
shuttled into the mitochondria, where it is converyed to a molecule called Acetyl CoA for further
breakdown. 3: The Krebs Cycle, or Citric Acid Cycle: Occurs in the mitochondrial matrix, the
liquid-y part of the mitochondria. In the presence of Oxygen gas (O2), all the hydrogens (H2)
are stripped off the Acetyl CoA, two by two, to extract the electrons for making ATP, until there
are no hydrogens left - and all that is left of the sugar is CO2 - a waste product - and H2O
(exhale). The Krebs cycle results in the production of only ~4 ATPs, but produces a lot of
NADH, which will go on to the next step... Hans Krebs won the Nobel Prize in 1953 for his
discovery of the Citric Acid Cycle. 4: The Electron Transport Chain and Chemiosmosis (\"the
big ATP payoff\"). Occurs in the christae of the mirochondria, the folded membranes inside the
chloroplast. Electrons from Hydrogen are carried by NADH and passed down an electron
transport chain to result in the production of ATP. Results in the production of ~32 ATPs for
every glucose. Peter Mitchell won the Nobel Prize in 1978 for his work on energy production in
mitochondria, called the Chemiosmotic Theory.
Solution
Combustion of glucose is respiration. The equation for the combustion of glucose
is: C6H12O6(s) + 6O2(g) --> 6CO2(g) + 6H2O(g) Essentially, sugar (C6H12O6) is burned, or
oxidized, down to CO2 and H2O, releasing energy (ATP) in the process. Why do cells need
ATP? ALL cellular work -all the activities of life - requires energy, either from ATP or from
related molecules. A lot of oxygen is required for this process! The sugar A.
in truss one...the forces in the member BC and DE have zero.in tru.pdfmukhtaransarcloth
in truss one...the forces in the member BC and DE have zero.
in truss two ... the forces in the members EF and GH have zero..
in truss three ... the forces in the members CD and EF have zero..
Solution
in truss one...the forces in the member BC and DE have zero.
in truss two ... the forces in the members EF and GH have zero..
in truss three ... the forces in the members CD and EF have zero...
iam giving you entire process of forensc duplication;the response.pdfmukhtaransarcloth
iam giving you entire process of forensc duplication;
the response strategy for forensc duplication is
Decision of when to perform a forensic duplication based is based, in part, on existing response
strategy for the instant situation
For example, many organizations have a policy of creating forensic HD duplicates of all PCs
used by executives that leave the organization.
Forensic Duplicates as Admissible Evidence;
Existing legal standards define minimum criteria for an item to be admitted into evidence
Collection process usually under scrutiny as well
Federal Rules of Evidence ;
Federal Rules of Evidence (FRE) 1002 state that the item or information presented in court must
be the original.
Exceptions: Definitions and Duplicates
If data are stored by computer or similar device, any printout or other output readable by sight,
shown to reflect the data accurately, is an original. Admissibility of Duplicates
A duplicate is admissible to the same extent as an original unless: • A genuine question is raised
as to the authenticity of the original, or • In the circumstances it would be unfair to admit the
duplicate in lieu of the original
first of all what is forensics duplication
A file that contains every bit of information from the source in a raw bitstream format.
Tools that create forensic duplicates:
1. dd
2. FTK Imager, Access Data
3. Dfcldd, US DOD Computer Forensics Lab version of the dd comand
Qualified Forensic Duplicate?
A file that contains every bit of information from the source, but may be stored in a altered form.
Tools that create qualified forensic duplicate output files:
1. SafeBack
2. EnCase
3. FTK Imager
Restored Image;
A restored image is what you get when you restore a forensic duplicate or a qualified forensic
duplicate to another storage medium.
Mismatched drive geometries can cause problems.
HD Development;
When hard drives grew beyond 512MB, the PC-BIOS needed to be updated (to recognize larger
drives). …software emulated a modern BIOS. Software pushed all of the real data on the drive
down one sector and stored its program and information in sector 2.
The real partition table would be at cylinder 0, head 0, sector2. Safeback, EnCase, FTK Imager,
and dd will create a restored image from the qualified forensic duplicate. EnCase and dd images
may not need to be restored. Treat images as virtual disks, eliminating the need for restoration.
Note, FTK Imager can create images in the EnCase Format
Mirror Image ;
Created from hardware that does at bit for bit copy from one hard drive to another.
Requires two identical hard drives
Doesn’t happen very often.
Tool Requirements: Forensic Duplication ;
Tool must: Create a forensic duplicate or mirror image of the original.
Handle read errors in a robust and graceful manner.
Not make any changes to source medium.
Capable of scientific and peer review.
Results must be third party repeatable and verifiable.
Legal Issues
Tools used for forensic duplication must pass the legal tests for r.
How does traffic analysis work Internet data packets have two parts.pdfmukhtaransarcloth
How does traffic analysis work? Internet data packets have two parts: a data payload and a
header used for routing. The data payload is whatever is being sent, whether that\'s an email
message, a web page, or an audio file. Even if you encrypt the data payload of your
communications, traffic analysis still reveals a great deal about what you\'re doing and, possibly,
what you\'re saying. That\'s because it focuses on the header, which discloses source, destination,
size, timing, and so on.
A basic problem for the privacy minded is that the recipient of your communications can see that
you sent it by looking at headers. So can authorized intermediaries like Internet service
providers, and sometimes unauthorized intermediaries as well. A very simple form of traffic
analysis might involve sitting somewhere between sender and recipient on the network, looking
at headers.
But there are also more powerful kinds of traffic analysis. Some attackers spy on multiple parts
of the Internet and use sophisticated statistical techniques to track the communications patterns
of many different organizations and individuals. Encryption does not help against these attackers,
since it only hides the content of Internet traffic, not the headers.
Solution
How does traffic analysis work? Internet data packets have two parts: a data payload and a
header used for routing. The data payload is whatever is being sent, whether that\'s an email
message, a web page, or an audio file. Even if you encrypt the data payload of your
communications, traffic analysis still reveals a great deal about what you\'re doing and, possibly,
what you\'re saying. That\'s because it focuses on the header, which discloses source, destination,
size, timing, and so on.
A basic problem for the privacy minded is that the recipient of your communications can see that
you sent it by looking at headers. So can authorized intermediaries like Internet service
providers, and sometimes unauthorized intermediaries as well. A very simple form of traffic
analysis might involve sitting somewhere between sender and recipient on the network, looking
at headers.
But there are also more powerful kinds of traffic analysis. Some attackers spy on multiple parts
of the Internet and use sophisticated statistical techniques to track the communications patterns
of many different organizations and individuals. Encryption does not help against these attackers,
since it only hides the content of Internet traffic, not the headers..
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.
Introduction to AI for Nonprofits with Tapp NetworkTechSoup
Dive into the world of AI! Experts Jon Hill and Tareq Monaur will guide you through AI's role in enhancing nonprofit websites and basic marketing strategies, making it easy to understand and apply.
Synthetic Fiber Construction in lab .pptxPavel ( NSTU)
Synthetic fiber production is a fascinating and complex field that blends chemistry, engineering, and environmental science. By understanding these aspects, students can gain a comprehensive view of synthetic fiber production, its impact on society and the environment, and the potential for future innovations. Synthetic fibers play a crucial role in modern society, impacting various aspects of daily life, industry, and the environment. ynthetic fibers are integral to modern life, offering a range of benefits from cost-effectiveness and versatility to innovative applications and performance characteristics. While they pose environmental challenges, ongoing research and development aim to create more sustainable and eco-friendly alternatives. Understanding the importance of synthetic fibers helps in appreciating their role in the economy, industry, and daily life, while also emphasizing the need for sustainable practices and innovation.
Read| The latest issue of The Challenger is here! We are thrilled to announce that our school paper has qualified for the NATIONAL SCHOOLS PRESS CONFERENCE (NSPC) 2024. Thank you for your unwavering support and trust. Dive into the stories that made us stand out!
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
Biological screening of herbal drugs: Introduction and Need for
Phyto-Pharmacological Screening, New Strategies for evaluating
Natural Products, In vitro evaluation techniques for Antioxidants, Antimicrobial and Anticancer drugs. In vivo evaluation techniques
for Anti-inflammatory, Antiulcer, Anticancer, Wound healing, Antidiabetic, Hepatoprotective, Cardio protective, Diuretics and
Antifertility, Toxicity studies as per OECD guidelines
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
publicclass Date {privatestatic String DATE_SEPARATOR = ;pr.pdf
1. publicclass Date {
privatestatic String DATE_SEPARATOR = "/";
privatestaticintDAYS_PER_WEEK = 7;
//Attributes
privateint day;
privateint month;
privateint year;
/**
* Default Constructor
* Instantiates an object of type Date to 1/1/2000
*/
public Date() {
this.day = 1;
this.month = 1;
this.year = 2000;
}
/**
* Constructs a new date object to represent the given date.
* @param day
* @param month
* @param year
*/
public Date(int day, int month, int year) {
if(isValid(day, month, year)) {
this.day = day;
this.month = month;
this.year = year;
} else
System.out.println("Invalid Date.");
}
/**
* Returns the day value of this date for example, for the date 2006/07/22, returns 22.
* @return
*/
publicint getDay() {
2. return day;
}
/**
* Returns the month value of this date ,for example, for the date 2006/07/22, returns 7.
* @return
*/
publicint getMonth() {
return month;
}
/**
* Returns the year value of this date, for example , the date 2006/07/22, returns 2006.
* @return
*/
publicint getYear() {
return year;
}
/**
* @param day the day to set
*/
publicvoid setDay(int day) {
this.day = day;
}
/**
* @param month the month to set
*/
publicvoid setMonth(int month) {
this.month = month;
}
/**
* @param year the year to set
*/
publicvoid setYear(int year) {
this.year = year;
}
/**
* Returns true if the year of this date is a leap year.
3. * A leap year occurs every 4 years , except for multiples of 100 that are not multiples of 400.
* For example, 1956,1844,1600,and 2000 are leap years, but 1983,2002,1700,and 1900 are not.
* @return
*/
publicboolean isLeapYear(){
if(((this.year % 400) == 0) || (((this.year % 4) == 0) && ((this.year % 100) != 0)))
returntrue;
else
returnfalse;
}
/**
* Checks if the date is valid
* @param day
* @param month
* @param year
* @return
*/
publicboolean isValid(int day, int month, int year) {
if((month < 1) || (12 < month))
returnfalse;
else {
if(((month == 1) || (month == 3) || (month == 5) || (month == 7) ||
(month == 8) || (month == 10) || (month == 12)) && ((day < 1) || (31 < day)))
returnfalse;
elseif(((month == 4) || (month == 6) || (month == 9) || (month == 11)) && ((day < 1) || (30 <
day)))
returnfalse;
elseif(month == 2) {
if(isLeapYear() && ((day < 1) || (29 < day)))
returnfalse;
elseif((day < 1) || (28 < day))
returnfalse;
}
}
returntrue;
}
4. /**
* Returns the maximum number of days in a month
* @return
*/
publicint maxMonthDays() {
if(this.month == 2) {
if(isLeapYear())
return 29;
else
return 28;
} elseif((this.month == 1) || (this.month == 3) || (this.month == 5) || (this.month == 7) ||
(this.month == 8) || (this.month == 10) || (this.month == 12))
return 31;
else
return 30;
}
/**
* Checks if this dat is same as other date
* @param other
* @return
*/
publicboolean isEqual(Date other) {
if((this.day == other.day) && (this.month == other.month) && (this.year == other.year))
returntrue;
else
returnfalse;
}
/**
* Moves this Date object forward in time by the given number of days .
* @param days
*/
publicvoid addDays(int days) {
while(days != 0){
int maxDays = maxMonthDays();
if((maxDays - this.day) >= days) {
this.day += days;
5. days = 0;
}
else{
days -= (maxDays - this.day);
this.day = 0;
if(month == 12) {
this.month = 1;
this.year += 1;
} else
this.month += 1;
}
}
}
/**
* Moves this date object forward in time by the given amount of seven day weeks
* @param weeks
*/
publicvoid addWeeks(int weeks) {
addDays(weeks * DAYS_PER_WEEK);
}
/**
* Returns the number of days that this Date must be adjusted to make it equal to the given other
Date.
* @param other
* @return
*/
publicint daysTo(Date other) {
Date temp = new Date(this.day, this.month, this.year);
if(temp.isEqual(other))
return 0;
else{
int noOfDays = 0;
do {
if((temp.year == other.year) && (temp.month == other.month)) {
noOfDays += (other.day - temp.day);
temp.day = other.day;
6. }
else{
int maxDays = temp.maxMonthDays();
noOfDays += (maxDays - temp.day);
temp.day = 0;
if(temp.month == 12) {
temp.month = 1;
temp.year += 1;
}
else
temp.month += 1;
}
} while(!temp.isEqual(other));
return noOfDays;
}
}
/**
* Returns a String representation of this date in year/month/day order, such as "2006/07/22"
*/
@Override
public String toString() {
returnthis.day + DATE_SEPARATOR + this.month + DATE_SEPARATOR + this.year;
}
}
publicclass Driver {
publicstaticvoid main(String[] args) {
Date d1 = new Date(29, 1, 2016);
Date d2 = new Date(29, 12, 2015);
//Add 5 days to d1
System.out.println(" Add 5 days to " + d1 + " : ");
d1.addDays(5);
System.out.println(d1);
//Add 5 days to d2
System.out.println(" Add 5 days to " + d2 + " : ");
d2.addDays(5);
System.out.println(d2);
7. Date d3 = new Date(28, 8, 2016);
//Add 1 week to d3
System.out.println(" Add 1 week to " + d3 + " : ");
d3.addWeeks(1);
System.out.println(d3);
Date d4 = new Date(31, 8, 2016);
Date d5 = new Date(1, 10, 2016);
System.out.println(" The number of days that " + d4 + " must be adjusted to make it equal to
" + d5 + " : " + d4.daysTo(d5) + " days.");
}
}
SAMPLE OUTPUT :
Add 5 days to 29/1/2016 :
3/2/2016
Add 5 days to 29/12/2015 :
3/1/2016
Add 1 week to 28/8/2016 :
4/9/2016
The number of days that 31/8/2016 must be adjusted to make it equal to 1/10/2016 : 31 days.
Solution
publicclass Date {
privatestatic String DATE_SEPARATOR = "/";
privatestaticintDAYS_PER_WEEK = 7;
//Attributes
privateint day;
privateint month;
privateint year;
/**
* Default Constructor
* Instantiates an object of type Date to 1/1/2000
*/
public Date() {
this.day = 1;
this.month = 1;
8. this.year = 2000;
}
/**
* Constructs a new date object to represent the given date.
* @param day
* @param month
* @param year
*/
public Date(int day, int month, int year) {
if(isValid(day, month, year)) {
this.day = day;
this.month = month;
this.year = year;
} else
System.out.println("Invalid Date.");
}
/**
* Returns the day value of this date for example, for the date 2006/07/22, returns 22.
* @return
*/
publicint getDay() {
return day;
}
/**
* Returns the month value of this date ,for example, for the date 2006/07/22, returns 7.
* @return
*/
publicint getMonth() {
return month;
}
/**
* Returns the year value of this date, for example , the date 2006/07/22, returns 2006.
* @return
*/
publicint getYear() {
return year;
9. }
/**
* @param day the day to set
*/
publicvoid setDay(int day) {
this.day = day;
}
/**
* @param month the month to set
*/
publicvoid setMonth(int month) {
this.month = month;
}
/**
* @param year the year to set
*/
publicvoid setYear(int year) {
this.year = year;
}
/**
* Returns true if the year of this date is a leap year.
* A leap year occurs every 4 years , except for multiples of 100 that are not multiples of 400.
* For example, 1956,1844,1600,and 2000 are leap years, but 1983,2002,1700,and 1900 are not.
* @return
*/
publicboolean isLeapYear(){
if(((this.year % 400) == 0) || (((this.year % 4) == 0) && ((this.year % 100) != 0)))
returntrue;
else
returnfalse;
}
/**
* Checks if the date is valid
* @param day
* @param month
* @param year
11. }
/**
* Checks if this dat is same as other date
* @param other
* @return
*/
publicboolean isEqual(Date other) {
if((this.day == other.day) && (this.month == other.month) && (this.year == other.year))
returntrue;
else
returnfalse;
}
/**
* Moves this Date object forward in time by the given number of days .
* @param days
*/
publicvoid addDays(int days) {
while(days != 0){
int maxDays = maxMonthDays();
if((maxDays - this.day) >= days) {
this.day += days;
days = 0;
}
else{
days -= (maxDays - this.day);
this.day = 0;
if(month == 12) {
this.month = 1;
this.year += 1;
} else
this.month += 1;
}
}
}
/**
* Moves this date object forward in time by the given amount of seven day weeks
12. * @param weeks
*/
publicvoid addWeeks(int weeks) {
addDays(weeks * DAYS_PER_WEEK);
}
/**
* Returns the number of days that this Date must be adjusted to make it equal to the given other
Date.
* @param other
* @return
*/
publicint daysTo(Date other) {
Date temp = new Date(this.day, this.month, this.year);
if(temp.isEqual(other))
return 0;
else{
int noOfDays = 0;
do {
if((temp.year == other.year) && (temp.month == other.month)) {
noOfDays += (other.day - temp.day);
temp.day = other.day;
}
else{
int maxDays = temp.maxMonthDays();
noOfDays += (maxDays - temp.day);
temp.day = 0;
if(temp.month == 12) {
temp.month = 1;
temp.year += 1;
}
else
temp.month += 1;
}
} while(!temp.isEqual(other));
return noOfDays;
}
13. }
/**
* Returns a String representation of this date in year/month/day order, such as "2006/07/22"
*/
@Override
public String toString() {
returnthis.day + DATE_SEPARATOR + this.month + DATE_SEPARATOR + this.year;
}
}
publicclass Driver {
publicstaticvoid main(String[] args) {
Date d1 = new Date(29, 1, 2016);
Date d2 = new Date(29, 12, 2015);
//Add 5 days to d1
System.out.println(" Add 5 days to " + d1 + " : ");
d1.addDays(5);
System.out.println(d1);
//Add 5 days to d2
System.out.println(" Add 5 days to " + d2 + " : ");
d2.addDays(5);
System.out.println(d2);
Date d3 = new Date(28, 8, 2016);
//Add 1 week to d3
System.out.println(" Add 1 week to " + d3 + " : ");
d3.addWeeks(1);
System.out.println(d3);
Date d4 = new Date(31, 8, 2016);
Date d5 = new Date(1, 10, 2016);
System.out.println(" The number of days that " + d4 + " must be adjusted to make it equal to
" + d5 + " : " + d4.daysTo(d5) + " days.");
}
}
SAMPLE OUTPUT :
Add 5 days to 29/1/2016 :
3/2/2016
Add 5 days to 29/12/2015 :
14. 3/1/2016
Add 1 week to 28/8/2016 :
4/9/2016
The number of days that 31/8/2016 must be adjusted to make it equal to 1/10/2016 : 31 days.