Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
31 commits
Select commit Hold shift + click to select a range
230c33b
Initial branch commit.
manuelapop22 Sep 29, 2022
d647ab0
rename module
manuelapop22 Oct 2, 2022
8e8c67f
add dependencies homework T1
manuelapop22 Oct 2, 2022
54309c0
remove junit dependency - add dependencies homework T1
manuelapop22 Oct 6, 2022
cdd01af
commit AppricotJamTest class
manuelapop22 Oct 6, 2022
dcc2617
create CookieTest class T2
manuelapop22 Oct 9, 2022
fcb6188
update CookieTest class T1
manuelapop22 Oct 11, 2022
71bff6b
commit course2
manuelapop22 Oct 13, 2022
a62a76e
create constructor and method for Cookie T2
manuelapop22 Oct 18, 2022
faf2c77
update create constructor and method for Cookie T2
manuelapop22 Oct 20, 2022
36dc3aa
update create constructor and method for Cookie T2
manuelapop22 Oct 20, 2022
cb76e46
commit course 3 inheritance
manuelapop22 Oct 20, 2022
8981ebc
T3 creating Jar class
manuelapop22 Oct 25, 2022
c53d12f
T3 creating Jar class
manuelapop22 Oct 25, 2022
e507ee1
T3 extract fruit into Jam class
manuelapop22 Oct 26, 2022
e567041
T3 extract fruit into Jam class
manuelapop22 Oct 26, 2022
1cc9ae5
changes made for extract fruit into Jam class
manuelapop22 Oct 27, 2022
106bbb3
commit chapter 4 operatorsTest
manuelapop22 Oct 27, 2022
68afd0c
commit T4 remove isDietetic from Jam constructor
manuelapop22 Nov 2, 2022
ef4fe77
commit T4 remove isDietetic from Jam constructor
manuelapop22 Nov 2, 2022
3e1ae41
commit T4 remove variables from Jam constructor
manuelapop22 Nov 3, 2022
4d3b3b5
commit chapter 5 while, if, for statements
manuelapop22 Nov 3, 2022
08e15af
commit T5 lastDayOfMonth, divideBySeven and makeJam update
manuelapop22 Nov 7, 2022
deb5ee5
commit makeJam update using simplified if
manuelapop22 Nov 8, 2022
219048f
commit makeJam update using simplified if
manuelapop22 Nov 8, 2022
16de1b9
commit chapter 6
manuelapop22 Nov 10, 2022
1d27a1d
commit T6 Map and List
manuelapop22 Nov 16, 2022
32d9ffd
commit T6 List Of
manuelapop22 Nov 17, 2022
3995b1b
commit T6 List Of
manuelapop22 Nov 20, 2022
7def3a4
commit assesment project
manuelapop22 Nov 22, 2022
54e7f55
assesment project
manuelapop22 Nov 23, 2022
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .idea/.gitignore

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

9 changes: 9 additions & 0 deletions .idea/encodings.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

12 changes: 12 additions & 0 deletions .idea/misc.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions .idea/vcs.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

46 changes: 46 additions & 0 deletions manuela/pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<parent>
<artifactId>tutorial-java</artifactId>
<groupId>com.imalittletester</groupId>
<version>1.0-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>

<artifactId>manuela</artifactId>
<packaging>jar</packaging>

<name>manuela</name>
<url>http://maven.apache.org</url>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<source>14</source>
<target>14</target>
</configuration>
</plugin>
</plugins>
</build>

<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>

<dependencies>
<!-- https://mvnrepository.com/artifact/org.apache.commons/commons-lang3 -->
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-lang3</artifactId>
<version>3.12.0</version>
</dependency>
<!-- https://mvnrepository.com/artifact/commons-io/commons-io -->
<dependency>
<groupId>commons-io</groupId>
<artifactId>commons-io</artifactId>
<version>2.11.0</version>
</dependency>
</dependencies>
</project>
28 changes: 28 additions & 0 deletions manuela/src/main/java/com/imalittletester/Assesment/EventData.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
package com.imalittletester.Assesment;

import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Calendar;
import java.util.Locale;

public class EventData {
public int steps;
public Calendar date;

public EventData(int steps, Calendar date) {
this.steps = steps;
this.date = date;
}

public EventData(int steps, String date) {
this.steps = steps;
Calendar cal = Calendar.getInstance();
SimpleDateFormat sdf = new SimpleDateFormat("MM-dd-yyyy hh:mm", Locale.ENGLISH);
try {
cal.setTime(sdf.parse(date));
this.date = cal;
} catch (ParseException e) {
throw new RuntimeException(e);
}
}
}
103 changes: 103 additions & 0 deletions manuela/src/main/java/com/imalittletester/Assesment/Senzor.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,103 @@
package com.imalittletester.Assesment;

import java.util.*;

public class Senzor {
public List<EventData> eventDataList;
public List<UomAndDate> uomAndDateList;

public Senzor(List<EventData> eventDataList, List<UomAndDate> uomAndDateList) {
this.eventDataList = eventDataList;
this.uomAndDateList = uomAndDateList;
}

public int getStepCountByDate(Calendar date) {
int stepCount = 0;
for (int i = 0; i < eventDataList.size(); i++) {
if (date.get(Calendar.YEAR) == eventDataList.get(i).date.get(Calendar.YEAR) &&
date.get(Calendar.MONTH) == eventDataList.get(i).date.get(Calendar.MONTH) &&
date.get(Calendar.DATE) == eventDataList.get(i).date.get(Calendar.DATE) &&
eventDataList.get(i).date.before(date)) {
stepCount = stepCount + eventDataList.get(i).steps;
}
}
return stepCount;
}

public void createEventDataAndUomAndDataListRandom() {
this.eventDataList = new ArrayList<>();
this.uomAndDateList = new ArrayList<>();
Calendar date = Calendar.getInstance();
Random rn = new Random();
for (int day = 0; day <= 14; day++) {
for (int hour = 0; hour <= 23; hour++) {
for (int minute = 0; minute <= 59; minute++) {
int steps = rn.nextInt(20 - 1 + 1) + 1;
Calendar date1 = Calendar.getInstance();
date1.set(Calendar.DATE, date.get(Calendar.DATE) - day);
date1.set(Calendar.HOUR, hour);
date1.set(Calendar.MINUTE, minute);
date1.set(Calendar.SECOND, 0);
date1.set(Calendar.MILLISECOND, 0);
date1.set(Calendar.MONTH, date.get(Calendar.MONTH));
date1.set(Calendar.YEAR, date.get(Calendar.YEAR));
eventDataList.add(new EventData(steps, date1));
}
}
Calendar date2 = Calendar.getInstance();
date2.set(Calendar.DATE, date.get(Calendar.DATE) - day);
date2.set(Calendar.SECOND, 0);
date2.set(Calendar.MILLISECOND, 0);
date2.set(Calendar.MONTH, date.get(Calendar.MONTH));
date2.set(Calendar.YEAR, date.get(Calendar.YEAR));
if (day % 2 == 0) {
uomAndDateList.add(new UomAndDate("km", date2, 1000));
} else {
uomAndDateList.add(new UomAndDate("mi", date2, 1600));
}
}
}

public void createEventDataAndUomAndDataListSpecific() {
this.eventDataList = new ArrayList<>();
this.uomAndDateList = new ArrayList<>();

uomAndDateList.add(new UomAndDate("km", "11-21-2022 15:12", 1000));
uomAndDateList.add(new UomAndDate("km", "11-22-2022 15:12", 1000));
uomAndDateList.add(new UomAndDate("mi", "11-23-2022 15:12", 1600));
uomAndDateList.add(new UomAndDate("mi", "11-24-2022 15:12", 1600));
uomAndDateList.add(new UomAndDate("mi", "11-25-2022 15:12", 1600));
uomAndDateList.add(new UomAndDate("mi", "11-26-2022 15:12", 1600));
uomAndDateList.add(new UomAndDate("mi", "11-27-2022 15:12", 1600));
uomAndDateList.add(new UomAndDate("km", "11-28-2022 15:12", 1000));
uomAndDateList.add(new UomAndDate("km", "11-29-2022 15:12", 1000));
uomAndDateList.add(new UomAndDate("mi", "11-20-2022 15:12", 1600));
uomAndDateList.add(new UomAndDate("mi", "11-19-2022 15:12", 1600));
eventDataList.add(new EventData(7000, "11-29-2022 09:12"));
eventDataList.add(new EventData(15000, "11-28-2022 09:12"));
eventDataList.add(new EventData(7000, "11-27-2022 09:12"));
eventDataList.add(new EventData(15000, "11-26-2022 09:12"));
eventDataList.add(new EventData(7000, "11-25-2022 09:12"));
eventDataList.add(new EventData(15000, "11-24-2022 09:12"));
eventDataList.add(new EventData(11, "11-24-2022 09:12"));
eventDataList.add(new EventData(11, "11-23-2022 09:12"));
eventDataList.add(new EventData(1000, "11-23-2022 12:12"));
eventDataList.add(new EventData(1000, "11-23-2022 14:12"));
eventDataList.add(new EventData(11, "11-23-2022 18:12"));
eventDataList.add(new EventData(22, "11-23-2022 21:12"));
eventDataList.add(new EventData(1000, "11-22-2022 07:12"));
eventDataList.add(new EventData(500, "11-22-2022 11:12"));
eventDataList.add(new EventData(4000, "11-22-2022 15:12"));
eventDataList.add(new EventData(22, "11-22-2022 21:59"));
eventDataList.add(new EventData(11, "11-21-2022 11:12"));
eventDataList.add(new EventData(55, "11-21-2022 21:59"));
eventDataList.add(new EventData(7000, "11-21-2022 13:12"));
eventDataList.add(new EventData(11, "11-20-2022 15:12"));
eventDataList.add(new EventData(11, "11-20-2022 10:13"));
eventDataList.add(new EventData(55, "11-19-2022 15:12"));
eventDataList.add(new EventData(12, "11-19-2022 17:13"));
eventDataList.add(new EventData(11, "11-19-2022 19:14"));
eventDataList.add(new EventData(11, "11-19-2022 20:14"));

}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
package com.imalittletester.Assesment;

import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Calendar;
import java.util.Locale;

public class UomAndDate {
public String uom;
public Calendar date;
public int stepsPerUom;

public UomAndDate(String uom, Calendar date, int stepsPerUom) {
this.uom = uom;
this.date = date;
this.stepsPerUom = stepsPerUom;
}

public UomAndDate(String uom, String date, int stepsPerUom) {
this.uom = uom;
Calendar cal = Calendar.getInstance();
SimpleDateFormat sdf = new SimpleDateFormat("MM-dd-yyyy hh:mm", Locale.ENGLISH);
try {
cal.setTime(sdf.parse(date));
this.date = cal;
} catch (ParseException e) {
throw new RuntimeException(e);
}
this.stepsPerUom = stepsPerUom;
}
}
Loading