Read the directions below and follow along with your TAs.
Note 1: This page (and other assignments and materials) use MathML for formatting mathematics. This uses special fonts for mathematics, which usually works but seems to be missing on some computers. The best "check" for this is to look at question 4 below - you should see a formula with a giant radicand (square root). If you see that, great! If you don’t see it (e.g., just see a box) then you should investigate how to install MathML fonts (or use a different browser...).
Normally, your labs aren't a full lecture. This time, however, we take things slow to get you acclimated with the IntelliJ programming environment. Please follow along with your lab TAs, who will introduce themselves, to install the IDE. They will also demo how to set up an IntelliJ project, write a class, a method with documentation and tests, as well as how to submit files to the autograder. Pay attention to these demonstrations. You'll be doing this all semester, so it's best to listen fully now, rather than not know what to do later on down the road.
Every lab, including this one, will begin with a 15 minute quiz on Canvas. (This time, however, you will have two quizzes: the first is about the syllabus and the second is about this week's content.)
These quizzes are worth 20% of the lab grade, with the coding component being worth the other 80%. You are allowed and encouraged to collaborate on the quiz as well. The quizzes are multiple-choice and are designed to test your understanding of minor details. What this entails is that they will be pedantic and you will probably not score perfectly every time, if ever.
This is not something to be discouraged by, because they are intentionally tricky. If you have read the relevant textbook material, attended class, and done the necessary outside study, you will almost certainly get these fully correct. You cannot retake a quiz. You cannot take quizzes early.
Arriving late to the quiz means that you only get however much time you have to take it. Consequently, if you arrive after the quiz submission time, you will receive a zero.
If you have to attend another lab or are sick/cannot come to one lab, follow the policies laid out in the syllabus.
We cannot stress this enough: ask, ask, ask, ask questions. Do NOT simply sit confused. That is the absolute last thing that you should do. The second-to-last thing that you should do is use ChatGPT/AI to do the work for you, or simply Google the problem. Using ChatGPT is a violation of the academic integrity policy, and all incidents will be reported to the university. Moreover, none of these are beneficial to you or your group's learning. We, as the course staff, care about your learning, and if you are struggling, you need to let us know! As we have (and will repeatedly) expressed in class, please do not feel stupid or anxious about asking questions. If you have a question, there is almost certainly at least one other student with that exact same question, so you're doing them a service by asking.
At the same time, however, we expect collaboration and discussion. This means that, if the lab TAs are walking people through a problem, as a class, you should contribute meaningfully to the conversation and answer questions, even if you are unsure.
As the section title suggests, if you don't finish every lab within the allotted lab time, it's not the end of the world. If you have consistently been on-task, working diligently with your partner/group, then this is generally enough for a very good score on the lab. It is also up to the discretion of the UIs to allow you to complete the lab after the deadline. If they (the UIs) do permit this, you are only allowed to submit up to 11:59PM on the day of your lab. For example, if your lab is at 1:50PM-3:45PM on Thursday, and your UIs let you finish the lab after the standard 3:45PM deadline, you must submit by 11:59PM on Thursday night. You will earn a 0 if you do not submit anything to the autograder by the night of the lab, no exceptions.
Design the double celsiusToFahrenheit(double c) method, which converts a given temperature from Celsius to Fahrenheit.
Files to Submit: Problem1.java, Problem1Test.java
Design the int combineDigits(int a, int b) method, which receives two
int values between 0 and 9, and combines them into a single two-digit number.
The first parameter a is the ten's digit and the second parameter b
is the one's digit. For example, combineDigits(4, 5) returns 45.
If a is 0, then it's acceptable for the resulting value to be only one digit.
Do not simply use string concatenation.
Files to Submit: Problem2.java, Problem2Test.java
Design the double logBase(double n, double b) that, when given a number
$n$ and a base $b$, returns $\log_{b}(n)$.
You will need to make use of the change-of-base formula, which we provide below
($n$ is the number to compute the logarithm of,
$b'$ is the old base, and $b$ is the new base).
Assume that the given number $n$ is in base $10$.
\[ \log_b(n) = \dfrac{\log_{b'}(n)}{\log_{b'}(b)} \]
Files to Submit: Problem3.java, Problem3Test.java
Design the double crazyMath(double x) method, which receives a value of
$x$ and computes the value of the following expression:
\[ \sqrt{\left|\left(e^{-x} + {\cos{\frac{2}{x}}}\right) \cdot \left({\frac{\sin(\pi{}x - 2\pi) + 17x\pi} {\log_3{\left|x\right|} \cdot \log_7{\left|x\right| \cdot \ln{\left|x\right|}}}}\right)\right|} \]
Below are some test cases.
Hint 1: when testing this method, you may want to use the
delta parameter of assertEquals!
Hint 2: you may want to leverage the logBase method that you wrote in the previous problem!
crazyMath(0) => NaN
crazyMath(1) => Infinity
crazyMath(2) => 21.52368973013284
crazyMath(3) => 14.692493055407942
crazyMath(10) => 9.574086130947974
crazyMath(100000) => 86.49768321282015
Files to Submit: Problem4.java, Problem4Test.java