\documentclass[11pt]{article}

\usepackage{enumitem}
\usepackage[margin=1in]{geometry}
\usepackage{graphicx}
\usepackage{multicol}
\usepackage[svgnames,table]{xcolor}

\setlength{\parindent}{0pt}
\setlength{\parskip}{1ex}
\pagestyle{empty}

% question style
\newcommand{\Q}[1]{\textcolor{SlateBlue}{\textit{#1}}\medskip}

% Java colors based on Eclipse
\definecolor{Jbgcolor}{HTML}{FAFAFA}
\definecolor{Jcomment}{HTML}{3F7F5F}
\definecolor{Jkeyword}{HTML}{7F0055}
\definecolor{Jstrings}{HTML}{2A00FF}

% Python colors based on IDLE
\definecolor{Pbuiltin}{HTML}{900090}
\definecolor{Pcomment}{HTML}{DD0000}
\definecolor{Pkeyword}{HTML}{FF7700}
\definecolor{Pstrings}{HTML}{00AA00}

% syntax highlighting
\usepackage{textcomp}
\usepackage{listings}
\lstset{
    basicstyle=\ttfamily,
    columns=fullflexible,
    keepspaces=true,
    showlines=true,
    showstringspaces=false,
    tabsize=4,
    upquote=true
}
\lstdefinestyle{morejava}{
    language=java,
    backgroundcolor=\color{Jbgcolor},
    commentstyle=\color{Jcomment},
    keywordstyle=\color{Jkeyword},
    stringstyle=\color{Jstrings}
}
\lstdefinestyle{morepython}{
    language=python,
    commentstyle=\color{Pcomment},
    keywordstyle=\color{Pkeyword},
    stringstyle=\color{Pstrings},
    deletekeywords={print},
    morekeywords=[2]{print},
    keywordstyle=[2]{\color{Pbuiltin}}
}
\lstnewenvironment{java}{\lstset{style=morejava}}{}
\lstnewenvironment{python}{\lstset{style=morepython}}{}

%------------------------------------------------------------------------------%
\begin{document}

\large
CS 374, HW2 \hfill Due: 01/30/2022
\begin{center}
\textbf{Type Your Name Here}
\end{center}
\hrule
\normalsize

%------------------------------------------------------------------------------%
\newpage
\subsection*{Question 3.1a (Conan EER)}
\Q{Draw an EER diagram to model the data requirements for Conan. Comment on the limitations of your EER model.}

\begin{center}
\includegraphics[width=0.90\linewidth]{TODO.png}
\end{center}

Type your answer here.

%------------------------------------------------------------------------------%
\newpage
\subsection*{Question 3.1b (Conan UML)}
\Q{Draw a UML diagram to model the data requirements for Conan. Comment on the limitations of your UML model.}

\begin{center}
\includegraphics[width=0.90\linewidth]{TODO.png}
\end{center}

Type your answer here.

%------------------------------------------------------------------------------%
\newpage
\subsection*{Basics of Python}

\Q{Rewrite the following Java snippets in Python. Do not include any unnecessary braces, parentheses, or semicolons. Your code should be equivalent, but it does not need to match line for line. You may assume that the math module has already been imported.}

\subsubsection*{A. Decisions}

\begin{multicols}{2}
\begin{java}
String info = "";
if (number < 100) {
    if (number % 2 == 0) {
        info = "primary east-west";
    } else {
        info = "primary north-south";
    }
}
System.out.println(info);
\end{java}
\columnbreak
\begin{python}
Type your answer here.
\end{python}
\end{multicols}

\subsubsection*{B. Loops}

\begin{multicols}{2}
\begin{java}
for (int i = 0; i < 10; i++) {
    System.out.println(i);
}

String s = "Hello";
for (int i = 0; i < s.length(); i++) {
    char c = s[i];    
    System.out.println(c);
}
\end{java}
\columnbreak
\begin{python}
Type your answer here.
\end{python}
\end{multicols}

\subsubsection*{C. Functions}

\begin{multicols}{2}
\begin{java}
public static double normalPDF(
    double mu, double sig, double x) {
    double b = (x - mu) * (x - mu);
    b = b / (2.0 * sig * sig);
    double a = sig *
        Math.sqrt(2 * Math.PI);
    return Math.exp(-b) / a;
}
\end{java}
\columnbreak
\begin{python}
Type your answer here.
\end{python}
\end{multicols}

%------------------------------------------------------------------------------%
\end{document}
