study.com work

This commit is contained in:
Zakaria 2025-11-28 12:06:47 -05:00
commit f2b14c75c2
86 changed files with 2525 additions and 0 deletions

BIN
.DS_Store vendored Normal file

Binary file not shown.

5
.idea/.gitignore vendored Normal file
View File

@ -0,0 +1,5 @@
# Default ignored files
/shelf/
/workspace.xml
# Environment-dependent path to Maven home directory
/mavenHomeManager.xml

View File

@ -0,0 +1,7 @@
<component name="ProjectCodeStyleConfiguration">
<code_scheme name="Project" version="173">
<ScalaCodeStyleSettings>
<option name="MULTILINE_STRING_CLOSING_QUOTES_ON_NEW_LINE" value="true" />
</ScalaCodeStyleSettings>
</code_scheme>
</component>

View File

@ -0,0 +1,5 @@
<component name="ProjectCodeStyleConfiguration">
<state>
<option name="PREFERRED_PROJECT_CODE_STYLE" value="Default" />
</state>
</component>

6
.idea/misc.xml Normal file
View File

@ -0,0 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ProjectRootManager" version="2" languageLevel="JDK_23" default="true" project-jdk-name="openjdk-23" project-jdk-type="JavaSDK">
<output url="file://$PROJECT_DIR$/out" />
</component>
</project>

8
.idea/modules.xml Normal file
View File

@ -0,0 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ProjectModuleManager">
<modules>
<module fileurl="file://$PROJECT_DIR$/study.com.iml" filepath="$PROJECT_DIR$/study.com.iml" />
</modules>
</component>
</project>

4
.idea/vcs.xml Normal file
View File

@ -0,0 +1,4 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="VcsDirectoryMappings" defaultProject="true" />
</project>

BIN
ComputerScience104/.DS_Store vendored Normal file

Binary file not shown.

Binary file not shown.

@ -0,0 +1 @@
Subproject commit b7d4d6d1ee87e7b64afcb6e8136d1ff9443be5fa

BIN
ComputerScience104/Assignment2/.DS_Store vendored Normal file

Binary file not shown.

@ -0,0 +1 @@
Subproject commit 4df044c9c54e2a071cb3870000fdbc104c4c39a4

@ -0,0 +1 @@
Subproject commit 0af8e15f447d21859c7da42aa566335191068cc0

BIN
ComputerScience109/.DS_Store vendored Normal file

Binary file not shown.

View File

@ -0,0 +1,118 @@
/*
* in this Java program, the user can calculate the area of a rectangle,
* and the volumes of a cube, cylinder, and sphere.
* The user will be prompt to enter the length and width of a rectangle,
* and then choose a shape to calculate the volume of (cube, cylinder, or sphere).
*/
import java.util.InputMismatchException;
import java.util.Scanner;
class Rectangle {
public static double rectangleArea(double length, double width) {
return length * width;
}
}
class Cube {
public static double cubeVolume(double side) {
return Math.pow(side, 3);
}
}
class Cylinder {
public static double cylinderVolume(double radius, double height) {
return Math.PI * Math.pow(radius, 2) * height;
}
}
class Sphere {
public static double sphereVolume(double radius) {
return (4.0 / 3.0) * Math.PI * Math.pow(radius, 3);
}
}
//Main Class
public class Main{
public static void main(String[] args) {
Scanner scanner = new Scanner(System.in);
try {
// User prompt for the length and width
System.out.println("Rectangle Area");
System.out.print("Please enter length: ");
double length = scanner.nextDouble();
System.out.print("Please enter width: ");
double width = scanner.nextDouble();
// making sure that the user put positive numbers otherwise we throw a //warning
if (length <= 0 || width <= 0) {
System.out.println("WARNING!: Length and width must be positive numbers.");
} else {
double area = Rectangle.rectangleArea(length, width);
System.out.println("Rectangle Area: " + area);
}
// Choose shape for volume calculation
System.out.println("");
System.out.println("Volume Calculation");
System.out.println("Choose a shape to calculate volume:");
System.out.println("1. Cube");
System.out.println("2. Cylinder ");
System.out.println("3. Sphere ");
System.out.print("Enter your choice (1-3): ");
int userChoice = scanner.nextInt();
switch (userChoice) {
case 1:
System.out.print("Enter side length of cube: ");
double side = scanner.nextDouble();
if (side <= 0) {
System.out.println("Error: Side must be a positive number.");
} else {
double cubeVolume = Cube.cubeVolume(side);
System.out.println("Cube Volume: " + cubeVolume);
}
break;
case 2:
System.out.print("Enter radius of cylinder: ");
double cylinderRadius = scanner.nextDouble();
System.out.print("Enter height of cylinder: ");
double cylinderHeight = scanner.nextDouble();
if (cylinderRadius <= 0 || cylinderHeight <= 0) {
System.out.println("Error: Radius and height must be positive numbers.");
} else {
double cylinderVolume = Cylinder.cylinderVolume(cylinderRadius, cylinderHeight);
System.out.println("Cylinder Volume: " + cylinderVolume);
}
break;
case 3:
System.out.print("Enter radius of sphere: ");
double sphereRadius = scanner.nextDouble();
if (sphereRadius <= 0) {
System.out.println("Error: Radius must be a positive number.");
} else {
double sphereVolume = Sphere.sphereVolume(sphereRadius);
System.out.println("Sphere Volume: " + sphereVolume);
}
break;
default:
System.out.println("Invalid choice.");
}
} catch (InputMismatchException e) {
System.out.println("Input error: Please enter valid numeric values.");
} finally {
scanner.close();
}
}
}
//Please copy and paste this code to an IDE and run

Binary file not shown.

View File

@ -0,0 +1,85 @@
import java.util.Scanner;
/*
* The program below is a java script that helps find the perfect numbers using
* Nested Loops.
* A perfect numbersber is a positive integer that equals the sum of its
* proper positive divisors (excluding the number itself)
* */
public class PerfectNumbers {
public static void main(String[] args) {
// Part 1: Find perfect numbers between 1 and 200
System.out.println("Perfect Numbers between 1 and 200:");
// findAndPrintPerfectNumber(200);
// Add a separator line in the output.
System.out.println("\n----------------------------------------\n");
// Part 2: User input range (up to maximum of 1000)
Scanner scanner = new Scanner(System.in);
int upperBound;
do {
System.out.print("Enter an upper bound between 1 and 1000 for checking perfect numbers: ");
while (!scanner.hasNextInt()) { // Validate integer input.
System.out.println("That's not a valid number. Please enter an integer.");
scanner.next(); // discard invalid input
System.out.print("Enter an upper bound between 1 and 1000: ");
}
upperBound = scanner.nextInt();
if (upperBound < 1 || upperBound > 9000) {
System.out.println("Please enter a number between 1 and 1000.");
} else {
break;
}
} while (true);
// Now check for perfect numbers in the user-specified range.
System.out.println("\nPerfect Numbers between 1 and " + upperBound + ":");
// findAndPrintPerfectNumber(upperBound);
scanner.close();
}
/**
* This method finds and prints all perfect numbers up to a given limit
* (inclusive).
*/
public static void perfectNums() {
// Let's get the perfect numbers in the a range of positive integers ( 1 to 200)
// OUTER LOOP
for (int i = 1; i <= 200; i++) {
int total = 0;
// INNER LOOP
for (int j = 1; j <= i / 2; j++) {
total += j;
}
if (total == i) {
System.out.println(i + " is a perfect number");
}
}
}
// public static void findAndPrintPerfectNumber(int limit) {
// for (int i = 1; i <= limit; i++) { // Loop through each number
// int sumOfDivisors = 0;
//
// // Find proper divisors using nested loops.
// // Note: Instead of a nested loop, we can iterate up to half of the number,
// // but since you requested a nested loop approach, here's how it might look:
// for (int j = 1; j <= i / 2; j++) { // Only need to check up to i/2
// if (i % j == 0) {
// sumOfDivisors += j;
// }
// }
//
// // Check if the number is perfect.
// if (sumOfDivisors == i && i != 1) { // Exclude 1 as it's not considered a
// perfect number
// System.out.println(i);
// }
// }
// }
}

Binary file not shown.

Binary file not shown.

View File

@ -0,0 +1,85 @@
/**
* CS115
*/
import java.util.Scanner;
public class GradeCalculatorProject {
/* Print specifications method separate from main */
public static void main(String[] args) {
final int MAX_GRADES = 10; // the max arrau length
final int QUIT = 999; // to quit
int[] grades = new int[MAX_GRADES]; // array of grades
int count = 0; // how many grades the user entered
int total = 0; // calculate the total of grades
printSpecifications(); // specifications
Scanner sc = new Scanner(System.in);
/* Main input loop stop either on 999 or after 10 grades */
System.out.print("Enter quiz grade (or 999 to finish): ");
while (count < MAX_GRADES) {
int grade = sc.nextInt();
/* Stop if user typed 999 */
if (grade == QUIT) {
System.out.println("...Quitting…");
break;
}
if (grade < 0 || grade > 100) {
System.out.println("Invalid grade must be 0100. Try again.");
continue; // don't count this iteration
}
grades[count] = grade; // store the grade
total += grade; // addition while looping
count++; // increment number of grades as long as they dont exceed 10.
System.out.print("Enter next quiz grade (or 999 to finish): ");
}
sc.close();
/* Print all grades entered */
System.out.println("\n=== All Grades Entered ===");
for (int i = 0; i < count; i++) {
System.out.println("Grade #" + (i + 1) + " : " + grades[i]);
System.out.println("");
}
/* Compute average */
double average = 0.0;
if (count > 0) {
average = (double) total / count; // we cast the total since the total is an int
}
System.out.printf("\nAverage of %d grades is: %.2f%n", count, average);
char letterGrade = determineLetterGrade(average);
System.out.println("Letter grade: " + letterGrade);
System.out.println("===== End =====");
}
private static void printSpecifications() {
System.out.println("\n===== Quiz Grade Calculator =====");
System.out.println("This program will take 10 quiz grades from 0100,");
System.out.println("Once all the ten inputs are entered, your grades will be printed,");
System.out.println("and the program will compute your average score and letter grade.");
System.out.println("If you wish to QUIT the program please type 999.\n");
System.out.println("");
}
private static char determineLetterGrade(double average) {
// pretty self exlainatory:qw!
if (average >= 90)
return 'A';
if (average >= 80)
return 'B';
if (average >= 70)
return 'C';
if (average >= 60)
return 'D';
return 'F';
}
}

BIN
ComputerScience201/.DS_Store vendored Normal file

Binary file not shown.

3
ComputerScience201/.idea/.gitignore vendored Normal file
View File

@ -0,0 +1,3 @@
# Default ignored files
/shelf/
/workspace.xml

View File

@ -0,0 +1,7 @@
<component name="ProjectCodeStyleConfiguration">
<code_scheme name="Project" version="173">
<ScalaCodeStyleSettings>
<option name="MULTILINE_STRING_CLOSING_QUOTES_ON_NEW_LINE" value="true" />
</ScalaCodeStyleSettings>
</code_scheme>
</component>

View File

@ -0,0 +1,5 @@
<component name="ProjectCodeStyleConfiguration">
<state>
<option name="PREFERRED_PROJECT_CODE_STYLE" value="Default" />
</state>
</component>

View File

@ -0,0 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ProjectRootManager" version="2" languageLevel="JDK_23" default="true" project-jdk-name="openjdk-23" project-jdk-type="JavaSDK">
<output url="file://$PROJECT_DIR$/out" />
</component>
</project>

View File

@ -0,0 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ProjectModuleManager">
<modules>
<module fileurl="file://$PROJECT_DIR$/ComputerScience201.iml" filepath="$PROJECT_DIR$/ComputerScience201.iml" />
</modules>
</component>
</project>

View File

@ -0,0 +1,4 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="VcsDirectoryMappings" defaultProject="true" />
</project>

View File

@ -0,0 +1,217 @@
import java.util.Scanner;
// Node class representing each element in the Binary Search Tree (BST)
class Node {
int value;
Node left, right;
// Constructor to initialize a node with a given value
public Node(int item) {
value = item;
left = right = null;
}
}
// BinarySearchTree class that implements the BST operations
class BinarySearchTree {
Node root;
// Method to create a balanced BST from a sorted array
public void createBalancedBST(int[] sortedValues) {
root = buildBalancedBST(sortedValues, 0, sortedValues.length - 1);
}
// Helper method to recursively build a balanced BST
private Node buildBalancedBST(int[] arr, int start, int end) {
if (start > end)
return null;
int mid = (start + end) / 2; // Find the middle index
Node node = new Node(arr[mid]); // Create a new node with the middle value
// Recursively build left and right subtrees
node.left = buildBalancedBST(arr, start, mid - 1);
node.right = buildBalancedBST(arr, mid + 1, end);
return node;
}
// Method to insert a new value into the BST
public void insert(int value) {
root = insertNode(root, value);
}
// Helper method to recursively insert a new value
private Node insertNode(Node root, int value) {
if (root == null)
return new Node(value);
if (value < root.value)
root.left = insertNode(root.left, value);
else if (value > root.value)
root.right = insertNode(root.right, value);
return root;
}
// Method to delete a value from the BST
public void delete(int value) {
root = deleteNode(root, value);
}
// Helper method to recursively delete a value
private Node deleteNode(Node root, int value) {
if (root == null)
return null;
if (value < root.value)
root.left = deleteNode(root.left, value);
else if (value > root.value)
root.right = deleteNode(root.right, value);
else {
// If the node to delete has no children or one child
if (root.left == null)
return root.right;
else if (root.right == null)
return root.left;
// If the node has two children, replace with the minimum value in the right subtree
root.value = minValue(root.right);
root.right = deleteNode(root.right, root.value);
}
return root;
}
private int minValue(Node root) {
int min = root.value;
while (root.left != null) {
min = root.left.value;
root = root.left;
}
return min;
}
// Method to print the BST in InOrder traversal (Left -> Root -> Right)
public void printInOrder() {
System.out.print("InOrder: ");
inOrder(root);
System.out.println();
}
// Method to print the BST in PreOrder traversal (Root -> Left -> Right)
public void printPreOrder() {
System.out.print("PreOrder: ");
preOrder(root);
System.out.println();
}
// Method to print the BST in PostOrder traversal (Left -> Right -> Root)
public void printPostOrder() {
System.out.print("PostOrder: ");
postOrder(root);
System.out.println();
}
// Helper method for InOrder traversal
private void inOrder(Node root) {
if (root != null) {
inOrder(root.left);
System.out.print(root.value + " ");
inOrder(root.right);
}
}
// Helper method for PreOrder traversal
private void preOrder(Node root) {
if (root != null) {
System.out.print(root.value + " ");
preOrder(root.left);
preOrder(root.right);
}
}
// Helper method for PostOrder traversal
private void postOrder(Node root) {
if (root != null) {
postOrder(root.left);
postOrder(root.right);
System.out.print(root.value + " ");
}
}
}
// Main application class to run the BST program
public class BinarySearchTreeApp {
public static void main(String[] args) {
Scanner scanner = new Scanner(System.in);
BinarySearchTree bst = new BinarySearchTree();
while (true) {
System.out.println("\n--- Binary Search Tree Menu ---");
System.out.println("1. Create a binary search tree");
System.out.println("2. Add a node");
System.out.println("3. Delete a node");
System.out.println("4. Print nodes by InOrder");
System.out.println("5. Print nodes by PreOrder");
System.out.println("6. Print nodes by PostOrder");
System.out.println("7. Exit program");
System.out.print("Enter your choice: ");
int choice = -1;
try {
choice = Integer.parseInt(scanner.nextLine());
} catch (Exception ignored) {
}
switch (choice) {
case 1:
// Create a balanced BST from a sorted array
int[] data = {1, 2, 3, 4, 5, 6, 7};
bst.createBalancedBST(data);
System.out.println("Binary search tree created.");
break;
case 2:
// Insert a new node into the BST
System.out.print("Enter value to insert: ");
int valueToInsert = Integer.parseInt(scanner.nextLine());
bst.insert(valueToInsert);
System.out.println("Node inserted.");
break;
case 3:
// Delete a node from the BST
System.out.print("Enter value to delete: ");
int valueToDelete = Integer.parseInt(scanner.nextLine());
bst.delete(valueToDelete);
System.out.println("Node deleted (if it existed).");
break;
case 4:
// Print the BST in InOrder traversal
bst.printInOrder();
break;
case 5:
// Print the BST in PreOrder traversal
bst.printPreOrder();
break;
case 6:
// Print the BST in PostOrder traversal
bst.printPostOrder();
break;
case 7:
// Exit the program
System.out.println("Exiting program.");
scanner.close();
return;
default:
System.out.println("Invalid choice. Please try again.");
}
}
}
}

View File

@ -0,0 +1,11 @@
<?xml version="1.0" encoding="UTF-8"?>
<module type="JAVA_MODULE" version="4">
<component name="NewModuleRootManager" inherit-compiler-output="true">
<exclude-output />
<content url="file://$MODULE_DIR$">
<sourceFolder url="file://$MODULE_DIR$" isTestSource="false" />
</content>
<orderEntry type="inheritedJdk" />
<orderEntry type="sourceFolder" forTests="false" />
</component>
</module>

View File

@ -0,0 +1,105 @@
import java.util.*;
public class TheStates {
// Let's first create a list of all states.
private static final String[] STATES = {
"Alabama", "Alaska", "Arizona", "Arkansas", "California", "Colorado", "Connecticut",
"Delaware", "Florida", "Georgia", "Hawaii", "Idaho", "Illinois", "Indiana", "Iowa",
"Kansas", "Kentucky", "Louisiana", "Maine", "Maryland", "Massachusetts", "Michigan",
"Minnesota", "Mississippi", "Missouri", "Montana", "Nebraska", "Nevada", "New Hampshire",
"New Jersey", "New Mexico", "New York", "North Carolina", "North Dakota", "Ohio",
"Oklahoma", "Oregon", "Pennsylvania", "Rhode Island", "South Carolina", "South Dakota",
"Tennessee", "Texas", "Utah", "Vermont", "Virginia", "Washington", "West Virginia",
"Wisconsin", "Wyoming"
};
public static void main(String[] args) {
Scanner scanner = new Scanner(System.in);
int choice;
while (true) {
System.out.println("");
System.out.println("Menu:");
System.out.println("1 - Display the text");
System.out.println("2 - Search");
System.out.println("3 - Exit program");
System.out.print("Enter your choice: ");
choice = scanner.nextInt();
scanner.nextLine(); // consume newline
switch (choice) {
case 1:
System.out.println("\nText containing all states:\n");
System.out.println(STATESLIST);
break;
case 2:
System.out.print("\nEnter a pattern to search: ");
String pattern = scanner.nextLine();
List<Integer> results = boyerBadCharSearch(STATESLIST, pattern);
if (results.isEmpty()) {
System.out.println("Pattern not found.");
} else {
System.out.println("Pattern found at indices: " + results);
}
break;
case 3:
System.out.println("Exiting program.");
scanner.close();
return;
default:
System.out.println("Invalid option. Try again.");
}
}
}
// Create a single string containing all state names separated by a dash
private static final String STATESLIST = String.join(" - ", STATES);
// Boyer-Moyer bad character search
public static List<Integer> boyerBadCharSearch(String text, String pattern) {
List<Integer> result = new ArrayList<>();
int[] badChar = buildBadCharTable(pattern);
int m = pattern.length();
int n = text.length();
int shift = 0;
while (shift <= (n - m)) {
int j = m - 1;
// Move from right to left of the pattern
while (j >= 0 && pattern.charAt(j) == text.charAt(shift + j))
j--;
if (j < 0) {
result.add(shift);
if (shift + m < text.length()) {
shift += m - badChar[text.charAt(shift + m)];
} else {
shift += 1;
}
} else {
shift += Math.max(1, j - badChar[text.charAt(shift + j)]);
}
}
return result;
}
// Build bad character table
public static int[] buildBadCharTable(String pattern) {
final int SIZE = 256;
int[] table = new int[SIZE];
Arrays.fill(table, -1);
for (int i = 0; i < pattern.length(); i++) {
table[pattern.charAt(i)] = i;
}
return table;
}
}

View File

@ -0,0 +1,3 @@
# Default ignored files
/shelf/
/workspace.xml

View File

@ -0,0 +1,7 @@
<component name="ProjectCodeStyleConfiguration">
<code_scheme name="Project" version="173">
<ScalaCodeStyleSettings>
<option name="MULTILINE_STRING_CLOSING_QUOTES_ON_NEW_LINE" value="true" />
</ScalaCodeStyleSettings>
</code_scheme>
</component>

View File

@ -0,0 +1,5 @@
<component name="ProjectCodeStyleConfiguration">
<state>
<option name="PREFERRED_PROJECT_CODE_STYLE" value="Default" />
</state>
</component>

View File

@ -0,0 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ProjectRootManager" version="2" languageLevel="JDK_23" default="true" project-jdk-name="openjdk-23" project-jdk-type="JavaSDK">
<output url="file://$PROJECT_DIR$/out" />
</component>
</project>

View File

@ -0,0 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ProjectModuleManager">
<modules>
<module fileurl="file://$PROJECT_DIR$/ComputerScience201.iml" filepath="$PROJECT_DIR$/ComputerScience201.iml" />
</modules>
</component>
</project>

View File

@ -0,0 +1,4 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="VcsDirectoryMappings" defaultProject="true" />
</project>

View File

@ -0,0 +1,11 @@
<?xml version="1.0" encoding="UTF-8"?>
<module type="JAVA_MODULE" version="4">
<component name="NewModuleRootManager" inherit-compiler-output="true">
<exclude-output />
<content url="file://$MODULE_DIR$">
<sourceFolder url="file://$MODULE_DIR$" isTestSource="false" />
</content>
<orderEntry type="inheritedJdk" />
<orderEntry type="sourceFolder" forTests="false" />
</component>
</module>

View File

@ -0,0 +1,160 @@
<?xml version="1.0" encoding="UTF-8"?>
<mxfile host="app.diagrams.net" modified="2023-06-13T06:46:42.677Z" agent="Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/114.0.0.0 Safari/537.36" etag="2dm6wh7Nnmh6Q2141RGR" version="21.3.8">
<diagram name="Page-1" id="Pp5D8NyYfTdBCvUGVL6m">
<mxGraphModel dx="655" dy="849" grid="1" gridSize="10" guides="1" tooltips="1" connect="1" arrows="1" fold="1" page="1" pageScale="1" pageWidth="850" pageHeight="1100" math="0" shadow="0">
<root>
<mxCell id="0" />
<mxCell id="1" parent="0" />
<mxCell id="uLgKkJphqwm_8STbQmNH-7" value="Thermostat" style="swimlane;fontStyle=1;align=center;verticalAlign=top;childLayout=stackLayout;horizontal=1;startSize=26;horizontalStack=0;resizeParent=1;resizeParentMax=0;resizeLast=0;collapsible=1;marginBottom=0;whiteSpace=wrap;html=1;" vertex="1" parent="1">
<mxGeometry x="60" y="80" width="240" height="424" as="geometry" />
</mxCell>
<mxCell id="uLgKkJphqwm_8STbQmNH-11" value="currentTemperature: float" style="text;strokeColor=none;fillColor=none;align=left;verticalAlign=top;spacingLeft=4;spacingRight=4;overflow=hidden;rotatable=0;points=[[0,0.5],[1,0.5]];portConstraint=eastwest;whiteSpace=wrap;html=1;" vertex="1" parent="uLgKkJphqwm_8STbQmNH-7">
<mxGeometry y="26" width="240" height="26" as="geometry" />
</mxCell>
<mxCell id="uLgKkJphqwm_8STbQmNH-8" value="&lt;div&gt;desiredTemperature: float&lt;/div&gt;&lt;div&gt;&lt;br&gt;&lt;/div&gt;" style="text;strokeColor=none;fillColor=none;align=left;verticalAlign=top;spacingLeft=4;spacingRight=4;overflow=hidden;rotatable=0;points=[[0,0.5],[1,0.5]];portConstraint=eastwest;whiteSpace=wrap;html=1;" vertex="1" parent="uLgKkJphqwm_8STbQmNH-7">
<mxGeometry y="52" width="240" height="26" as="geometry" />
</mxCell>
<mxCell id="uLgKkJphqwm_8STbQmNH-13" value="heatingSystem: HeatingSystem" style="text;strokeColor=none;fillColor=none;align=left;verticalAlign=top;spacingLeft=4;spacingRight=4;overflow=hidden;rotatable=0;points=[[0,0.5],[1,0.5]];portConstraint=eastwest;whiteSpace=wrap;html=1;" vertex="1" parent="uLgKkJphqwm_8STbQmNH-7">
<mxGeometry y="78" width="240" height="26" as="geometry" />
</mxCell>
<mxCell id="uLgKkJphqwm_8STbQmNH-12" value="&lt;div&gt;coolingSystem: CoolingSystem&lt;/div&gt;&lt;div&gt;&lt;br&gt;&lt;/div&gt;" style="text;strokeColor=none;fillColor=none;align=left;verticalAlign=top;spacingLeft=4;spacingRight=4;overflow=hidden;rotatable=0;points=[[0,0.5],[1,0.5]];portConstraint=eastwest;whiteSpace=wrap;html=1;" vertex="1" parent="uLgKkJphqwm_8STbQmNH-7">
<mxGeometry y="104" width="240" height="26" as="geometry" />
</mxCell>
<mxCell id="uLgKkJphqwm_8STbQmNH-14" value="&lt;div&gt;fan: Fan&lt;/div&gt;&lt;div&gt;&lt;br&gt;&lt;/div&gt;" style="text;strokeColor=none;fillColor=none;align=left;verticalAlign=top;spacingLeft=4;spacingRight=4;overflow=hidden;rotatable=0;points=[[0,0.5],[1,0.5]];portConstraint=eastwest;whiteSpace=wrap;html=1;" vertex="1" parent="uLgKkJphqwm_8STbQmNH-7">
<mxGeometry y="130" width="240" height="26" as="geometry" />
</mxCell>
<mxCell id="uLgKkJphqwm_8STbQmNH-46" value="&lt;div&gt;&lt;div&gt;temperatureSensor: Sensor&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;br&gt;&lt;/div&gt;" style="text;strokeColor=none;fillColor=none;align=left;verticalAlign=top;spacingLeft=4;spacingRight=4;overflow=hidden;rotatable=0;points=[[0,0.5],[1,0.5]];portConstraint=eastwest;whiteSpace=wrap;html=1;" vertex="1" parent="uLgKkJphqwm_8STbQmNH-7">
<mxGeometry y="156" width="240" height="26" as="geometry" />
</mxCell>
<mxCell id="uLgKkJphqwm_8STbQmNH-9" value="" style="line;strokeWidth=1;fillColor=none;align=left;verticalAlign=middle;spacingTop=-1;spacingLeft=3;spacingRight=3;rotatable=0;labelPosition=right;points=[];portConstraint=eastwest;strokeColor=inherit;" vertex="1" parent="uLgKkJphqwm_8STbQmNH-7">
<mxGeometry y="182" width="240" height="8" as="geometry" />
</mxCell>
<mxCell id="uLgKkJphqwm_8STbQmNH-10" value="&lt;div&gt;setDesiredTemperature(temp: float): void&lt;/div&gt;&lt;div&gt;&lt;br&gt;&lt;/div&gt;" style="text;strokeColor=none;fillColor=none;align=left;verticalAlign=top;spacingLeft=4;spacingRight=4;overflow=hidden;rotatable=0;points=[[0,0.5],[1,0.5]];portConstraint=eastwest;whiteSpace=wrap;html=1;" vertex="1" parent="uLgKkJphqwm_8STbQmNH-7">
<mxGeometry y="190" width="240" height="26" as="geometry" />
</mxCell>
<mxCell id="uLgKkJphqwm_8STbQmNH-15" value="&lt;div&gt;&lt;div&gt;getCurrentTemperature(): float&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;br&gt;&lt;/div&gt;" style="text;strokeColor=none;fillColor=none;align=left;verticalAlign=top;spacingLeft=4;spacingRight=4;overflow=hidden;rotatable=0;points=[[0,0.5],[1,0.5]];portConstraint=eastwest;whiteSpace=wrap;html=1;" vertex="1" parent="uLgKkJphqwm_8STbQmNH-7">
<mxGeometry y="216" width="240" height="26" as="geometry" />
</mxCell>
<mxCell id="uLgKkJphqwm_8STbQmNH-16" value="&lt;div&gt;&lt;div&gt;startHeating(): void&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;br&gt;&lt;/div&gt;" style="text;strokeColor=none;fillColor=none;align=left;verticalAlign=top;spacingLeft=4;spacingRight=4;overflow=hidden;rotatable=0;points=[[0,0.5],[1,0.5]];portConstraint=eastwest;whiteSpace=wrap;html=1;" vertex="1" parent="uLgKkJphqwm_8STbQmNH-7">
<mxGeometry y="242" width="240" height="26" as="geometry" />
</mxCell>
<mxCell id="uLgKkJphqwm_8STbQmNH-17" value="&lt;div&gt;&lt;div&gt;stopHeating(): void&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;br&gt;&lt;/div&gt;" style="text;strokeColor=none;fillColor=none;align=left;verticalAlign=top;spacingLeft=4;spacingRight=4;overflow=hidden;rotatable=0;points=[[0,0.5],[1,0.5]];portConstraint=eastwest;whiteSpace=wrap;html=1;" vertex="1" parent="uLgKkJphqwm_8STbQmNH-7">
<mxGeometry y="268" width="240" height="26" as="geometry" />
</mxCell>
<mxCell id="uLgKkJphqwm_8STbQmNH-18" value="&lt;div&gt;&lt;div&gt;startCooling(): void&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;br&gt;&lt;/div&gt;" style="text;strokeColor=none;fillColor=none;align=left;verticalAlign=top;spacingLeft=4;spacingRight=4;overflow=hidden;rotatable=0;points=[[0,0.5],[1,0.5]];portConstraint=eastwest;whiteSpace=wrap;html=1;" vertex="1" parent="uLgKkJphqwm_8STbQmNH-7">
<mxGeometry y="294" width="240" height="26" as="geometry" />
</mxCell>
<mxCell id="uLgKkJphqwm_8STbQmNH-19" value="&lt;div&gt;&lt;div&gt;&lt;div&gt;stopCooling(): void&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;br&gt;&lt;/div&gt;" style="text;strokeColor=none;fillColor=none;align=left;verticalAlign=top;spacingLeft=4;spacingRight=4;overflow=hidden;rotatable=0;points=[[0,0.5],[1,0.5]];portConstraint=eastwest;whiteSpace=wrap;html=1;" vertex="1" parent="uLgKkJphqwm_8STbQmNH-7">
<mxGeometry y="320" width="240" height="26" as="geometry" />
</mxCell>
<mxCell id="uLgKkJphqwm_8STbQmNH-20" value="&lt;div&gt;&lt;div&gt;&lt;div&gt;startFan(speed: int): void&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;br&gt;&lt;/div&gt;" style="text;strokeColor=none;fillColor=none;align=left;verticalAlign=top;spacingLeft=4;spacingRight=4;overflow=hidden;rotatable=0;points=[[0,0.5],[1,0.5]];portConstraint=eastwest;whiteSpace=wrap;html=1;" vertex="1" parent="uLgKkJphqwm_8STbQmNH-7">
<mxGeometry y="346" width="240" height="26" as="geometry" />
</mxCell>
<mxCell id="uLgKkJphqwm_8STbQmNH-21" value="&lt;div&gt;&lt;div&gt;&lt;div&gt;&lt;div&gt;stopFan(): void&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;br&gt;&lt;/div&gt;" style="text;strokeColor=none;fillColor=none;align=left;verticalAlign=top;spacingLeft=4;spacingRight=4;overflow=hidden;rotatable=0;points=[[0,0.5],[1,0.5]];portConstraint=eastwest;whiteSpace=wrap;html=1;" vertex="1" parent="uLgKkJphqwm_8STbQmNH-7">
<mxGeometry y="372" width="240" height="26" as="geometry" />
</mxCell>
<mxCell id="uLgKkJphqwm_8STbQmNH-47" value="&lt;div&gt;&lt;div&gt;&lt;div&gt;&lt;div&gt;&lt;div&gt;getTemperatureSensorValue(): float&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;br&gt;&lt;/div&gt;" style="text;strokeColor=none;fillColor=none;align=left;verticalAlign=top;spacingLeft=4;spacingRight=4;overflow=hidden;rotatable=0;points=[[0,0.5],[1,0.5]];portConstraint=eastwest;whiteSpace=wrap;html=1;" vertex="1" parent="uLgKkJphqwm_8STbQmNH-7">
<mxGeometry y="398" width="240" height="26" as="geometry" />
</mxCell>
<mxCell id="uLgKkJphqwm_8STbQmNH-26" value="HeatingSystem" style="swimlane;fontStyle=1;align=center;verticalAlign=top;childLayout=stackLayout;horizontal=1;startSize=26;horizontalStack=0;resizeParent=1;resizeParentMax=0;resizeLast=0;collapsible=1;marginBottom=0;whiteSpace=wrap;html=1;fillColor=#ffe6cc;strokeColor=#d79b00;" vertex="1" parent="1">
<mxGeometry x="360" y="80" width="240" height="112" as="geometry" />
</mxCell>
<mxCell id="uLgKkJphqwm_8STbQmNH-27" value="&lt;div&gt;heatingStatus: boolean&lt;/div&gt;&lt;div&gt;&lt;br&gt;&lt;/div&gt;" style="text;strokeColor=none;fillColor=none;align=left;verticalAlign=top;spacingLeft=4;spacingRight=4;overflow=hidden;rotatable=0;points=[[0,0.5],[1,0.5]];portConstraint=eastwest;whiteSpace=wrap;html=1;" vertex="1" parent="uLgKkJphqwm_8STbQmNH-26">
<mxGeometry y="26" width="240" height="26" as="geometry" />
</mxCell>
<mxCell id="uLgKkJphqwm_8STbQmNH-32" value="" style="line;strokeWidth=1;fillColor=none;align=left;verticalAlign=middle;spacingTop=-1;spacingLeft=3;spacingRight=3;rotatable=0;labelPosition=right;points=[];portConstraint=eastwest;strokeColor=inherit;" vertex="1" parent="uLgKkJphqwm_8STbQmNH-26">
<mxGeometry y="52" width="240" height="8" as="geometry" />
</mxCell>
<mxCell id="uLgKkJphqwm_8STbQmNH-33" value="&lt;div&gt;&lt;div&gt;startHeating(): void&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;br&gt;&lt;/div&gt;" style="text;strokeColor=none;fillColor=none;align=left;verticalAlign=top;spacingLeft=4;spacingRight=4;overflow=hidden;rotatable=0;points=[[0,0.5],[1,0.5]];portConstraint=eastwest;whiteSpace=wrap;html=1;" vertex="1" parent="uLgKkJphqwm_8STbQmNH-26">
<mxGeometry y="60" width="240" height="26" as="geometry" />
</mxCell>
<mxCell id="uLgKkJphqwm_8STbQmNH-34" value="&lt;div&gt;&lt;div&gt;&lt;div&gt;stopHeating(): void&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;br&gt;&lt;/div&gt;" style="text;strokeColor=none;fillColor=none;align=left;verticalAlign=top;spacingLeft=4;spacingRight=4;overflow=hidden;rotatable=0;points=[[0,0.5],[1,0.5]];portConstraint=eastwest;whiteSpace=wrap;html=1;" vertex="1" parent="uLgKkJphqwm_8STbQmNH-26">
<mxGeometry y="86" width="240" height="26" as="geometry" />
</mxCell>
<mxCell id="uLgKkJphqwm_8STbQmNH-41" value="CoolingSystem" style="swimlane;fontStyle=1;align=center;verticalAlign=top;childLayout=stackLayout;horizontal=1;startSize=26;horizontalStack=0;resizeParent=1;resizeParentMax=0;resizeLast=0;collapsible=1;marginBottom=0;whiteSpace=wrap;html=1;fillColor=#dae8fc;strokeColor=#6c8ebf;" vertex="1" parent="1">
<mxGeometry x="360" y="290" width="240" height="112" as="geometry" />
</mxCell>
<mxCell id="uLgKkJphqwm_8STbQmNH-42" value="&lt;div&gt;&lt;div&gt;coolingStatus: boolean&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;br&gt;&lt;/div&gt;" style="text;strokeColor=none;fillColor=none;align=left;verticalAlign=top;spacingLeft=4;spacingRight=4;overflow=hidden;rotatable=0;points=[[0,0.5],[1,0.5]];portConstraint=eastwest;whiteSpace=wrap;html=1;" vertex="1" parent="uLgKkJphqwm_8STbQmNH-41">
<mxGeometry y="26" width="240" height="26" as="geometry" />
</mxCell>
<mxCell id="uLgKkJphqwm_8STbQmNH-43" value="" style="line;strokeWidth=1;fillColor=none;align=left;verticalAlign=middle;spacingTop=-1;spacingLeft=3;spacingRight=3;rotatable=0;labelPosition=right;points=[];portConstraint=eastwest;strokeColor=inherit;" vertex="1" parent="uLgKkJphqwm_8STbQmNH-41">
<mxGeometry y="52" width="240" height="8" as="geometry" />
</mxCell>
<mxCell id="uLgKkJphqwm_8STbQmNH-44" value="&lt;div&gt;&lt;div&gt;&lt;div&gt;startCooling(): void&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;br&gt;&lt;/div&gt;" style="text;strokeColor=none;fillColor=none;align=left;verticalAlign=top;spacingLeft=4;spacingRight=4;overflow=hidden;rotatable=0;points=[[0,0.5],[1,0.5]];portConstraint=eastwest;whiteSpace=wrap;html=1;" vertex="1" parent="uLgKkJphqwm_8STbQmNH-41">
<mxGeometry y="60" width="240" height="26" as="geometry" />
</mxCell>
<mxCell id="uLgKkJphqwm_8STbQmNH-45" value="&lt;div&gt;&lt;div&gt;&lt;div&gt;&lt;div&gt;stopCooling(): void&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;br&gt;&lt;/div&gt;" style="text;strokeColor=none;fillColor=none;align=left;verticalAlign=top;spacingLeft=4;spacingRight=4;overflow=hidden;rotatable=0;points=[[0,0.5],[1,0.5]];portConstraint=eastwest;whiteSpace=wrap;html=1;" vertex="1" parent="uLgKkJphqwm_8STbQmNH-41">
<mxGeometry y="86" width="240" height="26" as="geometry" />
</mxCell>
<mxCell id="uLgKkJphqwm_8STbQmNH-48" value="Sensor" style="swimlane;fontStyle=1;align=center;verticalAlign=top;childLayout=stackLayout;horizontal=1;startSize=26;horizontalStack=0;resizeParent=1;resizeParentMax=0;resizeLast=0;collapsible=1;marginBottom=0;whiteSpace=wrap;html=1;fillColor=#f5f5f5;fontColor=#333333;strokeColor=#666666;" vertex="1" parent="1">
<mxGeometry x="60" y="550" width="240" height="86" as="geometry" />
</mxCell>
<mxCell id="uLgKkJphqwm_8STbQmNH-49" value="&lt;div&gt;&lt;div&gt;sensorValue: float&lt;br&gt;&lt;/div&gt;&lt;/div&gt;" style="text;strokeColor=none;fillColor=none;align=left;verticalAlign=top;spacingLeft=4;spacingRight=4;overflow=hidden;rotatable=0;points=[[0,0.5],[1,0.5]];portConstraint=eastwest;whiteSpace=wrap;html=1;" vertex="1" parent="uLgKkJphqwm_8STbQmNH-48">
<mxGeometry y="26" width="240" height="26" as="geometry" />
</mxCell>
<mxCell id="uLgKkJphqwm_8STbQmNH-50" value="" style="line;strokeWidth=1;fillColor=none;align=left;verticalAlign=middle;spacingTop=-1;spacingLeft=3;spacingRight=3;rotatable=0;labelPosition=right;points=[];portConstraint=eastwest;strokeColor=inherit;" vertex="1" parent="uLgKkJphqwm_8STbQmNH-48">
<mxGeometry y="52" width="240" height="8" as="geometry" />
</mxCell>
<mxCell id="uLgKkJphqwm_8STbQmNH-51" value="&lt;div&gt;&lt;div&gt;&lt;div&gt;getSensorValue(): float&lt;br&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;" style="text;strokeColor=none;fillColor=none;align=left;verticalAlign=top;spacingLeft=4;spacingRight=4;overflow=hidden;rotatable=0;points=[[0,0.5],[1,0.5]];portConstraint=eastwest;whiteSpace=wrap;html=1;" vertex="1" parent="uLgKkJphqwm_8STbQmNH-48">
<mxGeometry y="60" width="240" height="26" as="geometry" />
</mxCell>
<mxCell id="uLgKkJphqwm_8STbQmNH-54" value="Fan" style="swimlane;fontStyle=1;align=center;verticalAlign=top;childLayout=stackLayout;horizontal=1;startSize=26;horizontalStack=0;resizeParent=1;resizeParentMax=0;resizeLast=0;collapsible=1;marginBottom=0;whiteSpace=wrap;html=1;fillColor=#d5e8d4;strokeColor=#82b366;" vertex="1" parent="1">
<mxGeometry x="360" y="498" width="240" height="138" as="geometry" />
</mxCell>
<mxCell id="uLgKkJphqwm_8STbQmNH-55" value="&lt;div&gt;&lt;div&gt;fanStatus: boolean&lt;br&gt;&lt;/div&gt;&lt;/div&gt;" style="text;strokeColor=none;fillColor=none;align=left;verticalAlign=top;spacingLeft=4;spacingRight=4;overflow=hidden;rotatable=0;points=[[0,0.5],[1,0.5]];portConstraint=eastwest;whiteSpace=wrap;html=1;" vertex="1" parent="uLgKkJphqwm_8STbQmNH-54">
<mxGeometry y="26" width="240" height="26" as="geometry" />
</mxCell>
<mxCell id="uLgKkJphqwm_8STbQmNH-59" value="&lt;div&gt;&lt;div&gt;&lt;div&gt;fanSpeed: int&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;br&gt;&lt;/div&gt;" style="text;strokeColor=none;fillColor=none;align=left;verticalAlign=top;spacingLeft=4;spacingRight=4;overflow=hidden;rotatable=0;points=[[0,0.5],[1,0.5]];portConstraint=eastwest;whiteSpace=wrap;html=1;" vertex="1" parent="uLgKkJphqwm_8STbQmNH-54">
<mxGeometry y="52" width="240" height="26" as="geometry" />
</mxCell>
<mxCell id="uLgKkJphqwm_8STbQmNH-56" value="" style="line;strokeWidth=1;fillColor=none;align=left;verticalAlign=middle;spacingTop=-1;spacingLeft=3;spacingRight=3;rotatable=0;labelPosition=right;points=[];portConstraint=eastwest;strokeColor=inherit;" vertex="1" parent="uLgKkJphqwm_8STbQmNH-54">
<mxGeometry y="78" width="240" height="8" as="geometry" />
</mxCell>
<mxCell id="uLgKkJphqwm_8STbQmNH-57" value="&lt;div&gt;&lt;div&gt;&lt;div&gt;&lt;div&gt;startFan(speed: int): void&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;br&gt;&lt;/div&gt;" style="text;strokeColor=none;fillColor=none;align=left;verticalAlign=top;spacingLeft=4;spacingRight=4;overflow=hidden;rotatable=0;points=[[0,0.5],[1,0.5]];portConstraint=eastwest;whiteSpace=wrap;html=1;" vertex="1" parent="uLgKkJphqwm_8STbQmNH-54">
<mxGeometry y="86" width="240" height="26" as="geometry" />
</mxCell>
<mxCell id="uLgKkJphqwm_8STbQmNH-58" value="&lt;div&gt;&lt;div&gt;&lt;div&gt;&lt;div&gt;&lt;div&gt;stopFan(): void&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;br&gt;&lt;/div&gt;" style="text;strokeColor=none;fillColor=none;align=left;verticalAlign=top;spacingLeft=4;spacingRight=4;overflow=hidden;rotatable=0;points=[[0,0.5],[1,0.5]];portConstraint=eastwest;whiteSpace=wrap;html=1;" vertex="1" parent="uLgKkJphqwm_8STbQmNH-54">
<mxGeometry y="112" width="240" height="26" as="geometry" />
</mxCell>
<mxCell id="uLgKkJphqwm_8STbQmNH-60" value="" style="endArrow=block;startArrow=block;endFill=1;startFill=1;html=1;rounded=0;entryX=-0.003;entryY=0.127;entryDx=0;entryDy=0;entryPerimeter=0;edgeStyle=orthogonalEdgeStyle;exitX=1;exitY=0.5;exitDx=0;exitDy=0;fillColor=#ffe6cc;strokeColor=#d79b00;" edge="1" parent="1" source="uLgKkJphqwm_8STbQmNH-13" target="uLgKkJphqwm_8STbQmNH-26">
<mxGeometry width="160" relative="1" as="geometry">
<mxPoint x="300" y="94" as="sourcePoint" />
<mxPoint x="490" y="410" as="targetPoint" />
</mxGeometry>
</mxCell>
<mxCell id="uLgKkJphqwm_8STbQmNH-63" value="" style="endArrow=block;startArrow=block;endFill=1;startFill=1;html=1;rounded=0;entryX=-0.004;entryY=0.179;entryDx=0;entryDy=0;entryPerimeter=0;edgeStyle=orthogonalEdgeStyle;exitX=1;exitY=0.5;exitDx=0;exitDy=0;fillColor=#dae8fc;strokeColor=#6c8ebf;" edge="1" parent="1" source="uLgKkJphqwm_8STbQmNH-12" target="uLgKkJphqwm_8STbQmNH-41">
<mxGeometry width="160" relative="1" as="geometry">
<mxPoint x="300" y="135.57999999999998" as="sourcePoint" />
<mxPoint x="359" y="135.57999999999998" as="targetPoint" />
<Array as="points">
<mxPoint x="340" y="197" />
<mxPoint x="340" y="310" />
</Array>
</mxGeometry>
</mxCell>
<mxCell id="uLgKkJphqwm_8STbQmNH-65" value="" style="endArrow=block;startArrow=block;endFill=1;startFill=1;html=1;rounded=0;entryX=-0.001;entryY=0.132;entryDx=0;entryDy=0;entryPerimeter=0;edgeStyle=orthogonalEdgeStyle;exitX=1;exitY=0.553;exitDx=0;exitDy=0;exitPerimeter=0;fillColor=#d5e8d4;strokeColor=#82b366;" edge="1" parent="1" source="uLgKkJphqwm_8STbQmNH-14" target="uLgKkJphqwm_8STbQmNH-54">
<mxGeometry width="160" relative="1" as="geometry">
<mxPoint x="300" y="220" as="sourcePoint" />
<mxPoint x="359" y="333" as="targetPoint" />
<Array as="points">
<mxPoint x="310" y="224" />
<mxPoint x="330" y="224" />
<mxPoint x="330" y="516" />
</Array>
</mxGeometry>
</mxCell>
<mxCell id="uLgKkJphqwm_8STbQmNH-66" value="" style="endArrow=block;startArrow=block;endFill=1;startFill=1;html=1;rounded=0;edgeStyle=orthogonalEdgeStyle;exitX=1;exitY=0.553;exitDx=0;exitDy=0;exitPerimeter=0;fillColor=#f5f5f5;strokeColor=#666666;" edge="1" parent="1">
<mxGeometry width="160" relative="1" as="geometry">
<mxPoint x="300" y="250" as="sourcePoint" />
<mxPoint x="300" y="560" as="targetPoint" />
<Array as="points">
<mxPoint x="320" y="250" />
<mxPoint x="320" y="560" />
<mxPoint x="300" y="560" />
</Array>
</mxGeometry>
</mxCell>
</root>
</mxGraphModel>
</diagram>
</mxfile>

View File

@ -0,0 +1,260 @@
<?xml version="1.0" encoding="UTF-8"?>
<mxfile host="app.diagrams.net" modified="2025-09-17T01:00:00.000Z" agent="diagrams.net" etag="detailed_deployment_v1" version="21.3.8">
<diagram name="Page-1" id="detailed-thermostat-deployment">
<mxGraphModel dx="1400" dy="1000" grid="1" gridSize="10" guides="1" tooltips="1" connect="1" arrows="1" fold="1" page="1" pageScale="1" pageWidth="1600" pageHeight="1200" math="0" shadow="0">
<root>
<mxCell id="0" />
<mxCell id="1" parent="0" />
<!-- Title -->
<mxCell id="2" value="Smart Thermostat System - Detailed Deployment Diagram" style="text;html=1;align=center;verticalAlign=middle;whiteSpace=wrap;rounded=0;fontFamily=Arial;fontSize=18;fontStyle=1;" vertex="1" parent="1">
<mxGeometry x="500" y="30" width="600" height="30" as="geometry" />
</mxCell>
<!-- Mobile Device Node -->
<mxCell id="3" value="&lt;&lt;device&gt;&gt;&lt;br&gt;Mobile Device" style="html=1;whiteSpace=wrap;strokeWidth=3;fillColor=#4285f4;strokeColor=#ffffff;fontFamily=Arial;fontSize=14;fontColor=white;fontStyle=1;" vertex="1" parent="1">
<mxGeometry x="80" y="120" width="300" height="400" as="geometry" />
</mxCell>
<!-- Mobile App Component -->
<mxCell id="4" value="&lt;&lt;artifact&gt;&gt;&lt;br&gt;Smart Thermostat&lt;br&gt;Mobile App" style="html=1;whiteSpace=wrap;strokeWidth=2;fillColor=#ffffff;strokeColor=#333333;fontFamily=Arial;fontSize=11;fontStyle=1;" vertex="1" parent="1">
<mxGeometry x="110" y="180" width="240" height="80" as="geometry" />
</mxCell>
<!-- Mobile Database -->
<mxCell id="5" value="&lt;&lt;database&gt;&gt;&lt;br&gt;Local Cache DB" style="html=1;whiteSpace=wrap;strokeWidth=2;fillColor=#f0f0f0;strokeColor=#666666;fontFamily=Arial;fontSize=10;" vertex="1" parent="1">
<mxGeometry x="130" y="290" width="100" height="60" as="geometry" />
</mxCell>
<!-- User Interface -->
<mxCell id="6" value="&lt;&lt;interface&gt;&gt;&lt;br&gt;User Interface" style="html=1;whiteSpace=wrap;strokeWidth=2;fillColor=#f0f0f0;strokeColor=#666666;fontFamily=Arial;fontSize=10;" vertex="1" parent="1">
<mxGeometry x="250" y="290" width="100" height="60" as="geometry" />
</mxCell>
<!-- User Actor -->
<mxCell id="7" value="" style="shape=umlActor;verticalLabelPosition=bottom;verticalAlign=top;html=1;fillColor=#ff6b6b;" vertex="1" parent="1">
<mxGeometry x="215" y="420" width="30" height="60" as="geometry" />
</mxCell>
<mxCell id="8" value="User" style="text;html=1;align=center;verticalAlign=middle;whiteSpace=wrap;rounded=0;fontFamily=Arial;fontSize=12;fontStyle=1;" vertex="1" parent="1">
<mxGeometry x="190" y="490" width="80" height="20" as="geometry" />
</mxCell>
<!-- Cloud Server Node -->
<mxCell id="9" value="&lt;&lt;device&gt;&gt;&lt;br&gt;Smart Thermostat Cloud Server" style="html=1;whiteSpace=wrap;strokeWidth=3;fillColor=#4285f4;strokeColor=#ffffff;fontFamily=Arial;fontSize=14;fontColor=white;fontStyle=1;" vertex="1" parent="1">
<mxGeometry x="480" y="120" width="300" height="400" as="geometry" />
</mxCell>
<!-- Server Application -->
<mxCell id="10" value="&lt;&lt;artifact&gt;&gt;&lt;br&gt;Smart Thermostat&lt;br&gt;Server Application" style="html=1;whiteSpace=wrap;strokeWidth=2;fillColor=#ffffff;strokeColor=#333333;fontFamily=Arial;fontSize=11;fontStyle=1;" vertex="1" parent="1">
<mxGeometry x="510" y="180" width="240" height="80" as="geometry" />
</mxCell>
<!-- Server Database -->
<mxCell id="11" value="&lt;&lt;database&gt;&gt;&lt;br&gt;Thermostat Data DB" style="html=1;whiteSpace=wrap;strokeWidth=2;fillColor=#f0f0f0;strokeColor=#666666;fontFamily=Arial;fontSize=10;" vertex="1" parent="1">
<mxGeometry x="530" y="290" width="100" height="60" as="geometry" />
</mxCell>
<!-- User Management DB -->
<mxCell id="12" value="&lt;&lt;database&gt;&gt;&lt;br&gt;User Management DB" style="html=1;whiteSpace=wrap;strokeWidth=2;fillColor=#f0f0f0;strokeColor=#666666;fontFamily=Arial;fontSize=10;" vertex="1" parent="1">
<mxGeometry x="650" y="290" width="100" height="60" as="geometry" />
</mxCell>
<!-- Analytics DB -->
<mxCell id="13" value="&lt;&lt;database&gt;&gt;&lt;br&gt;Analytics &amp; Logs DB" style="html=1;whiteSpace=wrap;strokeWidth=2;fillColor=#f0f0f0;strokeColor=#666666;fontFamily=Arial;fontSize=10;" vertex="1" parent="1">
<mxGeometry x="590" y="370" width="100" height="60" as="geometry" />
</mxCell>
<!-- Database Server Node -->
<mxCell id="14" value="&lt;&lt;device&gt;&gt;&lt;br&gt;Database Server" style="html=1;whiteSpace=wrap;strokeWidth=3;fillColor=#4285f4;strokeColor=#ffffff;fontFamily=Arial;fontSize=14;fontColor=white;fontStyle=1;" vertex="1" parent="1">
<mxGeometry x="880" y="120" width="300" height="400" as="geometry" />
</mxCell>
<!-- SQL Server -->
<mxCell id="15" value="&lt;&lt;artifact&gt;&gt;&lt;br&gt;SQL Server&lt;br&gt;Database Engine" style="html=1;whiteSpace=wrap;strokeWidth=2;fillColor=#ffffff;strokeColor=#333333;fontFamily=Arial;fontSize=11;fontStyle=1;" vertex="1" parent="1">
<mxGeometry x="910" y="180" width="240" height="80" as="geometry" />
</mxCell>
<!-- Temperature History DB -->
<mxCell id="16" value="&lt;&lt;database&gt;&gt;&lt;br&gt;Temperature History DB" style="html=1;whiteSpace=wrap;strokeWidth=2;fillColor=#f0f0f0;strokeColor=#666666;fontFamily=Arial;fontSize=10;" vertex="1" parent="1">
<mxGeometry x="930" y="290" width="120" height="50" as="geometry" />
</mxCell>
<!-- Energy Usage DB -->
<mxCell id="17" value="&lt;&lt;database&gt;&gt;&lt;br&gt;Energy Usage DB" style="html=1;whiteSpace=wrap;strokeWidth=2;fillColor=#f0f0f0;strokeColor=#666666;fontFamily=Arial;fontSize=10;" vertex="1" parent="1">
<mxGeometry x="1060" y="290" width="120" height="50" as="geometry" />
</mxCell>
<!-- Device Registry DB -->
<mxCell id="18" value="&lt;&lt;database&gt;&gt;&lt;br&gt;Device Registry DB" style="html=1;whiteSpace=wrap;strokeWidth=2;fillColor=#f0f0f0;strokeColor=#666666;fontFamily=Arial;fontSize=10;" vertex="1" parent="1">
<mxGeometry x="930" y="360" width="120" height="50" as="geometry" />
</mxCell>
<!-- Settings & Config DB -->
<mxCell id="19" value="&lt;&lt;database&gt;&gt;&lt;br&gt;Settings &amp; Config DB" style="html=1;whiteSpace=wrap;strokeWidth=2;fillColor=#f0f0f0;strokeColor=#666666;fontFamily=Arial;fontSize=10;" vertex="1" parent="1">
<mxGeometry x="1060" y="360" width="120" height="50" as="geometry" />
</mxCell>
<!-- Smart Thermostat Device Node -->
<mxCell id="20" value="&lt;&lt;device&gt;&gt;&lt;br&gt;Smart Thermostat Control Unit" style="html=1;whiteSpace=wrap;strokeWidth=3;fillColor=#4285f4;strokeColor=#ffffff;fontFamily=Arial;fontSize=14;fontColor=white;fontStyle=1;" vertex="1" parent="1">
<mxGeometry x="80" y="600" width="300" height="400" as="geometry" />
</mxCell>
<!-- Thermostat OS -->
<mxCell id="21" value="&lt;&lt;artifact&gt;&gt;&lt;br&gt;Smart Thermostat&lt;br&gt;Operating System" style="html=1;whiteSpace=wrap;strokeWidth=2;fillColor=#ffffff;strokeColor=#333333;fontFamily=Arial;fontSize=11;fontStyle=1;" vertex="1" parent="1">
<mxGeometry x="110" y="660" width="240" height="80" as="geometry" />
</mxCell>
<!-- Local Settings DB -->
<mxCell id="22" value="&lt;&lt;database&gt;&gt;&lt;br&gt;Local Settings DB" style="html=1;whiteSpace=wrap;strokeWidth=2;fillColor=#f0f0f0;strokeColor=#666666;fontFamily=Arial;fontSize=10;" vertex="1" parent="1">
<mxGeometry x="130" y="770" width="100" height="60" as="geometry" />
</mxCell>
<!-- Control Panel Interface -->
<mxCell id="23" value="&lt;&lt;interface&gt;&gt;&lt;br&gt;Physical Control Panel" style="html=1;whiteSpace=wrap;strokeWidth=2;fillColor=#f0f0f0;strokeColor=#666666;fontFamily=Arial;fontSize=10;" vertex="1" parent="1">
<mxGeometry x="250" y="770" width="100" height="60" as="geometry" />
</mxCell>
<!-- User Interface (Physical) -->
<mxCell id="24" value="" style="shape=umlActor;verticalLabelPosition=bottom;verticalAlign=top;html=1;fillColor=#ff6b6b;" vertex="1" parent="1">
<mxGeometry x="215" y="880" width="30" height="60" as="geometry" />
</mxCell>
<mxCell id="25" value="Physical Access" style="text;html=1;align=center;verticalAlign=middle;whiteSpace=wrap;rounded=0;fontFamily=Arial;fontSize=12;fontStyle=1;" vertex="1" parent="1">
<mxGeometry x="180" y="950" width="100" height="20" as="geometry" />
</mxCell>
<!-- Smart Home Components Node -->
<mxCell id="26" value="&lt;&lt;device&gt;&gt;&lt;br&gt;Smart Home Components" style="html=1;whiteSpace=wrap;strokeWidth=3;fillColor=#4285f4;strokeColor=#ffffff;fontFamily=Arial;fontSize=14;fontColor=white;fontStyle=1;" vertex="1" parent="1">
<mxGeometry x="480" y="600" width="300" height="400" as="geometry" />
</mxCell>
<!-- Temperature Sensors -->
<mxCell id="27" value="&lt;&lt;device&gt;&gt;&lt;br&gt;Temperature Sensors" style="html=1;whiteSpace=wrap;strokeWidth=2;fillColor=#ffffff;strokeColor=#333333;fontFamily=Arial;fontSize=11;fontStyle=1;" vertex="1" parent="1">
<mxGeometry x="510" y="660" width="120" height="60" as="geometry" />
</mxCell>
<!-- Humidity Sensors -->
<mxCell id="28" value="&lt;&lt;device&gt;&gt;&lt;br&gt;Humidity Sensors" style="html=1;whiteSpace=wrap;strokeWidth=2;fillColor=#ffffff;strokeColor=#333333;fontFamily=Arial;fontSize=11;fontStyle=1;" vertex="1" parent="1">
<mxGeometry x="650" y="660" width="120" height="60" as="geometry" />
</mxCell>
<!-- Motion Sensors -->
<mxCell id="29" value="&lt;&lt;device&gt;&gt;&lt;br&gt;Motion/Occupancy&lt;br&gt;Sensors" style="html=1;whiteSpace=wrap;strokeWidth=2;fillColor=#ffffff;strokeColor=#333333;fontFamily=Arial;fontSize=11;fontStyle=1;" vertex="1" parent="1">
<mxGeometry x="510" y="750" width="120" height="60" as="geometry" />
</mxCell>
<!-- Smart Vents -->
<mxCell id="30" value="&lt;&lt;device&gt;&gt;&lt;br&gt;Smart Air Vents" style="html=1;whiteSpace=wrap;strokeWidth=2;fillColor=#ffffff;strokeColor=#333333;fontFamily=Arial;fontSize=11;fontStyle=1;" vertex="1" parent="1">
<mxGeometry x="650" y="750" width="120" height="60" as="geometry" />
</mxCell>
<!-- HVAC Interface -->
<mxCell id="31" value="&lt;&lt;interface&gt;&gt;&lt;br&gt;HVAC Control Interface" style="html=1;whiteSpace=wrap;strokeWidth=2;fillColor=#f0f0f0;strokeColor=#666666;fontFamily=Arial;fontSize=10;" vertex="1" parent="1">
<mxGeometry x="580" y="840" width="120" height="60" as="geometry" />
</mxCell>
<!-- HVAC System Node -->
<mxCell id="32" value="&lt;&lt;device&gt;&gt;&lt;br&gt;HVAC System" style="html=1;whiteSpace=wrap;strokeWidth=3;fillColor=#4285f4;strokeColor=#ffffff;fontFamily=Arial;fontSize=14;fontColor=white;fontStyle=1;" vertex="1" parent="1">
<mxGeometry x="880" y="600" width="300" height="400" as="geometry" />
</mxCell>
<!-- Heating Unit -->
<mxCell id="33" value="&lt;&lt;device&gt;&gt;&lt;br&gt;Heating Unit&lt;br&gt;(Furnace/Boiler)" style="html=1;whiteSpace=wrap;strokeWidth=2;fillColor=#ffffff;strokeColor=#333333;fontFamily=Arial;fontSize=11;fontStyle=1;" vertex="1" parent="1">
<mxGeometry x="910" y="660" width="120" height="60" as="geometry" />
</mxCell>
<!-- Cooling Unit -->
<mxCell id="34" value="&lt;&lt;device&gt;&gt;&lt;br&gt;Cooling Unit&lt;br&gt;(Air Conditioner)" style="html=1;whiteSpace=wrap;strokeWidth=2;fillColor=#ffffff;strokeColor=#333333;fontFamily=Arial;fontSize=11;fontStyle=1;" vertex="1" parent="1">
<mxGeometry x="1050" y="660" width="120" height="60" as="geometry" />
</mxCell>
<!-- Ventilation System -->
<mxCell id="35" value="&lt;&lt;device&gt;&gt;&lt;br&gt;Ventilation System&lt;br&gt;(Fans &amp; Ducts)" style="html=1;whiteSpace=wrap;strokeWidth=2;fillColor=#ffffff;strokeColor=#333333;fontFamily=Arial;fontSize=11;fontStyle=1;" vertex="1" parent="1">
<mxGeometry x="910" y="750" width="120" height="60" as="geometry" />
</mxCell>
<!-- Air Quality Control -->
<mxCell id="36" value="&lt;&lt;device&gt;&gt;&lt;br&gt;Air Quality Control&lt;br&gt;(Filters &amp; Purifiers)" style="html=1;whiteSpace=wrap;strokeWidth=2;fillColor=#ffffff;strokeColor=#333333;fontFamily=Arial;fontSize=11;fontStyle=1;" vertex="1" parent="1">
<mxGeometry x="1050" y="750" width="120" height="60" as="geometry" />
</mxCell>
<!-- HVAC Controller -->
<mxCell id="37" value="&lt;&lt;artifact&gt;&gt;&lt;br&gt;HVAC Control System" style="html=1;whiteSpace=wrap;strokeWidth=2;fillColor=#f0f0f0;strokeColor=#666666;fontFamily=Arial;fontSize=10;" vertex="1" parent="1">
<mxGeometry x="980" y="840" width="120" height="60" as="geometry" />
</mxCell>
<!-- Communication Lines -->
<!-- HTTPS Connection Mobile to Server -->
<mxCell id="38" value="" style="endArrow=none;html=1;rounded=0;strokeWidth=3;strokeColor=#ff9800;fontFamily=Arial;fontSize=11;" edge="1" parent="1" source="3" target="9">
<mxGeometry relative="1" as="geometry" />
</mxCell>
<mxCell id="39" value="HTTPS / REST API&lt;br&gt;TCP/IP over Internet" style="edgeLabel;resizable=0;html=1;align=center;verticalAlign=middle;fontFamily=Arial;fontSize=11;fontStyle=1;backgroundColor=white;" connectable="0" vertex="1" parent="38">
<mxGeometry relative="1" as="geometry" />
</mxCell>
<!-- SQL Connection Server to DB -->
<mxCell id="40" value="" style="endArrow=none;html=1;rounded=0;strokeWidth=3;strokeColor=#9c27b0;fontFamily=Arial;fontSize=11;" edge="1" parent="1" source="9" target="14">
<mxGeometry relative="1" as="geometry" />
</mxCell>
<mxCell id="41" value="SQL / TCP-IP&lt;br&gt;Database Queries" style="edgeLabel;resizable=0;html=1;align=center;verticalAlign=middle;fontFamily=Arial;fontSize=11;fontStyle=1;backgroundColor=white;" connectable="0" vertex="1" parent="40">
<mxGeometry relative="1" as="geometry" />
</mxCell>
<!-- MQTT/WiFi Connection Server to Thermostat -->
<mxCell id="42" value="" style="endArrow=none;html=1;rounded=0;strokeWidth=3;strokeColor=#4caf50;fontFamily=Arial;fontSize=11;" edge="1" parent="1" source="9" target="20">
<mxGeometry relative="1" as="geometry" />
</mxCell>
<mxCell id="43" value="MQTT over TLS&lt;br&gt;WiFi / TCP-IP" style="edgeLabel;resizable=0;html=1;align=center;verticalAlign=middle;fontFamily=Arial;fontSize=11;fontStyle=1;backgroundColor=white;" connectable="0" vertex="1" parent="42">
<mxGeometry relative="1" as="geometry" />
</mxCell>
<!-- IoT Connection Thermostat to Smart Components -->
<mxCell id="44" value="" style="endArrow=none;html=1;rounded=0;strokeWidth=3;strokeColor=#2196f3;fontFamily=Arial;fontSize=11;" edge="1" parent="1" source="20" target="26">
<mxGeometry relative="1" as="geometry" />
</mxCell>
<mxCell id="45" value="Zigbee / Bluetooth LE&lt;br&gt;IoT Mesh Network" style="edgeLabel;resizable=0;html=1;align=center;verticalAlign=middle;fontFamily=Arial;fontSize=11;fontStyle=1;backgroundColor=white;" connectable="0" vertex="1" parent="44">
<mxGeometry relative="1" as="geometry" />
</mxCell>
<!-- Wired Connection Smart Components to HVAC -->
<mxCell id="46" value="" style="endArrow=none;html=1;rounded=0;strokeWidth=3;strokeColor=#f44336;fontFamily=Arial;fontSize=11;" edge="1" parent="1" source="26" target="32">
<mxGeometry relative="1" as="geometry" />
</mxCell>
<mxCell id="47" value="24V DC Wired Control&lt;br&gt;Direct Physical Connection" style="edgeLabel;resizable=0;html=1;align=center;verticalAlign=middle;fontFamily=Arial;fontSize=11;fontStyle=1;backgroundColor=white;" connectable="0" vertex="1" parent="46">
<mxGeometry relative="1" as="geometry" />
</mxCell>
<!-- Protocol Legend -->
<mxCell id="48" value="Communication Protocols:" style="text;html=1;align=left;verticalAlign=middle;whiteSpace=wrap;rounded=0;fontFamily=Arial;fontSize=14;fontStyle=1;" vertex="1" parent="1">
<mxGeometry x="1300" y="150" width="200" height="30" as="geometry" />
</mxCell>
<mxCell id="49" value="• HTTPS/REST = Secure web API communication" style="text;html=1;align=left;verticalAlign=middle;whiteSpace=wrap;rounded=0;fontFamily=Arial;fontSize=11;strokeColor=#ff9800;strokeWidth=2;" vertex="1" parent="1">
<mxGeometry x="1300" y="185" width="280" height="20" as="geometry" />
</mxCell>
<mxCell id="50" value="• SQL/TCP-IP = Database server communication" style="text;html=1;align=left;verticalAlign=middle;whiteSpace=wrap;rounded=0;fontFamily=Arial;fontSize=11;strokeColor=#9c27b0;strokeWidth=2;" vertex="1" parent="1">
<mxGeometry x="1300" y="210" width="280" height="20" as="geometry" />
</mxCell>
<mxCell id="51" value="• MQTT/TLS = IoT messaging protocol" style="text;html=1;align=left;verticalAlign=middle;whiteSpace=wrap;rounded=0;fontFamily=Arial;fontSize=11;strokeColor=#4caf50;strokeWidth=2;" vertex="1" parent="1">
<mxGeometry x="1300" y="235" width="280" height="20" as="geometry" />
</mxCell>
<mxCell id="52" value="• Zigbee/BLE = Low-power IoT mesh network" style="text;html=1;align=left;verticalAlign=middle;whiteSpace=wrap;rounded=0;fontFamily=Arial;fontSize=11;strokeColor=#2196f3;strokeWidth=2;" vertex="1" parent="1">
<mxGeometry x="1300" y="260" width="280" height="20" as="geometry" />
</mxCell>
<mxCell id="53" value="• 24V DC Wired = Direct HVAC control signals" style="text;html=1;align=left;verticalAlign=middle;whiteSpace=wrap;rounded=0;fontFamily=Arial;fontSize=11;strokeColor=#f44336;strokeWidth=2;" vertex="1" parent="1">
<mxGeometry x="1300" y="285" width="280" height="20" as="geometry" />
</mxCell>
<!-- Footer -->
<mxCell id="54" value="The completed UML deployment diagram showing detailed smart thermostat system architecture" style="text;html=1;align=center;verticalAlign=middle;whiteSpace=wrap;rounded=0;fontFamily=Arial;fontSize=12;fontStyle=2;" vertex="1" parent="1">
<mxGeometry x="400" y="1050" width="800" height="30" as="geometry" />
</mxCell>
</root>
</mxGraphModel>
</diagram>
</mxfile>

View File

@ -0,0 +1,178 @@
<?xml version="1.0" encoding="UTF-8"?>
<mxfile host="app.diagrams.net" modified="2023-09-17T10:00:00.000Z" agent="Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36" etag="thermostat_seq_v2" version="21.3.8">
<diagram name="Page-1" id="thermostat-sequence-improved">
<mxGraphModel dx="1200" dy="800" grid="1" gridSize="10" guides="1" tooltips="1" connect="1" arrows="1" fold="1" page="1" pageScale="1" pageWidth="1400" pageHeight="900" background="none" math="0" shadow="0">
<root>
<mxCell id="0" />
<mxCell id="1" parent="0" />
<!-- User Lifeline -->
<mxCell id="2" value="Home Owner/User" style="shape=umlLifeline;perimeter=lifelinePerimeter;whiteSpace=wrap;html=1;container=1;collapsible=0;recursiveResize=0;outlineConnect=0;rounded=1;shadow=0;comic=0;labelBackgroundColor=none;strokeWidth=1;fontFamily=Verdana;fontSize=12;align=center;size=40;" parent="1" vertex="1">
<mxGeometry x="80" y="80" width="120" height="650" as="geometry" />
</mxCell>
<mxCell id="3" value="" style="shape=umlActor;verticalLabelPosition=bottom;verticalAlign=top;html=1;" vertex="1" parent="2">
<mxGeometry x="55" y="5" width="10" height="20" as="geometry" />
</mxCell>
<mxCell id="4" value="" style="html=1;points=[];perimeter=orthogonalPerimeter;rounded=0;shadow=0;comic=0;labelBackgroundColor=none;strokeWidth=1;fontFamily=Verdana;fontSize=12;align=center;" parent="2" vertex="1">
<mxGeometry x="55" y="80" width="10" height="40" as="geometry" />
</mxCell>
<mxCell id="5" value="" style="html=1;points=[];perimeter=orthogonalPerimeter;rounded=0;shadow=0;comic=0;labelBackgroundColor=none;strokeWidth=1;fontFamily=Verdana;fontSize=12;align=center;" parent="2" vertex="1">
<mxGeometry x="55" y="320" width="10" height="40" as="geometry" />
</mxCell>
<mxCell id="6" value="" style="html=1;points=[];perimeter=orthogonalPerimeter;rounded=0;shadow=0;comic=0;labelBackgroundColor=none;strokeWidth=1;fontFamily=Verdana;fontSize=12;align=center;" parent="2" vertex="1">
<mxGeometry x="55" y="480" width="10" height="120" as="geometry" />
</mxCell>
<!-- Mobile App Lifeline -->
<mxCell id="7" value="Mobile APP" style="shape=umlLifeline;perimeter=lifelinePerimeter;whiteSpace=wrap;html=1;container=1;collapsible=0;recursiveResize=0;outlineConnect=0;rounded=1;shadow=0;comic=0;labelBackgroundColor=none;strokeWidth=1;fontFamily=Verdana;fontSize=12;align=center;size=40;" parent="1" vertex="1">
<mxGeometry x="280" y="80" width="120" height="650" as="geometry" />
</mxCell>
<mxCell id="8" value="" style="shape=umlBoundary;whiteSpace=wrap;html=1;" vertex="1" parent="7">
<mxGeometry x="48" y="5" width="24" height="20" as="geometry" />
</mxCell>
<mxCell id="9" value="" style="html=1;points=[];perimeter=orthogonalPerimeter;rounded=0;shadow=0;comic=0;labelBackgroundColor=none;strokeWidth=1;fontFamily=Verdana;fontSize=12;align=center;" parent="7" vertex="1">
<mxGeometry x="55" y="80" width="10" height="60" as="geometry" />
</mxCell>
<mxCell id="10" value="" style="html=1;points=[];perimeter=orthogonalPerimeter;rounded=0;shadow=0;comic=0;labelBackgroundColor=none;strokeWidth=1;fontFamily=Verdana;fontSize=12;align=center;" parent="7" vertex="1">
<mxGeometry x="55" y="280" width="10" height="80" as="geometry" />
</mxCell>
<mxCell id="11" value="" style="html=1;points=[];perimeter=orthogonalPerimeter;rounded=0;shadow=0;comic=0;labelBackgroundColor=none;strokeWidth=1;fontFamily=Verdana;fontSize=12;align=center;" parent="7" vertex="1">
<mxGeometry x="55" y="480" width="10" height="120" as="geometry" />
</mxCell>
<!-- Thermostat System Lifeline -->
<mxCell id="12" value="Smart Thermostat System" style="shape=umlLifeline;perimeter=lifelinePerimeter;whiteSpace=wrap;html=1;container=1;collapsible=0;recursiveResize=0;outlineConnect=0;rounded=1;shadow=0;comic=0;labelBackgroundColor=none;strokeWidth=1;fontFamily=Verdana;fontSize=12;align=center;size=40;" parent="1" vertex="1">
<mxGeometry x="480" y="80" width="150" height="650" as="geometry" />
</mxCell>
<mxCell id="13" value="" style="ellipse;shape=umlEntity;whiteSpace=wrap;html=1;" vertex="1" parent="12">
<mxGeometry x="65" y="5" width="20" height="20" as="geometry" />
</mxCell>
<mxCell id="14" value="" style="html=1;points=[];perimeter=orthogonalPerimeter;rounded=0;shadow=0;comic=0;labelBackgroundColor=none;strokeWidth=1;fontFamily=Verdana;fontSize=12;align=center;" parent="12" vertex="1">
<mxGeometry x="70" y="120" width="10" height="120" as="geometry" />
</mxCell>
<mxCell id="15" value="" style="html=1;points=[];perimeter=orthogonalPerimeter;rounded=0;shadow=0;comic=0;labelBackgroundColor=none;strokeWidth=1;fontFamily=Verdana;fontSize=12;align=center;" parent="12" vertex="1">
<mxGeometry x="70" y="420" width="10" height="180" as="geometry" />
</mxCell>
<!-- HVAC System Lifeline -->
<mxCell id="16" value="HVAC System" style="shape=umlLifeline;perimeter=lifelinePerimeter;whiteSpace=wrap;html=1;container=1;collapsible=0;recursiveResize=0;outlineConnect=0;rounded=1;shadow=0;comic=0;labelBackgroundColor=none;strokeWidth=1;fontFamily=Verdana;fontSize=12;align=center;size=40;" parent="1" vertex="1">
<mxGeometry x="720" y="80" width="120" height="650" as="geometry" />
</mxCell>
<mxCell id="17" value="" style="ellipse;shape=umlEntity;whiteSpace=wrap;html=1;" vertex="1" parent="16">
<mxGeometry x="50" y="5" width="20" height="20" as="geometry" />
</mxCell>
<mxCell id="18" value="" style="html=1;points=[];perimeter=orthogonalPerimeter;rounded=0;shadow=0;comic=0;labelBackgroundColor=none;strokeWidth=1;fontFamily=Verdana;fontSize=12;align=center;" parent="16" vertex="1">
<mxGeometry x="55" y="160" width="10" height="80" as="geometry" />
</mxCell>
<mxCell id="19" value="" style="html=1;points=[];perimeter=orthogonalPerimeter;rounded=0;shadow=0;comic=0;labelBackgroundColor=none;strokeWidth=1;fontFamily=Verdana;fontSize=12;align=center;" parent="16" vertex="1">
<mxGeometry x="55" y="450" width="10" height="150" as="geometry" />
</mxCell>
<!-- Message 1: User to Mobile App -->
<mxCell id="20" value="" style="endArrow=classic;html=1;rounded=0;" edge="1" parent="1" source="4" target="9">
<mxGeometry relative="1" as="geometry" />
</mxCell>
<mxCell id="21" value="1. Set Temperature" style="edgeLabel;resizable=0;html=1;align=center;verticalAlign=middle;" connectable="0" vertex="1" parent="20">
<mxGeometry relative="1" as="geometry" />
</mxCell>
<!-- Message 2: Mobile App to Thermostat -->
<mxCell id="22" value="" style="endArrow=classic;html=1;rounded=0;" edge="1" parent="1" source="9" target="14">
<mxGeometry relative="1" as="geometry" />
</mxCell>
<mxCell id="23" value="2. Send Temperature Command" style="edgeLabel;resizable=0;html=1;align=center;verticalAlign=middle;" connectable="0" vertex="1" parent="22">
<mxGeometry relative="1" as="geometry" />
</mxCell>
<!-- Message 3: Thermostat to HVAC -->
<mxCell id="24" value="" style="endArrow=classic;html=1;rounded=0;" edge="1" parent="1" source="14" target="18">
<mxGeometry relative="1" as="geometry" />
</mxCell>
<mxCell id="25" value="3. Adjust HVAC Settings" style="edgeLabel;resizable=0;html=1;align=center;verticalAlign=middle;" connectable="0" vertex="1" parent="24">
<mxGeometry relative="1" as="geometry" />
</mxCell>
<!-- Message 4: HVAC to Thermostat (return) -->
<mxCell id="26" value="" style="endArrow=classic;html=1;rounded=0;dashed=1;" edge="1" parent="1" source="18" target="14">
<mxGeometry relative="1" as="geometry">
<mxPoint x="775" y="280" as="sourcePoint" />
<mxPoint x="560" y="280" as="targetPoint" />
</mxGeometry>
</mxCell>
<mxCell id="27" value="4. Status Acknowledgment" style="edgeLabel;resizable=0;html=1;align=center;verticalAlign=middle;" connectable="0" vertex="1" parent="26">
<mxGeometry relative="1" as="geometry" />
</mxCell>
<!-- Message 5: Thermostat to Mobile App (return) -->
<mxCell id="28" value="" style="endArrow=classic;html=1;rounded=0;dashed=1;" edge="1" parent="1" source="14" target="10">
<mxGeometry relative="1" as="geometry">
<mxPoint x="550" y="320" as="sourcePoint" />
<mxPoint x="345" y="320" as="targetPoint" />
</mxGeometry>
</mxCell>
<mxCell id="29" value="5. Send Confirmation" style="edgeLabel;resizable=0;html=1;align=center;verticalAlign=middle;" connectable="0" vertex="1" parent="28">
<mxGeometry relative="1" as="geometry" />
</mxCell>
<!-- Message 6: Mobile App to User (return) -->
<mxCell id="30" value="" style="endArrow=classic;html=1;rounded=0;dashed=1;" edge="1" parent="1" source="10" target="5">
<mxGeometry relative="1" as="geometry" />
</mxCell>
<mxCell id="31" value="6. Display Confirmation" style="edgeLabel;resizable=0;html=1;align=center;verticalAlign=middle;" connectable="0" vertex="1" parent="30">
<mxGeometry relative="1" as="geometry" />
</mxCell>
<!-- Loop Frame for continuous monitoring -->
<mxCell id="32" value="loop" style="shape=umlFrame;whiteSpace=wrap;html=1;width=60;height=30;boundedLbl=1;" vertex="1" parent="1">
<mxGeometry x="480" y="400" width="380" height="220" as="geometry" />
</mxCell>
<mxCell id="33" value="[Continuous Operation]" style="text;html=1;align=left;verticalAlign=top;whiteSpace=wrap;rounded=0;fontSize=10;fontStyle=2;" vertex="1" parent="1">
<mxGeometry x="550" y="405" width="120" height="20" as="geometry" />
</mxCell>
<!-- Message 7: HVAC to Thermostat (continuous updates) -->
<mxCell id="34" value="" style="endArrow=classic;html=1;rounded=0;" edge="1" parent="1" source="19" target="15">
<mxGeometry relative="1" as="geometry">
<mxPoint x="775" y="520" as="sourcePoint" />
<mxPoint x="560" y="520" as="targetPoint" />
</mxGeometry>
</mxCell>
<mxCell id="35" value="7. Temperature Updates" style="edgeLabel;resizable=0;html=1;align=center;verticalAlign=middle;" connectable="0" vertex="1" parent="34">
<mxGeometry relative="1" as="geometry" />
</mxCell>
<!-- Message 8: Thermostat self-call -->
<mxCell id="36" value="8. Monitor &amp; Control" style="html=1;align=left;spacingLeft=2;endArrow=block;rounded=0;edgeStyle=orthogonalEdgeStyle;curved=0;rounded=0;" edge="1" parent="1" target="15">
<mxGeometry relative="1" as="geometry">
<mxPoint x="560" y="540" as="sourcePoint" />
<Array as="points">
<mxPoint x="590" y="540" />
<mxPoint x="590" y="560" />
</Array>
</mxGeometry>
</mxCell>
<!-- Message 9: Thermostat to Mobile App (status updates) -->
<mxCell id="37" value="" style="endArrow=classic;html=1;rounded=0;dashed=1;" edge="1" parent="1" source="15" target="11">
<mxGeometry relative="1" as="geometry">
<mxPoint x="550" y="580" as="sourcePoint" />
<mxPoint x="345" y="580" as="targetPoint" />
</mxGeometry>
</mxCell>
<mxCell id="38" value="9. Status Updates" style="edgeLabel;resizable=0;html=1;align=center;verticalAlign=middle;" connectable="0" vertex="1" parent="37">
<mxGeometry relative="1" as="geometry" />
</mxCell>
<!-- Message 10: Mobile App to User (display status) -->
<mxCell id="39" value="" style="endArrow=classic;html=1;rounded=0;dashed=1;" edge="1" parent="1" source="11" target="6">
<mxGeometry relative="1" as="geometry" />
</mxCell>
<mxCell id="40" value="10. Display Current Status" style="edgeLabel;resizable=0;html=1;align=center;verticalAlign=middle;" connectable="0" vertex="1" parent="39">
<mxGeometry relative="1" as="geometry" />
</mxCell>
</root>
</mxGraphModel>
</diagram>
</mxfile>

View File

@ -0,0 +1,38 @@
<?xml version="1.0" encoding="UTF-8"?>
<mxfile host="app.diagrams.net" modified="2023-06-12T14:31:29.070Z" agent="Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/114.0.0.0 Safari/537.36" etag="8nDfyyYeRWOEhZrY6fnp" version="21.3.8">
<diagram name="Page-1" id="e7e014a7-5840-1c2e-5031-d8a46d1fe8dd">
<mxGraphModel dx="453" dy="623" grid="1" gridSize="10" guides="1" tooltips="1" connect="1" arrows="1" fold="1" page="1" pageScale="1" pageWidth="1169" pageHeight="826" background="none" math="0" shadow="0">
<root>
<mxCell id="0" />
<mxCell id="1" parent="0" />
<mxCell id="wfs432I5Vr80NUk8ZSk_-34" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;exitX=0.5;exitY=1;exitDx=0;exitDy=0;entryX=0.25;entryY=0;entryDx=0;entryDy=0;" edge="1" parent="1" source="wfs432I5Vr80NUk8ZSk_-13" target="wfs432I5Vr80NUk8ZSk_-16">
<mxGeometry relative="1" as="geometry" />
</mxCell>
<mxCell id="wfs432I5Vr80NUk8ZSk_-13" value="In-home Smart&lt;br&gt;Thermostat System" style="html=1;whiteSpace=wrap;" vertex="1" parent="1">
<mxGeometry x="330" y="136" width="180" height="50" as="geometry" />
</mxCell>
<mxCell id="wfs432I5Vr80NUk8ZSk_-39" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;entryX=0.5;entryY=0;entryDx=0;entryDy=0;" edge="1" parent="1" source="wfs432I5Vr80NUk8ZSk_-15" target="wfs432I5Vr80NUk8ZSk_-22">
<mxGeometry relative="1" as="geometry">
<mxPoint x="200" y="270" as="targetPoint" />
<mxPoint x="200" y="180" as="sourcePoint" />
</mxGeometry>
</mxCell>
<mxCell id="wfs432I5Vr80NUk8ZSk_-15" value="User" style="shape=umlActor;verticalLabelPosition=top;verticalAlign=bottom;html=1;labelPosition=center;align=center;" vertex="1" parent="1">
<mxGeometry x="220" y="150" width="40" height="80" as="geometry" />
</mxCell>
<mxCell id="wfs432I5Vr80NUk8ZSk_-35" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;exitX=0.5;exitY=0;exitDx=0;exitDy=0;entryX=0.668;entryY=0.982;entryDx=0;entryDy=0;entryPerimeter=0;" edge="1" parent="1" source="wfs432I5Vr80NUk8ZSk_-16" target="wfs432I5Vr80NUk8ZSk_-13">
<mxGeometry relative="1" as="geometry" />
</mxCell>
<mxCell id="wfs432I5Vr80NUk8ZSk_-16" value="HVAC&lt;br&gt;System" style="html=1;whiteSpace=wrap;" vertex="1" parent="1">
<mxGeometry x="390" y="268" width="120" height="50" as="geometry" />
</mxCell>
<mxCell id="wfs432I5Vr80NUk8ZSk_-40" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;exitX=1;exitY=0.5;exitDx=0;exitDy=0;entryX=0.107;entryY=1.035;entryDx=0;entryDy=0;entryPerimeter=0;" edge="1" parent="1" source="wfs432I5Vr80NUk8ZSk_-22" target="wfs432I5Vr80NUk8ZSk_-13">
<mxGeometry relative="1" as="geometry" />
</mxCell>
<mxCell id="wfs432I5Vr80NUk8ZSk_-22" value="Mobile&lt;br&gt;Device" style="html=1;whiteSpace=wrap;" vertex="1" parent="1">
<mxGeometry x="185" y="268" width="110" height="50" as="geometry" />
</mxCell>
</root>
</mxGraphModel>
</diagram>
</mxfile>

View File

@ -0,0 +1,232 @@
<mxfile host="app.diagrams.net">
<diagram name="Smart Thermostat Activity Diagram">
<mxGraphModel dx="1422" dy="962" grid="1" gridSize="10" guides="1">
<root>
<mxCell id="0"/>
<mxCell id="1" parent="0"/>
<!-- Start Node -->
<mxCell id="start" value="" style="ellipse;whiteSpace=wrap;html=1;aspect=fixed;fillColor=#000000;" vertex="1" parent="1">
<mxGeometry x="390" y="20" width="20" height="20" as="geometry"/>
</mxCell>
<!-- User Input Activity -->
<mxCell id="userInput" value="Home Owner&#xa;Provides Input" style="rounded=1;whiteSpace=wrap;html=1;fillColor=#dae8fc;strokeColor=#6c8ebf;" vertex="1" parent="1">
<mxGeometry x="340" y="70" width="120" height="50" as="geometry"/>
</mxCell>
<!-- Electronic Device Processes Input -->
<mxCell id="processInput" value="Electronic Device/App&#xa;Processes User Input" style="rounded=1;whiteSpace=wrap;html=1;fillColor=#fff2cc;strokeColor=#d6b656;" vertex="1" parent="1">
<mxGeometry x="340" y="150" width="120" height="50" as="geometry"/>
</mxCell>
<!-- Send Data to Network -->
<mxCell id="sendToNetwork" value="Send Data to&#xa;Internet Gateway" style="rounded=1;whiteSpace=wrap;html=1;fillColor=#e1d5e7;strokeColor=#9673a6;" vertex="1" parent="1">
<mxGeometry x="340" y="230" width="120" height="50" as="geometry"/>
</mxCell>
<!-- Network Receives Data -->
<mxCell id="networkReceive" value="Internet Gateway&#xa;Receives Data" style="rounded=1;whiteSpace=wrap;html=1;fillColor=#e1d5e7;strokeColor=#9673a6;" vertex="1" parent="1">
<mxGeometry x="340" y="310" width="120" height="50" as="geometry"/>
</mxCell>
<!-- Send to SmartThermostat -->
<mxCell id="sendToThermostat" value="Send Data to&#xa;SmartThermostat" style="rounded=1;whiteSpace=wrap;html=1;fillColor=#d5e8d4;strokeColor=#82b366;" vertex="1" parent="1">
<mxGeometry x="340" y="390" width="120" height="50" as="geometry"/>
</mxCell>
<!-- Fork for Parallel Activities -->
<mxCell id="fork1" value="" style="line;strokeWidth=3;html=1;fillColor=#000000;" vertex="1" parent="1">
<mxGeometry x="350" y="470" width="100" height="10" as="geometry"/>
</mxCell>
<!-- Left Branch - Sensor Activities -->
<mxCell id="readSensors" value="Read Temperature&#xa;from Sensors" style="rounded=1;whiteSpace=wrap;html=1;fillColor=#f8cecc;strokeColor=#b85450;" vertex="1" parent="1">
<mxGeometry x="180" y="520" width="120" height="50" as="geometry"/>
</mxCell>
<mxCell id="sendSensorData" value="Send Sensor Data&#xa;to SmartThermostat" style="rounded=1;whiteSpace=wrap;html=1;fillColor=#f8cecc;strokeColor=#b85450;" vertex="1" parent="1">
<mxGeometry x="180" y="600" width="120" height="50" as="geometry"/>
</mxCell>
<!-- Right Branch - Database Activities -->
<mxCell id="retrieveData" value="Retrieve Data&#xa;from Database" style="rounded=1;whiteSpace=wrap;html=1;fillColor=#ffe6cc;strokeColor=#d79b00;" vertex="1" parent="1">
<mxGeometry x="500" y="520" width="120" height="50" as="geometry"/>
</mxCell>
<mxCell id="storeData" value="Store Sensor Data&#xa;in Database" style="rounded=1;whiteSpace=wrap;html=1;fillColor=#ffe6cc;strokeColor=#d79b00;" vertex="1" parent="1">
<mxGeometry x="500" y="600" width="120" height="50" as="geometry"/>
</mxCell>
<!-- Join after Parallel Activities -->
<mxCell id="join1" value="" style="line;strokeWidth=3;html=1;fillColor=#000000;" vertex="1" parent="1">
<mxGeometry x="350" y="700" width="100" height="10" as="geometry"/>
</mxCell>
<!-- Decision Diamond -->
<mxCell id="decision1" value="Temperature&#xa;Control Needed?" style="rhombus;whiteSpace=wrap;html=1;fillColor=#fff2cc;strokeColor=#d6b656;" vertex="1" parent="1">
<mxGeometry x="320" y="750" width="160" height="80" as="geometry"/>
</mxCell>
<!-- Heating Branch -->
<mxCell id="startHeating" value="Switch HVAC to&#xa;Heating Mode" style="rounded=1;whiteSpace=wrap;html=1;fillColor=#ffcccc;strokeColor=#ff6666;" vertex="1" parent="1">
<mxGeometry x="120" y="880" width="120" height="50" as="geometry"/>
</mxCell>
<mxCell id="sendHeatingState" value="Send Heating State&#xa;Data to SmartThermostat" style="rounded=1;whiteSpace=wrap;html=1;fillColor=#ffcccc;strokeColor=#ff6666;" vertex="1" parent="1">
<mxGeometry x="120" y="960" width="120" height="50" as="geometry"/>
</mxCell>
<!-- Cooling Branch -->
<mxCell id="startCooling" value="Switch HVAC to&#xa;Cooling Mode" style="rounded=1;whiteSpace=wrap;html=1;fillColor=#ccffff;strokeColor=#0066cc;" vertex="1" parent="1">
<mxGeometry x="560" y="880" width="120" height="50" as="geometry"/>
</mxCell>
<mxCell id="sendCoolingState" value="Send Cooling State&#xa;Data to SmartThermostat" style="rounded=1;whiteSpace=wrap;html=1;fillColor=#ccffff;strokeColor=#0066cc;" vertex="1" parent="1">
<mxGeometry x="560" y="960" width="120" height="50" as="geometry"/>
</mxCell>
<!-- No Action Branch -->
<mxCell id="maintain" value="Maintain Current&#xa;Temperature" style="rounded=1;whiteSpace=wrap;html=1;fillColor=#f5f5f5;strokeColor=#666666;" vertex="1" parent="1">
<mxGeometry x="340" y="880" width="120" height="50" as="geometry"/>
</mxCell>
<!-- Join after Decision -->
<mxCell id="join2" value="" style="line;strokeWidth=3;html=1;fillColor=#000000;" vertex="1" parent="1">
<mxGeometry x="350" y="1050" width="100" height="10" as="geometry"/>
</mxCell>
<!-- Display Current Temperature -->
<mxCell id="displayTemp" value="Display Current&#xa;Temperature to User" style="rounded=1;whiteSpace=wrap;html=1;fillColor=#dae8fc;strokeColor=#6c8ebf;" vertex="1" parent="1">
<mxGeometry x="340" y="1090" width="120" height="50" as="geometry"/>
</mxCell>
<!-- Wait Activity -->
<mxCell id="wait" value="Wait for Next&#xa;Monitoring Cycle" style="rounded=1;whiteSpace=wrap;html=1;fillColor=#f0f0f0;strokeColor=#999999;" vertex="1" parent="1">
<mxGeometry x="340" y="1170" width="120" height="50" as="geometry"/>
</mxCell>
<!-- Loop Back Decision -->
<mxCell id="loopDecision" value="Continue&#xa;Monitoring?" style="rhombus;whiteSpace=wrap;html=1;fillColor=#fff2cc;strokeColor=#d6b656;" vertex="1" parent="1">
<mxGeometry x="320" y="1250" width="160" height="80" as="geometry"/>
</mxCell>
<!-- End Node -->
<mxCell id="end" value="" style="ellipse;whiteSpace=wrap;html=1;aspect=fixed;fillColor=#000000;strokeColor=#000000;strokeWidth=3;" vertex="1" parent="1">
<mxGeometry x="390" y="1370" width="20" height="20" as="geometry"/>
</mxCell>
<!-- Transitions -->
<mxCell id="t1" value="" style="edgeStyle=orthogonalEdgeStyle;html=1;exitX=0.5;exitY=1;entryX=0.5;entryY=0;" edge="1" parent="1" source="start" target="userInput">
<mxGeometry relative="1" as="geometry"/>
</mxCell>
<mxCell id="t2" value="" style="edgeStyle=orthogonalEdgeStyle;html=1;exitX=0.5;exitY=1;entryX=0.5;entryY=0;" edge="1" parent="1" source="userInput" target="processInput">
<mxGeometry relative="1" as="geometry"/>
</mxCell>
<mxCell id="t3" value="" style="edgeStyle=orthogonalEdgeStyle;html=1;exitX=0.5;exitY=1;entryX=0.5;entryY=0;" edge="1" parent="1" source="processInput" target="sendToNetwork">
<mxGeometry relative="1" as="geometry"/>
</mxCell>
<mxCell id="t4" value="" style="edgeStyle=orthogonalEdgeStyle;html=1;exitX=0.5;exitY=1;entryX=0.5;entryY=0;" edge="1" parent="1" source="sendToNetwork" target="networkReceive">
<mxGeometry relative="1" as="geometry"/>
</mxCell>
<mxCell id="t5" value="" style="edgeStyle=orthogonalEdgeStyle;html=1;exitX=0.5;exitY=1;entryX=0.5;entryY=0;" edge="1" parent="1" source="networkReceive" target="sendToThermostat">
<mxGeometry relative="1" as="geometry"/>
</mxCell>
<mxCell id="t6" value="" style="edgeStyle=orthogonalEdgeStyle;html=1;exitX=0.5;exitY=1;entryX=0.5;entryY=0;" edge="1" parent="1" source="sendToThermostat" target="fork1">
<mxGeometry relative="1" as="geometry"/>
</mxCell>
<mxCell id="t7" value="" style="edgeStyle=orthogonalEdgeStyle;html=1;exitX=0;exitY=0.5;entryX=0.5;entryY=0;" edge="1" parent="1" source="fork1" target="readSensors">
<mxGeometry relative="1" as="geometry"/>
</mxCell>
<mxCell id="t8" value="" style="edgeStyle=orthogonalEdgeStyle;html=1;exitX=1;exitY=0.5;entryX=0.5;entryY=0;" edge="1" parent="1" source="fork1" target="retrieveData">
<mxGeometry relative="1" as="geometry"/>
</mxCell>
<mxCell id="t9" value="" style="edgeStyle=orthogonalEdgeStyle;html=1;exitX=0.5;exitY=1;entryX=0.5;entryY=0;" edge="1" parent="1" source="readSensors" target="sendSensorData">
<mxGeometry relative="1" as="geometry"/>
</mxCell>
<mxCell id="t10" value="" style="edgeStyle=orthogonalEdgeStyle;html=1;exitX=0.5;exitY=1;entryX=0.5;entryY=0;" edge="1" parent="1" source="retrieveData" target="storeData">
<mxGeometry relative="1" as="geometry"/>
</mxCell>
<mxCell id="t11" value="" style="edgeStyle=orthogonalEdgeStyle;html=1;exitX=0.5;exitY=1;entryX=0;entryY=0.5;" edge="1" parent="1" source="sendSensorData" target="join1">
<mxGeometry relative="1" as="geometry"/>
</mxCell>
<mxCell id="t12" value="" style="edgeStyle=orthogonalEdgeStyle;html=1;exitX=0.5;exitY=1;entryX=1;entryY=0.5;" edge="1" parent="1" source="storeData" target="join1">
<mxGeometry relative="1" as="geometry"/>
</mxCell>
<mxCell id="t13" value="" style="edgeStyle=orthogonalEdgeStyle;html=1;exitX=0.5;exitY=1;entryX=0.5;entryY=0;" edge="1" parent="1" source="join1" target="decision1">
<mxGeometry relative="1" as="geometry"/>
</mxCell>
<mxCell id="t14" value="Need Heating" style="edgeStyle=orthogonalEdgeStyle;html=1;exitX=0;exitY=0.5;entryX=0.5;entryY=0;" edge="1" parent="1" source="decision1" target="startHeating">
<mxGeometry relative="1" as="geometry"/>
</mxCell>
<mxCell id="t15" value="Need Cooling" style="edgeStyle=orthogonalEdgeStyle;html=1;exitX=1;exitY=0.5;entryX=0.5;entryY=0;" edge="1" parent="1" source="decision1" target="startCooling">
<mxGeometry relative="1" as="geometry"/>
</mxCell>
<mxCell id="t16" value="No Change" style="edgeStyle=orthogonalEdgeStyle;html=1;exitX=0.5;exitY=1;entryX=0.5;entryY=0;" edge="1" parent="1" source="decision1" target="maintain">
<mxGeometry relative="1" as="geometry"/>
</mxCell>
<mxCell id="t17" value="" style="edgeStyle=orthogonalEdgeStyle;html=1;exitX=0.5;exitY=1;entryX=0.5;entryY=0;" edge="1" parent="1" source="startHeating" target="sendHeatingState">
<mxGeometry relative="1" as="geometry"/>
</mxCell>
<mxCell id="t18" value="" style="edgeStyle=orthogonalEdgeStyle;html=1;exitX=0.5;exitY=1;entryX=0.5;entryY=0;" edge="1" parent="1" source="startCooling" target="sendCoolingState">
<mxGeometry relative="1" as="geometry"/>
</mxCell>
<mxCell id="t19" value="" style="edgeStyle=orthogonalEdgeStyle;html=1;exitX=0.5;exitY=1;entryX=0;entryY=0.5;" edge="1" parent="1" source="sendHeatingState" target="join2">
<mxGeometry relative="1" as="geometry"/>
</mxCell>
<mxCell id="t20" value="" style="edgeStyle=orthogonalEdgeStyle;html=1;exitX=0.5;exitY=1;entryX=1;entryY=0.5;" edge="1" parent="1" source="sendCoolingState" target="join2">
<mxGeometry relative="1" as="geometry"/>
</mxCell>
<mxCell id="t21" value="" style="edgeStyle=orthogonalEdgeStyle;html=1;exitX=0.5;exitY=1;entryX=0.5;entryY=0.5;" edge="1" parent="1" source="maintain" target="join2">
<mxGeometry relative="1" as="geometry"/>
</mxCell>
<mxCell id="t22" value="" style="edgeStyle=orthogonalEdgeStyle;html=1;exitX=0.5;exitY=1;entryX=0.5;entryY=0;" edge="1" parent="1" source="join2" target="displayTemp">
<mxGeometry relative="1" as="geometry"/>
</mxCell>
<mxCell id="t23" value="" style="edgeStyle=orthogonalEdgeStyle;html=1;exitX=0.5;exitY=1;entryX=0.5;entryY=0;" edge="1" parent="1" source="displayTemp" target="wait">
<mxGeometry relative="1" as="geometry"/>
</mxCell>
<mxCell id="t24" value="" style="edgeStyle=orthogonalEdgeStyle;html=1;exitX=0.5;exitY=1;entryX=0.5;entryY=0;" edge="1" parent="1" source="wait" target="loopDecision">
<mxGeometry relative="1" as="geometry"/>
</mxCell>
<mxCell id="t25" value="Yes" style="edgeStyle=orthogonalEdgeStyle;html=1;exitX=0;exitY=0.5;entryX=0;entryY=0.5;" edge="1" parent="1" source="loopDecision" target="readSensors">
<mxGeometry relative="1" as="geometry">
<Array as="points">
<mxPoint x="50" y="1290"/>
<mxPoint x="50" y="545"/>
</Array>
</mxGeometry>
</mxCell>
<mxCell id="t26" value="No" style="edgeStyle=orthogonalEdgeStyle;html=1;exitX=0.5;exitY=1;entryX=0.5;entryY=0;" edge="1" parent="1" source="loopDecision" target="end">
<mxGeometry relative="1" as="geometry"/>
</mxCell>
</root>
</mxGraphModel>
</diagram>
</mxfile>

View File

@ -0,0 +1,157 @@
<mxfile host="app.diagrams.net" agent="Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:142.0) Gecko/20100101 Firefox/142.0" version="28.2.3">
<diagram name="Page-1" id="75ae7d71-7dc9-cc9a-2de6-0ed70c28521b">
<mxGraphModel dx="1152" dy="648" grid="1" gridSize="10" guides="1" tooltips="1" connect="1" arrows="1" fold="1" page="1" pageScale="1" pageWidth="827" pageHeight="1169" math="0" shadow="0">
<root>
<mxCell id="0" />
<mxCell id="1" parent="0" />
<mxCell id="ySzUzg68vfxPxYYMFw7--13" value="ACTOR/HOME OWNER" style="whiteSpace=wrap;strokeWidth=2;" vertex="1" parent="1">
<mxGeometry x="320" y="180" width="140" height="34" as="geometry" />
</mxCell>
<mxCell id="ySzUzg68vfxPxYYMFw7--14" value="Electronic Device/App" style="whiteSpace=wrap;strokeWidth=2;" vertex="1" parent="1">
<mxGeometry x="334.25" y="270" width="115.75" height="34" as="geometry" />
</mxCell>
<mxCell id="ySzUzg68vfxPxYYMFw7--15" value="Inputs" style="curved=1;startArrow=none;endArrow=block;exitX=0.25;exitY=1;entryX=0;entryY=0.5;entryDx=0;entryDy=0;exitDx=0;exitDy=0;" edge="1" parent="1" target="ySzUzg68vfxPxYYMFw7--14">
<mxGeometry x="-0.4037" y="20" relative="1" as="geometry">
<Array as="points">
<mxPoint x="250" y="246" />
</Array>
<mxPoint as="offset" />
<mxPoint x="320" y="190" as="sourcePoint" />
<mxPoint x="290" y="285" as="targetPoint" />
</mxGeometry>
</mxCell>
<mxCell id="ySzUzg68vfxPxYYMFw7--16" value="Displays current &#xa;temperature " style="curved=1;startArrow=none;endArrow=block;entryX=0.75;entryY=1;entryDx=0;entryDy=0;" edge="1" parent="1">
<mxGeometry x="0.1547" y="12" relative="1" as="geometry">
<Array as="points">
<mxPoint x="498" y="256" />
</Array>
<mxPoint as="offset" />
<mxPoint x="450" y="286" as="sourcePoint" />
<mxPoint x="461" y="200" as="targetPoint" />
</mxGeometry>
</mxCell>
<mxCell id="ySzUzg68vfxPxYYMFw7--17" value="Internet Gateway / Local home network" style="whiteSpace=wrap;strokeWidth=2;" vertex="1" parent="1">
<mxGeometry x="316.38" y="370" width="151.5" height="60" as="geometry" />
</mxCell>
<mxCell id="ySzUzg68vfxPxYYMFw7--18" value="Send Data" style="curved=1;startArrow=none;endArrow=block;entryX=0.25;entryY=0;entryDx=0;entryDy=0;" edge="1" parent="1" target="ySzUzg68vfxPxYYMFw7--17">
<mxGeometry x="-0.4347" relative="1" as="geometry">
<Array as="points">
<mxPoint x="290" y="354" />
</Array>
<mxPoint x="352" y="304" as="sourcePoint" />
<mxPoint x="352" y="358" as="targetPoint" />
<mxPoint as="offset" />
</mxGeometry>
</mxCell>
<mxCell id="ySzUzg68vfxPxYYMFw7--19" value="Receive Data" style="curved=1;startArrow=none;endArrow=block;exitX=0.849;exitY=1.017;entryX=1;entryY=0.75;exitDx=0;exitDy=0;entryDx=0;entryDy=0;exitPerimeter=0;" edge="1" parent="1" source="ySzUzg68vfxPxYYMFw7--14">
<mxGeometry x="-0.4567" y="3" relative="1" as="geometry">
<Array as="points">
<mxPoint x="480" y="360" />
</Array>
<mxPoint x="534" y="370" as="sourcePoint" />
<mxPoint x="420" y="370" as="targetPoint" />
<mxPoint as="offset" />
</mxGeometry>
</mxCell>
<mxCell id="ySzUzg68vfxPxYYMFw7--20" value="SmartThermostat" style="whiteSpace=wrap;strokeWidth=2;" vertex="1" parent="1">
<mxGeometry x="322.13" y="500" width="140" height="34" as="geometry" />
</mxCell>
<mxCell id="ySzUzg68vfxPxYYMFw7--21" value="Send Data" style="curved=1;startArrow=none;endArrow=block;exitX=0.201;exitY=-0.067;exitDx=0;exitDy=0;entryX=0.277;entryY=1.052;entryDx=0;entryDy=0;entryPerimeter=0;exitPerimeter=0;" edge="1" parent="1" source="ySzUzg68vfxPxYYMFw7--20" target="ySzUzg68vfxPxYYMFw7--17">
<mxGeometry x="-0.4415" y="-7" relative="1" as="geometry">
<Array as="points">
<mxPoint x="290" y="460" />
</Array>
<mxPoint as="offset" />
<mxPoint x="320" y="510" as="sourcePoint" />
<mxPoint x="314" y="400" as="targetPoint" />
</mxGeometry>
</mxCell>
<mxCell id="ySzUzg68vfxPxYYMFw7--22" value="Receive Data" style="curved=1;startArrow=none;endArrow=block;exitX=0.669;exitY=0.986;exitDx=0;exitDy=0;exitPerimeter=0;entryX=0.75;entryY=0;entryDx=0;entryDy=0;" edge="1" parent="1" source="ySzUzg68vfxPxYYMFw7--17" target="ySzUzg68vfxPxYYMFw7--20">
<mxGeometry x="-0.459" y="-11" relative="1" as="geometry">
<Array as="points">
<mxPoint x="510" y="470" />
</Array>
<mxPoint as="offset" />
<mxPoint x="470" y="400" as="sourcePoint" />
<mxPoint x="462" y="500" as="targetPoint" />
</mxGeometry>
</mxCell>
<mxCell id="ySzUzg68vfxPxYYMFw7--23" value="HVAC" style="whiteSpace=wrap;strokeWidth=2;" vertex="1" parent="1">
<mxGeometry x="110" y="600" width="170" height="90" as="geometry" />
</mxCell>
<mxCell id="ySzUzg68vfxPxYYMFw7--24" value="Sensors" style="whiteSpace=wrap;strokeWidth=2;" vertex="1" parent="1">
<mxGeometry x="420" y="630" width="100" height="60" as="geometry" />
</mxCell>
<mxCell id="ySzUzg68vfxPxYYMFw7--25" value="Switch state  (On/Off)&#xa;Cooling/Heating" style="curved=1;startArrow=none;endArrow=block;exitX=-0.003;exitY=0.622;entryX=0.634;entryY=0.01;entryDx=0;entryDy=0;exitDx=0;exitDy=0;exitPerimeter=0;entryPerimeter=0;" edge="1" parent="1" source="ySzUzg68vfxPxYYMFw7--20" target="ySzUzg68vfxPxYYMFw7--23">
<mxGeometry x="-0.2523" y="26" relative="1" as="geometry">
<Array as="points">
<mxPoint x="180" y="510" />
</Array>
<mxPoint as="offset" />
<mxPoint x="110" y="508" as="sourcePoint" />
<mxPoint x="191" y="600" as="targetPoint" />
</mxGeometry>
</mxCell>
<mxCell id="ySzUzg68vfxPxYYMFw7--26" value="Heating" style="rounded=1;whiteSpace=wrap;html=1;" vertex="1" parent="1">
<mxGeometry x="120" y="620" width="50" height="30" as="geometry" />
</mxCell>
<mxCell id="ySzUzg68vfxPxYYMFw7--27" value="&lt;div&gt;Cooling&lt;/div&gt;" style="rounded=1;whiteSpace=wrap;html=1;" vertex="1" parent="1">
<mxGeometry x="220" y="620" width="50" height="30" as="geometry" />
</mxCell>
<mxCell id="ySzUzg68vfxPxYYMFw7--28" value="Send state data" style="curved=1;startArrow=none;endArrow=block;exitX=1;exitY=0.25;entryX=0.7351110859860098;entryY=0.9754902895759133;exitDx=0;exitDy=0;" edge="1" parent="1" source="ySzUzg68vfxPxYYMFw7--23">
<mxGeometry x="0.3237" y="23" relative="1" as="geometry">
<Array as="points">
<mxPoint x="356.13" y="614" />
</Array>
<mxPoint as="offset" />
<mxPoint x="438.13" y="626" as="sourcePoint" />
<mxPoint x="346.13" y="534" as="targetPoint" />
</mxGeometry>
</mxCell>
<mxCell id="ySzUzg68vfxPxYYMFw7--29" value="Reads temperature" style="curved=1;startArrow=none;endArrow=block;entryX=0.25;entryY=0;entryDx=0;entryDy=0;exitX=0.895;exitY=0.975;exitDx=0;exitDy=0;exitPerimeter=0;" edge="1" parent="1" source="ySzUzg68vfxPxYYMFw7--20">
<mxGeometry x="-0.532" y="21" relative="1" as="geometry">
<Array as="points">
<mxPoint x="400" y="580" />
</Array>
<mxPoint x="444" y="540" as="sourcePoint" />
<mxPoint x="444" y="630" as="targetPoint" />
<mxPoint as="offset" />
</mxGeometry>
</mxCell>
<mxCell id="ySzUzg68vfxPxYYMFw7--30" value="Sends Sensor data" style="curved=1;startArrow=none;endArrow=block;exitX=0.75;exitY=0;entryX=1;entryY=0.75;exitDx=0;exitDy=0;entryDx=0;entryDy=0;" edge="1" parent="1" target="ySzUzg68vfxPxYYMFw7--20">
<mxGeometry x="-0.3033" y="15" relative="1" as="geometry">
<Array as="points">
<mxPoint x="580" y="560" />
</Array>
<mxPoint as="offset" />
<mxPoint x="520" y="659" as="sourcePoint" />
<mxPoint x="546" y="560" as="targetPoint" />
</mxGeometry>
</mxCell>
<mxCell id="ySzUzg68vfxPxYYMFw7--32" value="&lt;div&gt;Database&lt;/div&gt;" style="strokeWidth=2;html=1;shape=mxgraph.flowchart.database;whiteSpace=wrap;" vertex="1" parent="1">
<mxGeometry x="640" y="460" width="60" height="60" as="geometry" />
</mxCell>
<mxCell id="ySzUzg68vfxPxYYMFw7--33" value="Retrieve Data" style="curved=1;startArrow=none;endArrow=block;entryX=1.001;entryY=0.134;entryDx=0;entryDy=0;entryPerimeter=0;exitX=-0.033;exitY=0.229;exitDx=0;exitDy=0;exitPerimeter=0;" edge="1" parent="1" source="ySzUzg68vfxPxYYMFw7--32" target="ySzUzg68vfxPxYYMFw7--20">
<mxGeometry x="0.0056" y="1" relative="1" as="geometry">
<Array as="points">
<mxPoint x="600" y="480" />
</Array>
<mxPoint as="offset" />
<mxPoint x="598" y="480" as="sourcePoint" />
<mxPoint x="590" y="597" as="targetPoint" />
</mxGeometry>
</mxCell>
<mxCell id="ySzUzg68vfxPxYYMFw7--34" value="Store Sensor Data" style="curved=1;startArrow=none;endArrow=block;exitX=1;exitY=0.5;exitDx=0;exitDy=0;entryX=0.014;entryY=0.705;entryDx=0;entryDy=0;entryPerimeter=0;" edge="1" parent="1" source="ySzUzg68vfxPxYYMFw7--20" target="ySzUzg68vfxPxYYMFw7--32">
<mxGeometry x="0.504" y="26" relative="1" as="geometry">
<Array as="points">
<mxPoint x="600" y="575" />
</Array>
<mxPoint as="offset" />
<mxPoint x="639" y="667" as="sourcePoint" />
<mxPoint x="633" y="550" as="targetPoint" />
</mxGeometry>
</mxCell>
</root>
</mxGraphModel>
</diagram>
</mxfile>

View File

@ -0,0 +1,139 @@
<mxfile host="app.diagrams.net" agent="Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:142.0) Gecko/20100101 Firefox/142.0" version="28.2.3">
<diagram name="Page-1" id="75ae7d71-7dc9-cc9a-2de6-0ed70c28521b">
<mxGraphModel dx="1152" dy="648" grid="1" gridSize="10" guides="1" tooltips="1" connect="1" arrows="1" fold="1" page="1" pageScale="1" pageWidth="827" pageHeight="1169" math="0" shadow="0">
<root>
<mxCell id="0" />
<mxCell id="1" parent="0" />
<mxCell id="AwyJn9_doaVMq5rt1h0n-27" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;exitX=0;exitY=0.5;exitDx=0;exitDy=0;entryX=0.5;entryY=0;entryDx=0;entryDy=0;" edge="1" parent="1" source="2" target="3">
<mxGeometry relative="1" as="geometry" />
</mxCell>
<mxCell id="AwyJn9_doaVMq5rt1h0n-43" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;exitX=0.75;exitY=0;exitDx=0;exitDy=0;entryX=0.5;entryY=1;entryDx=0;entryDy=0;" edge="1" parent="1" source="2" target="AwyJn9_doaVMq5rt1h0n-42">
<mxGeometry relative="1" as="geometry">
<Array as="points">
<mxPoint x="455" y="160" />
</Array>
</mxGeometry>
</mxCell>
<mxCell id="AwyJn9_doaVMq5rt1h0n-44" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;exitX=1;exitY=0.5;exitDx=0;exitDy=0;entryX=0.5;entryY=0;entryDx=0;entryDy=0;" edge="1" parent="1" source="2" target="4">
<mxGeometry relative="1" as="geometry" />
</mxCell>
<mxCell id="2" value="IDLE" style="rounded=1;whiteSpace=wrap;html=1;" parent="1" vertex="1">
<mxGeometry x="360" y="160" width="120" height="60" as="geometry" />
</mxCell>
<mxCell id="AwyJn9_doaVMq5rt1h0n-46" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;exitX=1;exitY=0.5;exitDx=0;exitDy=0;entryX=0.25;entryY=1;entryDx=0;entryDy=0;" edge="1" parent="1" source="3" target="4">
<mxGeometry relative="1" as="geometry" />
</mxCell>
<mxCell id="AwyJn9_doaVMq5rt1h0n-48" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;exitX=1;exitY=0.25;exitDx=0;exitDy=0;entryX=0.25;entryY=1;entryDx=0;entryDy=0;" edge="1" parent="1" source="3" target="2">
<mxGeometry relative="1" as="geometry" />
</mxCell>
<mxCell id="3" value="" style="rounded=1;whiteSpace=wrap;html=1;" parent="1" vertex="1">
<mxGeometry x="80" y="320" width="200" height="200" as="geometry" />
</mxCell>
<mxCell id="AwyJn9_doaVMq5rt1h0n-45" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;exitX=0.75;exitY=1;exitDx=0;exitDy=0;entryX=1;entryY=0.75;entryDx=0;entryDy=0;" edge="1" parent="1" source="4" target="3">
<mxGeometry relative="1" as="geometry" />
</mxCell>
<mxCell id="AwyJn9_doaVMq5rt1h0n-47" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;exitX=0;exitY=0.5;exitDx=0;exitDy=0;entryX=0.75;entryY=1;entryDx=0;entryDy=0;" edge="1" parent="1" source="4" target="2">
<mxGeometry relative="1" as="geometry" />
</mxCell>
<mxCell id="4" value="COOLING" style="rounded=1;whiteSpace=wrap;html=1;" parent="1" vertex="1">
<mxGeometry x="640" y="280" width="120" height="60" as="geometry" />
</mxCell>
<mxCell id="AwyJn9_doaVMq5rt1h0n-28" value="ACTIVE" style="rounded=1;whiteSpace=wrap;html=1;" vertex="1" parent="1">
<mxGeometry x="135" y="470" width="90" height="40" as="geometry" />
</mxCell>
<mxCell id="AwyJn9_doaVMq5rt1h0n-37" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;exitX=0.5;exitY=1;exitDx=0;exitDy=0;entryX=0.5;entryY=0;entryDx=0;entryDy=0;" edge="1" parent="1" source="AwyJn9_doaVMq5rt1h0n-29" target="AwyJn9_doaVMq5rt1h0n-28">
<mxGeometry relative="1" as="geometry" />
</mxCell>
<mxCell id="AwyJn9_doaVMq5rt1h0n-29" value="ACTIVATING" style="rounded=1;whiteSpace=wrap;html=1;" vertex="1" parent="1">
<mxGeometry x="135" y="370" width="90" height="40" as="geometry" />
</mxCell>
<mxCell id="AwyJn9_doaVMq5rt1h0n-31" value="Heating" style="text;align=center;fontStyle=1;verticalAlign=middle;spacingLeft=3;spacingRight=3;strokeColor=none;rotatable=0;points=[[0,0.5],[1,0.5]];portConstraint=eastwest;html=1;fontSize=20;" vertex="1" parent="1">
<mxGeometry x="135" y="330" width="95" height="40" as="geometry" />
</mxCell>
<mxCell id="AwyJn9_doaVMq5rt1h0n-38" value="" style="ellipse;html=1;shape=startState;fillColor=#000000;strokeColor=#ff0000;" vertex="1" parent="1">
<mxGeometry x="90" y="330" width="30" height="30" as="geometry" />
</mxCell>
<mxCell id="AwyJn9_doaVMq5rt1h0n-39" value="" style="edgeStyle=orthogonalEdgeStyle;html=1;verticalAlign=bottom;endArrow=open;endSize=8;strokeColor=#ff0000;rounded=0;entryX=0;entryY=0.75;entryDx=0;entryDy=0;" edge="1" source="AwyJn9_doaVMq5rt1h0n-38" parent="1" target="AwyJn9_doaVMq5rt1h0n-29">
<mxGeometry relative="1" as="geometry">
<mxPoint x="105" y="420" as="targetPoint" />
<Array as="points">
<mxPoint x="105" y="400" />
</Array>
</mxGeometry>
</mxCell>
<mxCell id="AwyJn9_doaVMq5rt1h0n-40" value="" style="ellipse;html=1;shape=startState;fillColor=#000000;strokeColor=#ff0000;" vertex="1" parent="1">
<mxGeometry x="360" y="70" width="30" height="30" as="geometry" />
</mxCell>
<mxCell id="AwyJn9_doaVMq5rt1h0n-41" value="" style="edgeStyle=orthogonalEdgeStyle;html=1;verticalAlign=bottom;endArrow=open;endSize=8;strokeColor=#ff0000;rounded=0;" edge="1" source="AwyJn9_doaVMq5rt1h0n-40" parent="1">
<mxGeometry relative="1" as="geometry">
<mxPoint x="375" y="160" as="targetPoint" />
</mxGeometry>
</mxCell>
<mxCell id="AwyJn9_doaVMq5rt1h0n-42" value="" style="ellipse;html=1;shape=endState;fillColor=#000000;strokeColor=#ff0000;" vertex="1" parent="1">
<mxGeometry x="440" y="70" width="30" height="30" as="geometry" />
</mxCell>
<mxCell id="AwyJn9_doaVMq5rt1h0n-52" value="&lt;div&gt;End Of Cycle&lt;/div&gt;" style="html=1;verticalAlign=bottom;endArrow=open;dashed=1;endSize=8;curved=0;rounded=0;strokeColor=light-dark(#000000,#FFFF66);" edge="1" parent="1">
<mxGeometry relative="1" as="geometry">
<mxPoint x="560" y="84.71000000000001" as="sourcePoint" />
<mxPoint x="480" y="84.71000000000001" as="targetPoint" />
<mxPoint as="offset" />
</mxGeometry>
</mxCell>
<mxCell id="AwyJn9_doaVMq5rt1h0n-53" value="&lt;div&gt;Initial State&lt;/div&gt;" style="html=1;verticalAlign=bottom;endArrow=open;dashed=1;endSize=8;curved=0;rounded=0;strokeColor=light-dark(#000000,#FFFF66);" edge="1" parent="1">
<mxGeometry x="-0.0041" relative="1" as="geometry">
<mxPoint x="104.71" y="260" as="sourcePoint" />
<mxPoint x="104.71" y="330" as="targetPoint" />
<mxPoint as="offset" />
</mxGeometry>
</mxCell>
<mxCell id="AwyJn9_doaVMq5rt1h0n-54" value="&lt;div&gt;Start Of Cycle&lt;/div&gt;" style="html=1;verticalAlign=bottom;endArrow=open;dashed=1;endSize=8;curved=0;rounded=0;strokeColor=light-dark(#000000,#FFFF66);" edge="1" parent="1">
<mxGeometry relative="1" as="geometry">
<mxPoint x="230" y="85" as="sourcePoint" />
<mxPoint x="350" y="85" as="targetPoint" />
<mxPoint as="offset" />
</mxGeometry>
</mxCell>
<mxCell id="AwyJn9_doaVMq5rt1h0n-56" value="LowTemp" style="text;align=center;fontStyle=1;verticalAlign=middle;spacingLeft=3;spacingRight=3;strokeColor=none;rotatable=0;points=[[0,0.5],[1,0.5]];portConstraint=eastwest;html=1;" vertex="1" parent="1">
<mxGeometry x="229" y="134" width="80" height="26" as="geometry" />
</mxCell>
<mxCell id="AwyJn9_doaVMq5rt1h0n-57" value="&lt;div&gt;Trigger&lt;/div&gt;" style="html=1;verticalAlign=bottom;endArrow=open;dashed=1;endSize=8;curved=0;rounded=0;strokeColor=light-dark(#000000,#FFFF66);" edge="1" parent="1">
<mxGeometry x="-0.1429" y="17" relative="1" as="geometry">
<mxPoint x="299" y="162.71" as="sourcePoint" />
<mxPoint x="229" y="162.71" as="targetPoint" />
<mxPoint as="offset" />
</mxGeometry>
</mxCell>
<mxCell id="AwyJn9_doaVMq5rt1h0n-58" value="&lt;div&gt;Trigger&lt;/div&gt;" style="html=1;verticalAlign=bottom;endArrow=open;dashed=1;endSize=8;curved=0;rounded=0;strokeColor=light-dark(#000000,#FFFF00);" edge="1" parent="1">
<mxGeometry x="-0.151" y="-17" relative="1" as="geometry">
<mxPoint x="550" y="160" as="sourcePoint" />
<mxPoint x="620" y="160" as="targetPoint" />
<mxPoint as="offset" />
</mxGeometry>
</mxCell>
<mxCell id="AwyJn9_doaVMq5rt1h0n-59" value="HighTemp" style="text;align=center;fontStyle=1;verticalAlign=middle;spacingLeft=3;spacingRight=3;strokeColor=none;rotatable=0;points=[[0,0.5],[1,0.5]];portConstraint=eastwest;html=1;" vertex="1" parent="1">
<mxGeometry x="540" y="134" width="80" height="26" as="geometry" />
</mxCell>
<mxCell id="AwyJn9_doaVMq5rt1h0n-60" value="&lt;div&gt;Trigger&lt;/div&gt;" style="html=1;verticalAlign=bottom;endArrow=open;dashed=1;endSize=8;curved=0;rounded=0;strokeColor=light-dark(#000000,#FFFF00);" edge="1" parent="1">
<mxGeometry x="-0.151" y="-17" relative="1" as="geometry">
<mxPoint x="510" y="396" as="sourcePoint" />
<mxPoint x="580" y="396" as="targetPoint" />
<mxPoint as="offset" />
</mxGeometry>
</mxCell>
<mxCell id="AwyJn9_doaVMq5rt1h0n-61" value="HighTemp" style="text;align=center;fontStyle=1;verticalAlign=middle;spacingLeft=3;spacingRight=3;strokeColor=none;rotatable=0;points=[[0,0.5],[1,0.5]];portConstraint=eastwest;html=1;" vertex="1" parent="1">
<mxGeometry x="500" y="370" width="80" height="26" as="geometry" />
</mxCell>
<mxCell id="AwyJn9_doaVMq5rt1h0n-65" value="LowTemp" style="text;align=center;fontStyle=1;verticalAlign=middle;spacingLeft=3;spacingRight=3;strokeColor=none;rotatable=0;points=[[0,0.5],[1,0.5]];portConstraint=eastwest;html=1;" vertex="1" parent="1">
<mxGeometry x="500" y="480.72" width="80" height="26" as="geometry" />
</mxCell>
<mxCell id="AwyJn9_doaVMq5rt1h0n-66" value="&lt;div&gt;Trigger&lt;/div&gt;" style="html=1;verticalAlign=bottom;endArrow=open;dashed=1;endSize=8;curved=0;rounded=0;strokeColor=light-dark(#000000,#FFFF66);" edge="1" parent="1">
<mxGeometry x="-0.1429" y="17" relative="1" as="geometry">
<mxPoint x="570" y="509.43000000000006" as="sourcePoint" />
<mxPoint x="500" y="509.43000000000006" as="targetPoint" />
<mxPoint as="offset" />
</mxGeometry>
</mxCell>
</root>
</mxGraphModel>
</diagram>
</mxfile>

Binary file not shown.

View File

@ -0,0 +1,428 @@
import java.util.*;
import java.io.*;
public class PoliticalSurvey {
private static final String[] POLITICAL_PARTIES = {
"Democratic", "Republican", "Libertarian", "Green"
};
private static final Map<Integer, Map<Integer, Map<String, Double>>> partyResponsePatterns = new HashMap<>();
// let's create a training data points per party
private static final int[] partyDataPoints = new int[POLITICAL_PARTIES.length];
// I gathered some random politiacl questions
private static final List<SurveyQuestion> QUESTIONS = new ArrayList<>();
private static final Scanner scanner = new Scanner(System.in);
private static final double CONFIDENCE_THRESHOLD = 0.65;
public static void main(String[] args) {
initializeQuestions();
initializePartyResponsePatterns();
System.out.println("==========================================================");
System.out.println(" POLITICAL PARTY PREDICTION SURVEY");
System.out.println("==========================================================");
System.out.println("This program will try to predict your political affiliation");
System.out.println("based on your responses to several questions.");
System.out.println();
boolean continueSurvey = true;
while (continueSurvey) {
List<String> userResponses = conductSurvey();
addTrainingData(userResponses);
System.out.println("\nWould you like to take the survey again? (yes/no)");
String response = scanner.nextLine().trim().toLowerCase();
continueSurvey = response.equals("yes") || response.equals("y");
if (continueSurvey) {
System.out.println("\n==========================================================\n");
}
}
System.out.println("\nThank you for using the Political Party Prediction Survey!");
scanner.close();
}
// Initialize the survey questions
private static void initializeQuestions() {
QUESTIONS.add(new SurveyQuestion(
"What should the government do to help the poor?",
new String[] {
"Make it easier to apply for assistance",
"Allow parents to use education funds for charter schools",
"Create welfare-to-work programs",
"Nothing, private charity should handle it"
}));
QUESTIONS.add(new SurveyQuestion(
"What is your view on taxation?",
new String[] {
"Higher taxes on the wealthy to fund social programs",
"Lower taxes to stimulate economic growth",
"Minimal taxation, only for essential services",
"Tax policies focused on environmental sustainability"
}));
QUESTIONS.add(new SurveyQuestion(
"What is your stance on healthcare?",
new String[] {
"Universal healthcare funded by the government",
"Market-based healthcare with limited government involvement",
"Free-market healthcare with no government involvement",
"Community-based healthcare systems with government support"
}));
QUESTIONS.add(new SurveyQuestion(
"What is your view on gun control?",
new String[] {
"Stricter gun control laws are needed",
"Existing gun laws are sufficient",
"Gun ownership is a fundamental right with minimal restrictions",
"Gun control with community-based oversight"
}));
QUESTIONS.add(new SurveyQuestion(
"How should we address climate change?",
new String[] {
"Government regulations and investment in renewable energy",
"Market-based solutions with limited regulations",
"No government intervention, let the market decide",
"Aggressive environmental policies and global cooperation"
}));
QUESTIONS.add(new SurveyQuestion(
"What should be our approach to foreign policy?",
new String[] {
"Global cooperation and diplomatic engagement",
"Strong national defense and protecting American interests",
"Non-interventionism and free trade",
"International cooperation for peace and environmental protection"
}));
QUESTIONS.add(new SurveyQuestion(
"What is your stance on immigration?",
new String[] {
"Path to citizenship for undocumented immigrants",
"Stronger border security and merit-based immigration",
"Open borders with minimal restrictions",
"Humanitarian-focused immigration policies"
}));
QUESTIONS.add(new SurveyQuestion(
"Which political party do you most closely affiliate with?",
POLITICAL_PARTIES));
}
// Initialize response patterns with starting weights, just please keep in mind
// that these weights are not 100% accurate.
private static void initializePartyResponsePatterns() {
// Democratic Party patterns
Map<Integer, Map<String, Double>> democraticPatterns = new HashMap<>();
democraticPatterns.put(0, createResponseWeights(new double[] { 0.7, 0.1, 0.2, 0.0 }));
democraticPatterns.put(1, createResponseWeights(new double[] { 0.7, 0.1, 0.0, 0.2 }));
democraticPatterns.put(2, createResponseWeights(new double[] { 0.8, 0.1, 0.0, 0.1 }));
democraticPatterns.put(3, createResponseWeights(new double[] { 0.8, 0.1, 0.0, 0.1 }));
democraticPatterns.put(4, createResponseWeights(new double[] { 0.7, 0.1, 0.0, 0.2 }));
democraticPatterns.put(5, createResponseWeights(new double[] { 0.7, 0.2, 0.0, 0.1 }));
democraticPatterns.put(6, createResponseWeights(new double[] { 0.7, 0.1, 0.0, 0.2 }));
partyResponsePatterns.put(0, democraticPatterns);
// Republican Party patterns
Map<Integer, Map<String, Double>> republicanPatterns = new HashMap<>();
republicanPatterns.put(0, createResponseWeights(new double[] { 0.1, 0.4, 0.4, 0.1 }));
republicanPatterns.put(1, createResponseWeights(new double[] { 0.0, 0.8, 0.2, 0.0 }));
republicanPatterns.put(2, createResponseWeights(new double[] { 0.0, 0.8, 0.2, 0.0 }));
republicanPatterns.put(3, createResponseWeights(new double[] { 0.1, 0.5, 0.4, 0.0 }));
republicanPatterns.put(4, createResponseWeights(new double[] { 0.0, 0.7, 0.3, 0.0 }));
republicanPatterns.put(5, createResponseWeights(new double[] { 0.0, 0.8, 0.2, 0.0 }));
republicanPatterns.put(6, createResponseWeights(new double[] { 0.0, 0.8, 0.1, 0.1 }));
partyResponsePatterns.put(1, republicanPatterns);
// Libertarian Party patterns
Map<Integer, Map<String, Double>> libertarianPatterns = new HashMap<>();
libertarianPatterns.put(0, createResponseWeights(new double[] { 0.0, 0.2, 0.1, 0.7 }));
libertarianPatterns.put(1, createResponseWeights(new double[] { 0.0, 0.3, 0.7, 0.0 }));
libertarianPatterns.put(2, createResponseWeights(new double[] { 0.0, 0.2, 0.8, 0.0 }));
libertarianPatterns.put(3, createResponseWeights(new double[] { 0.0, 0.1, 0.9, 0.0 }));
libertarianPatterns.put(4, createResponseWeights(new double[] { 0.0, 0.2, 0.8, 0.0 }));
libertarianPatterns.put(5, createResponseWeights(new double[] { 0.0, 0.1, 0.9, 0.0 }));
libertarianPatterns.put(6, createResponseWeights(new double[] { 0.0, 0.1, 0.9, 0.0 }));
partyResponsePatterns.put(2, libertarianPatterns);
// Green Party patterns
Map<Integer, Map<String, Double>> greenPatterns = new HashMap<>();
greenPatterns.put(0, createResponseWeights(new double[] { 0.4, 0.0, 0.1, 0.5 }));
greenPatterns.put(1, createResponseWeights(new double[] { 0.3, 0.0, 0.0, 0.7 }));
greenPatterns.put(2, createResponseWeights(new double[] { 0.6, 0.0, 0.0, 0.4 }));
greenPatterns.put(3, createResponseWeights(new double[] { 0.4, 0.0, 0.0, 0.6 }));
greenPatterns.put(4, createResponseWeights(new double[] { 0.3, 0.0, 0.0, 0.7 }));
greenPatterns.put(5, createResponseWeights(new double[] { 0.3, 0.0, 0.0, 0.7 }));
greenPatterns.put(6, createResponseWeights(new double[] { 0.2, 0.0, 0.0, 0.8 }));
partyResponsePatterns.put(3, greenPatterns);
// Initialize partyDataPoints with fictional data points
// to simulate pre-existing training data
partyDataPoints[0] = 100; // Democratic
partyDataPoints[1] = 100; // Republican
partyDataPoints[2] = 50; // Libertarian
partyDataPoints[3] = 50; // Green
}
// Helper method to create response weights map
private static Map<String, Double> createResponseWeights(double[] weights) {
Map<String, Double> responseWeights = new HashMap<>();
for (int i = 0; i < weights.length; i++) {
responseWeights.put(String.valueOf(i), weights[i]);
}
return responseWeights;
}
// Add this new method to save survey responses to a TXT file
private static void saveSurveyToTxt(List<String> userResponses, String predictedParty, double confidence,
String actualParty) {
try {
// Create a filename with timestamp
String filename = "survey_response_" + ".txt";
try (PrintWriter writer = new PrintWriter(new FileWriter(filename))) {
writer.println("POLITICAL SURVEY RESPONSE");
writer.println("=========================");
writer.println();
for (int i = 0; i < QUESTIONS.size() - 1; i++) {
SurveyQuestion question = QUESTIONS.get(i);
String answer = question.getOptions()[Integer.parseInt(userResponses.get(i))];
writer.println("Question " + (i + 1) + ": " + question.getQuestion());
writer.println("Answer: " + answer);
writer.println();
}
writer.println("PREDICTION RESULTS");
writer.println("-----------------");
writer.println("Predicted Party: " + predictedParty + " Party");
writer.println("Confidence: " + String.format("%.1f%%", confidence * 100));
writer.println("Actual Party: " + actualParty + " Party");
writer.println();
writer.println("Survey completed successfully!");
}
System.out.println("\nSurvey responses have been saved to: " + filename);
} catch (IOException e) {
System.err.println("Error saving survey responses to file: " + e.getMessage());
}
}
private static List<String> conductSurvey() {
List<String> userResponses = new ArrayList<>();
int questionNum = 0;
int lastQuestionIndex = QUESTIONS.size() - 1;
String predictedParty = "";
double highestConfidence = 0.0;
System.out.println("Please answer the following questions:");
while (questionNum < lastQuestionIndex) {
SurveyQuestion question = QUESTIONS.get(questionNum);
System.out.println("\nQuestion " + (questionNum + 1) + ": " + question.getQuestion());
String[] options = question.getOptions();
for (int i = 0; i < options.length; i++) {
System.out.println(((char) ('A' + i)) + ". " + options[i]);
}
System.out.print("\nYour answer (A-" + (char) ('A' + options.length - 1) + "): ");
String userInput = scanner.nextLine().trim().toUpperCase();
if (userInput.length() == 1 && userInput.charAt(0) >= 'A' && userInput.charAt(0) < 'A' + options.length) {
int optionIndex = userInput.charAt(0) - 'A';
userResponses.add(String.valueOf(optionIndex));
// After collecting some responses, try to predict party
if (questionNum >= 2) {
double[] partyConfidences = calculatePartyConfidences(userResponses);
// Find the party with highest confidence
int maxConfidencePartyIndex = 0;
highestConfidence = partyConfidences[0];
for (int i = 1; i < partyConfidences.length; i++) {
if (partyConfidences[i] > highestConfidence) {
maxConfidencePartyIndex = i;
highestConfidence = partyConfidences[i];
}
}
predictedParty = POLITICAL_PARTIES[maxConfidencePartyIndex];
if (highestConfidence >= CONFIDENCE_THRESHOLD) {
System.out.println("\nBased on your answers so far, I predict you might align with the " +
predictedParty + " Party (Confidence: " +
String.format("%.1f%%", highestConfidence * 100) + ")");
}
}
questionNum++;
} else {
System.out.println("Invalid input. Please enter a letter between A and " +
(char) ('A' + options.length - 1));
}
}
if (!predictedParty.isEmpty()) {
System.out.println("\n==========================================================");
System.out.println("FINAL PREDICTION: Based on your responses, I predict your");
System.out.println("political affiliation is " + predictedParty + " Party");
System.out.println("Confidence: " + String.format("%.1f%%", highestConfidence * 100));
System.out.println("==========================================================\n");
}
SurveyQuestion lastQuestion = QUESTIONS.get(lastQuestionIndex);
System.out.println("Final Question: " + lastQuestion.getQuestion());
String[] partyOptions = lastQuestion.getOptions();
for (int i = 0; i < partyOptions.length; i++) {
System.out.println(((char) ('A' + i)) + ". " + partyOptions[i]);
}
boolean validInput = false;
while (!validInput) {
System.out.print("\nYour answer (A-" + (char) ('A' + partyOptions.length - 1) + "): ");
String userInput = scanner.nextLine().trim().toUpperCase();
if (userInput.length() == 1 && userInput.charAt(0) >= 'A' && userInput.charAt(0) < 'A' + partyOptions.length) {
int optionIndex = userInput.charAt(0) - 'A';
userResponses.add(String.valueOf(optionIndex));
validInput = true;
// We ompare prediction with actual affiliation
String actualParty = partyOptions[optionIndex];
System.out.println("\nYour actual affiliation: " + actualParty + " Party");
if (!predictedParty.isEmpty()) {
if (actualParty.equals(predictedParty)) {
System.out.println("Prediction was CORRECT!");
} else {
System.out.println("Prediction was incorrect. This data will help improve future predictions.");
}
}
saveSurveyToTxt(userResponses, predictedParty, highestConfidence, actualParty);
} else {
System.out.println("Invalid input. Please enter a letter between A and " +
(char) ('A' + partyOptions.length - 1));
}
}
return userResponses;
}
// here we calculate confidence scores for each party based on user responses
private static double[] calculatePartyConfidences(List<String> userResponses) {
double[] partyScores = new double[POLITICAL_PARTIES.length];
for (int partyIndex = 0; partyIndex < POLITICAL_PARTIES.length; partyIndex++) {
Map<Integer, Map<String, Double>> partyPattern = partyResponsePatterns.get(partyIndex);
double totalScore = 0.0;
for (int questionIndex = 0; questionIndex < userResponses.size(); questionIndex++) {
String response = userResponses.get(questionIndex);
Map<String, Double> questionPatterns = partyPattern.get(questionIndex);
if (questionPatterns != null && questionPatterns.containsKey(response)) {
double weight = questionPatterns.get(response);
totalScore += weight;
}
}
partyScores[partyIndex] = totalScore / userResponses.size();
}
double sum = 0.0;
for (double score : partyScores) {
sum += score;
}
if (sum > 0) {
for (int i = 0; i < partyScores.length; i++) {
partyScores[i] /= sum;
}
}
return partyScores;
}
// Add new training data based on user responses
private static void addTrainingData(List<String> userResponses) {
if (userResponses.size() != QUESTIONS.size()) {
return;
}
int actualPartyIndex = Integer.parseInt(userResponses.get(userResponses.size() - 1));
partyDataPoints[actualPartyIndex]++;
Map<Integer, Map<String, Double>> partyPattern = partyResponsePatterns.get(actualPartyIndex);
for (int questionIndex = 0; questionIndex < userResponses.size() - 1; questionIndex++) {
String response = userResponses.get(questionIndex);
Map<String, Double> questionPattern = partyPattern.computeIfAbsent(questionIndex, k -> new HashMap<>());
for (int optionIndex = 0; optionIndex < QUESTIONS.get(questionIndex).getOptions().length; optionIndex++) {
String option = String.valueOf(optionIndex);
double currentWeight = questionPattern.getOrDefault(option, 0.0);
if (option.equals(response)) {
double newWeight = (currentWeight * (partyDataPoints[actualPartyIndex] - 1) + 1.0) /
partyDataPoints[actualPartyIndex];
questionPattern.put(option, newWeight);
} else {
if (currentWeight > 0) {
double newWeight = (currentWeight * (partyDataPoints[actualPartyIndex] - 1)) /
partyDataPoints[actualPartyIndex];
questionPattern.put(option, newWeight);
}
}
}
double sum = 0.0;
for (double weight : questionPattern.values()) {
sum += weight;
}
if (sum > 0) {
for (String option : questionPattern.keySet()) {
questionPattern.put(option, questionPattern.get(option) / sum);
}
}
}
}
private static class SurveyQuestion {
private String question;
private String[] options;
public SurveyQuestion(String question, String[] options) {
this.question = question;
this.options = options;
}
public String getQuestion() {
return question;
}
public String[] getOptions() {
return options;
}
}
}

View File

@ -0,0 +1,31 @@
POLITICAL SURVEY RESPONSE
=========================
Question 1: What should the government do to help the poor?
Answer: Nothing, private charity should handle it
Question 2: What is your view on taxation?
Answer: Tax policies focused on environmental sustainability
Question 3: What is your stance on healthcare?
Answer: Community-based healthcare systems with government support
Question 4: What is your view on gun control?
Answer: Gun control with community-based oversight
Question 5: How should we address climate change?
Answer: Aggressive environmental policies and global cooperation
Question 6: What should be our approach to foreign policy?
Answer: International cooperation for peace and environmental protection
Question 7: What is your stance on immigration?
Answer: Humanitarian-focused immigration policies
PREDICTION RESULTS
-----------------
Predicted Party: Green Party
Confidence: 71.0%
Actual Party: Green Party
Survey completed successfully!

BIN
Cube.class Normal file

Binary file not shown.

BIN
Cylinder.class Normal file

Binary file not shown.

BIN
Main.class Normal file

Binary file not shown.

113
Main.java Normal file
View File

@ -0,0 +1,113 @@
/*
* in this Java program, the user can calculate the area of a rectangle,
* and the volumes of a cube, cylinder, and sphere.
* The user will be prompt to enter the length and width of a rectangle,
* and then choose a shape to calculate the volume of (cube, cylinder, or sphere).
*/
import java.util.InputMismatchException;
import java.util.Scanner;
class Rectangle {
public static double rectangleArea(double length, double width) {
return length * width;
}
}
class Cube {
public static double cubeVolume(double side) {
return Math.pow(side, 3);
}
}
class Cylinder {
public static double cylinderVolume(double radius, double height) {
return Math.PI * Math.pow(radius, 2) * height;
}
}
class Sphere {
public static double sphereVolume(double radius) {
return (4.0 / 3.0) * Math.PI * Math.pow(radius, 3);
}
}
// Main Class
public class Main {
public static void main(String[] args) {
Scanner scanner = new Scanner(System.in);
try {
// User prompt for the length and width
System.out.println("Rectangle Area");
System.out.print("Please enter length: ");
double length = scanner.nextDouble();
System.out.print("Please enter width: ");
double width = scanner.nextDouble();
// making sure that the user put positive numbers otherwise we throw a //warning
if (length <= 0 || width <= 0) {
System.out.println("WARNING! Length and width must be positive numbers.");
} else {
double area = Rectangle.rectangleArea(length, width);
System.out.println("Rectangle Area: " + area);
}
// Choose shape for volume calculation
System.out.println("");
System.out.println("Volume Calculation");
System.out.println("Choose a shape to calculate volume:");
System.out.println("1. Cube");
System.out.println("2. Cylinder ");
System.out.println("3. Sphere ");
System.out.print("Enter your choice (1-3): ");
int userChoice = scanner.nextInt();
// Let's give the User the choice of which volume shape they want to calculate.
switch (userChoice) {
case 1: // Cube
System.out.print("Enter side length of cube: ");
double side = scanner.nextDouble();
if (side <= 0) {
System.out.println("WARNING! Side must be a positive number.");
} else {
double cubeVolume = Cube.cubeVolume(side);
System.out.println("Cube Volume: " + cubeVolume);
}
break;
case 2: // Cylinder
System.out.print("Enter radius of cylinder: ");
double cylinderRadius = scanner.nextDouble();
System.out.print("Enter height of cylinder: ");
double cylinderHeight = scanner.nextDouble();
if (cylinderRadius <= 0 || cylinderHeight <= 0) {
System.out.println("WARNING! Radius and height must be positive numbers.");
} else {
double cylinderVolume = Cylinder.cylinderVolume(cylinderRadius, cylinderHeight);
System.out.println("Cylinder Volume: " + cylinderVolume);
}
break;
case 3: // Sphere
System.out.print("Enter radius of sphere: ");
double sphereRadius = scanner.nextDouble();
if (sphereRadius <= 0) {
System.out.println("WARNING! Radius must be a positive number.");
} else {
double sphereVolume = Sphere.sphereVolume(sphereRadius);
System.out.println("Sphere Volume: " + sphereVolume);
}
break;
default:
System.out.println("Invalid choice.");
}
} catch (InputMismatchException e) {
System.out.println("WARNING! Please enter valid numeric values.");
} finally {
scanner.close();
}
}
}

BIN
Rectangle.class Normal file

Binary file not shown.

BIN
Sphere.class Normal file

Binary file not shown.

42
index.html Normal file
View File

@ -0,0 +1,42 @@
<!DOCTYPE HTML>
<html>
<head>
<meta charset='UTF-8'>
<meta name='viewport' content='width=device-width, initial-scale=1.0'>
<meta http-equiv='X-UA-Compatible' content='ie=edge'>
<title>Document</title>
<style>
#div1,
#div2 {
float: left;
width: 200px;
height: 40px;
margin: 10px;
padding: 10px;
border: 1px solid black;
}
</style>
</head>
<body>
<h2>Drag and Drop Example</h2>
<p>Drag the image between the boxes</p>
<div id='div1' ondrop='drop(event)' ondragover='allowDrop(event)'>
<img src='https://study.com/images/reDesign/global/logo.png' draggable='true' ondragstart='drag(event)' id='drag1' width='195' height='35'>
</div>
<div id='div2' ondrop='drop(event)' ondragover='allowDrop(event)'></div>
<script>
function allowDrop(ev) {
ev.preventDefault();
}
function drag(ev) {
ev.dataTransfer.setData('text', ev.target.id);
}
function drop(ev) {
ev.preventDefault();
var data = ev.dataTransfer.getData('text');
ev.target.appendChild(document.getElementById(data));
}
</script>
</body>
</html>

11
study.com.iml Normal file
View File

@ -0,0 +1,11 @@
<?xml version="1.0" encoding="UTF-8"?>
<module type="JAVA_MODULE" version="4">
<component name="NewModuleRootManager" inherit-compiler-output="true">
<exclude-output />
<content url="file://$MODULE_DIR$">
<sourceFolder url="file://$MODULE_DIR$" isTestSource="false" />
</content>
<orderEntry type="inheritedJdk" />
<orderEntry type="sourceFolder" forTests="false" />
</component>
</module>