← Back to Week 1 Hub

Math Application

Solve math problems using Java's built-in Math class methods

Workbook 1c, p.71-72 — Exercises: Operators, Exercise 3

In Plain English

You're solving 8 math problems using Java's built-in Math tools. Each problem uses a different Math method. No user input — just set values, calculate, and print results.

What a Successful Run Looks Like
The highest salary is 65000.0
The smallest price is 18000.0
The area of the circle is 165.13...
The square root of 5.0 is 2.236...
The distance between the points is 89.44...
The absolute value of -3.8 is 3.8
The random number is 0.xxx
Minutes in 24 days: 34560
Milliseconds in 24 days: 2073600000

The random number line will show a different decimal value each time you run the program. Decimal values marked with "..." may show more decimal places.

What This Exercise Practices
Flow Diagram
Problem 1: Set two salaries Math.max() Print largest

Problem 2: Set two prices Math.min() Print smallest

Problem 3: Set radius Math.PI + Math.pow() Print area

Problem 4: Set value Math.sqrt() Print result

Problem 5: Set two points Math.sqrt() + Math.pow() Print distance

Problem 6: Set value Math.abs() Print result

Problem 7: No setup needed Math.random() Print result

Problem 8: Set days = 24 Multiply conversions Print minutes + ms
Pattern: Every problem follows the same structure — declare values, apply a Math method (or arithmetic), then print the result with System.out.println().
← VariableApp + Receipt Basic Calculator →