\documentclass[a4paper,11pt]{article}

\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage{graphicx}
\usepackage{xcolor}

\renewcommand\familydefault{\sfdefault}
\usepackage{tgheros}
\usepackage[defaultmono]{droidsansmono}

\usepackage{amsmath,amssymb,amsthm,textcomp}
\usepackage{enumerate}
\usepackage{multicol}
\usepackage{tikz}

\usepackage{geometry}
\geometry{left=25mm,right=25mm,%
bindingoffset=0mm, top=20mm,bottom=20mm}


\linespread{1.3}

\newcommand{\linia}{\rule{\linewidth}{0.5pt}}

% custom theorems if needed
\newtheoremstyle{mytheor}
    {1ex}{1ex}{\normalfont}{0pt}{\scshape}{.}{1ex}
    {{\thmname{#1 }}{\thmnumber{#2}}{\thmnote{ (#3)}}}

\theoremstyle{mytheor}
\newtheorem{defi}{Definition}

% my own titles
\makeatletter
\renewcommand{\maketitle}{
\begin{center}
\vspace{2ex}
{\huge \textsc{\@title}}
\vspace{1ex}
\\
\linia\\
\@author \hfill \@date
\vspace{4ex}
\end{center}
}
\makeatother
%%%

% custom footers and headers
\usepackage{fancyhdr}
\pagestyle{fancy}
\lhead{}
\chead{}
\rhead{}
\lfoot{CSC 1109 Lab 1}
\cfoot{}
\rfoot{Page \thepage}
\renewcommand{\headrulewidth}{0pt}
\renewcommand{\footrulewidth}{0pt}
%

% code listing settings
\usepackage{listings}
\lstset{
    language=java,
    basicstyle=\ttfamily\small,
    aboveskip={1.0\baselineskip},
    belowskip={1.0\baselineskip},
    columns=fixed,
    extendedchars=true,
    breaklines=true,
    tabsize=4,
    prebreak=\raisebox{0ex}[0ex][0ex]{\ensuremath{\hookleftarrow}},
    frame=lines,
    showtabs=false,
    showspaces=false,
    showstringspaces=false,
    keywordstyle=\color[rgb]{0.627,0.126,0.941},
    commentstyle=\color[rgb]{0.133,0.545,0.133},
    stringstyle=\color[rgb]{01,0,0},
    numbers=left,
    numberstyle=\small,
    stepnumber=1,
    numbersep=10pt,
    captionpos=t,
    escapeinside={\%*}{*)}
}

%%%----------%%%----------%%%----------%%%----------%%%

\begin{document}

\title{CSC 1109 Lab 1}

\author{Woon Jun Wei, 2200624}

\date{\today}

\maketitle

\section*{Question 1}
Which version of the Java SDK did you install?
\\
I installed `openjdk-19.0.1` with Intellij.

\section*{Question 2}
With reference to the lecture slides (Week 1), Java Program Structure Examples, modify:
\subsection*{Part A}

Example 1, print out console message with “Hello, I am [your name]!”.

\begin{lstlisting}[label={list:first},caption=Part A Source Code.]
public class parta {
	public static void main(String[] args) {
		System.out.println("Hello, I am Jun Wei");
    }
}

\end{lstlisting}

\begin{lstlisting}[label={list:first_output},caption=Part A Output.]
Hello, I am Jun Wei
\end{lstlisting}

\pagebreak

\subsection*{Part B}
Example 3, change the currency variable into the module code you are taking in this trimester, while the switch case will print out the complete module title. E.g.: input CSC1009 > Output “Object-Oriented Programming”
\begin{lstlisting}[label={list:second},caption=Part B Source code.]
import java.util.Scanner;

public class partb {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);

        System.out.println("Enter module code: ");
        String module = sc.nextLine();

        switch(module){
            case "CSC1109":
                System.out.println("Object-Oriented Programming");
                break;
            case "CSC1108":
                System.out.println("Data Structures and Algorithms");
                break;
            case "INF1006":
                System.out.println("Computer Networks");
                break;
            case "INF1004":
                System.out.println("Mathematics 2");
                break;
            default:
                System.out.println("Invalid module code");
                break;
        }
    }

}
\end{lstlisting}

\begin{lstlisting}[label={list:second_output},caption=Part B Output.]
Enter module code: 
CSC1109
Object-Oriented Programming
\end{lstlisting}

\pagebreak
\subsection*{Part C}

Example 4: change the for loop, print out the odd number in descending order starting from 102 and ending with 66

\begin{lstlisting}[label={list:third},caption=Part C Source Code.]
public class partc {
    public static void main(String[] args) {
        for(int i = 102; i >= 66; i--){
            if(i % 2 == 1){
                System.out.println(i);
            }
        }
    }
}
\end{lstlisting}

\begin{lstlisting}[label={list:third_output},caption=Part C Output.]
	101
	99
	97
	95
	93
	91
	89
	87
	85
	83
	81
	79
	77
	75
	73
	71
	69
	67
\end{lstlisting}

\end{document}