Instructions:
- Fork this repository to your GitHub account.
- Clone the forked repository locally to your machine.
- Create a new branch named Feature01.
Objective: Rewrite the code conditional code in Rewrite.java by using a single if statement and logical operators.
Objective: Modify the existing Guess My Number game from your previous lab to provide feedback on whether the guess is too high or too low. Continue until the user guesses correctly or reaches three incorrect guesses. Display a message and terminate the program if the correct number is guessed.
- I've given you a file
src/GuessMyNumber2.javato complete this part.
Fermat’s Last Theorem says: If n > 2, there are no integers a, b, c, and n such that
Objective:
Write a program in a file named src/Fermat.java that checks Fermat’s Last Theorem for four input integers (a, b, c, and n). If ( n > 2 ) and ( a^n + b^n = c^n ), display "Holy smokes, Fermat was wrong!" Otherwise, display "No, that doesn’t work."
Hint: Math.pow is useful.
Objective: Using the given variables, evaluate the logic expressions in the table below and write your answers as true, false, or error in the Markdown table's Result column.
boolean yes = true;
boolean no = false;
int loVal = -999;
int hiVal = 999;
double grade = 87.5;
double amount = 50.0;
String hello = "world";| Expression | Result |
|---|---|
| yes == no || grade > amount | |
| amount == 40.0 || 50.0 | |
| hiVal != loVal || loVal < 0 | |
| True || hello.length() > 0 | |
| hello.isEmpty() && yes | |
| grade <= 100 && !false | |
| !yes || no | |
| grade > 75 > amount | |
| amount <= hiVal && amount >= loVal | |
| no && !no || yes && !yes |
Objective: Determine the output of the program in FlowOfExecution.java without using IntelliJ or another IDE. Understanding how to trace through code, understand logical operators, and following the flow of execution is critical to becoming a good programmer, and of course just a good problem solver.
Objective:
Create a file named src/Triangle.java and write a program in it that determines if three given lengths can form a triangle. The test for triangle formation is as follows:
- If any of the three lengths is greater than the sum of the other two, you cannot form a triangle.
Requirements:
- Input three integers representing the lengths of sticks.
- Output whether you can (or cannot) form a triangle with the given lengths.
- Create code to validate inputs are valid integers.
- Display an error if any of the lengths are negative or zero.
Follow these steps for submission:
- Create a Feature01 branch of your code if you haven't already.
- Commit your working code for all exercises to your local copy/Feature01 branch.
- Push it to your Remote/origin branch (i.e., GitHub: Feature01 -> origin/Feature01).
- Issue a Pull request to my instructor repo.
- Make sure to COPY the Pull request URL and submit it for the lab/assignment in Canvas.