# Problem Set 3

## **Summary**

Solve each exercise so that your output matches the expected output. Each exercise should be written in the `main` method of its own class. Follow a file naming convention of `ExerciseX.java`, where `X` is 1 through 10, for each class file.

## Requirements

1. Create a new repository called `pset-3`.
2. Mark your repository as private, and add me as a collaborator (`ryanjwilson`).
3. Solve each of the exercises, placing each solution in its own file.
4. Add, commit, and push your code to the `pset-3` repository.

## Exercises

The specifications for each exercise are outlined below. Your job is to write code that meets the stated requirements, and matches my output exactly. Work through these exercises on your own. Experiment, make mistakes, ask questions, and fix your mistakes. It's the only way to get good at programming.

### Exercise 1

Print a square of text to the console.

* Use a single `print`, `printf`, or `println` statement.
* The use of the `String` concatenation operator is prohibited.
* The use of any `String` methods is prohibited.
* The use of `if` statements, `switch` statements, ternary operators, and loops is prohibited.

```
H E L L O
E       A
L       P
L       C 
O A P C S
```

### Exercise 2

Print a simple message to the console.

* Use a single `print`, `printf`, or `println` statement.
* The use of the `String` concatenation operator is prohibited.
* The use of any `String` methods is prohibited.
* The use of `if` statements, `switch` statements, ternary operators, and loops is prohibited.

```
"The answer's quite simple," the professor said. "Just think outside the box!"
```

### Exercise 3

Prompt the user to enter the dimensions of a rectangle (in inches).

* `Height :`&#x20;
* `Width  :`&#x20;

Calculate and print the area of the rectangle in square millimeters.

* Display exactly two decimal places.
* Format the area with separating commas, as needed.
* The use of the `Math` class is prohibited.
* The use of `if` statements, `switch` statements, ternary operators, and loops is prohibited.

```
Height : 8.5
Width  : 11

60,322.46 square millimeters.
```

### Exercise 4

Prompt the user to enter the dimensions of a rectangle (in inches).

* `Height :`&#x20;
* `Width  :`&#x20;

Calculate and print the perimeter of the rectangle in centimeters.

* Display exactly two decimal places.
* Format the perimeter with separating commas, as needed.
* The use of the `Math` class is prohibited.
* The use of `if` statements, `switch` statements, ternary operators, and loops is prohibited.

```
Height : 8.5
Width  : 11

99.06 centimeters.
```

### Exercise 5

A course grading policy defines the following assignment category weights.

* Homework, 15%
* Quizzes, 35%
* Tests, 50%

Prompt the user to enter three homework grades, two quiz grades, and one test grade.

* `Homework 1 :`&#x20;
* `Homework 2 :`&#x20;
* `Homework 3 :`&#x20;
* `Quiz 1     :`&#x20;
* `Quiz 2     :`&#x20;
* `Test 1     :`&#x20;

Calculate and print the user's marking period grade.

* Display exactly two decimal places.
* Format the grade with a `%` sign.
* The use of the `Math` class is prohibited.
* The use of `if` statements, `switch` statements, ternary operators, and loops is prohibited.

```
Homework 1 : 88
Homework 2 : 84
Homework 3 : 86
Quiz 1     : 80
Quiz 2     : 84
Test 1     : 92

87.60%.
```

### Exercise 6

Prompt the user to enter their hourly wage, as well as the number of hours per day they worked.

* `Wage      :`&#x20;
* `Monday    :`&#x20;
* `Tuesday   :`&#x20;
* `Wednesday :`&#x20;
* `Thursday  :`&#x20;
* `Friday    :`&#x20;
* `Saturday  :`&#x20;
* `Sunday :`

  Calculate and print the user's weekly gross pay.
* Display exactly two decimal places.
* Format the gross pay with a `$` sign.
* The use of the `Math` class is prohibited.
* The use of `if` statements, `switch` statements, ternary operators, and loops is prohibited.

```
Wage      : 15.25
Monday    : 8
Tuesday   : 8
Wednesday : 8
Thursday  : 10
Friday    : 6
Saturday  : 0
Sunday    : 4

$671.00.
```

### Exercise 7

Prompt the user to enter their annual salary, as well as the payroll deductions for their 401(k) contribution (deducted pre-tax), federal taxes, and state taxes, all of which should be in the form of a percentage.

* `Salary  :`&#x20;
* `401(k)  :`&#x20;
* `Federal :`&#x20;
* `State   :`&#x20;

Calculate and print the net pay for a single paycheck if the user is paid twice per month.

* Display exactly two decimal places.
* Format the net pay with a `$` sign.
* The use of `if` statements, `switch` statements, ternary operators, and loops is prohibited.

```
Salary  : 112000
401(k)  : 7
Federal : 21.43
State   : 6.37

$3,133.48.
```

### Exercise 8

Prompt the user to enter the number of students and teachers attending a class trip, as well as the capacity of the buses being used.

* `Students :`&#x20;
* `Teachers :`&#x20;
* `Capacity :`&#x20;

Calculate and print the number of buses required, as well as the number of passengers on a potentially partially filled last bus. There should be an overflow value only if the last bus is partially filled. If all buses are filled to capacity, you should have an overflow value of `0`.

* The use of the `Math` class is prohibited.
* The use of `if` statements, `switch` statements, ternary operators, and loops is prohibited.

```
Students : 273
Teachers : 28
Capacity : 54

Buses required      : 6
Overflow passengers : 31
```

### Exercise 9

Prompt the user to enter a dollar amount.

* `Amount :`&#x20;

Calculate and print the equivalent number of quarters, dimes, nickels, and pennies.

* Maximize larger coin denominations.
* The use of the `Math` class is prohibited.
* The use of `if` statements, `switch` statements, ternary operators, and loops is prohibited.

```
Amount : 2.43

Quarters : 9
Dimes    : 1
Nickels  : 1
Pennies  : 3
```

### Exercise 10

Prompt the user to enter a temperature (in Fahrenheit).

* `Fahrenheit :`&#x20;

Calculate and print the equivalent temperature in Celsius and Kelvin.

* Display exactly two decimal places.
* The use of the `Math` class is prohibited.
* The use of `if` statements, `switch` statements, ternary operators, and loops is prohibited.

```
Fahrenheit : 32.0

Celsius : 0.00
Kelvin  : 273.15
```

## Deliverables

1. Submit your repository URL.

Your program output should match mine exactly for each of the exercises above.

## Deadline

All submissions are due on Canvas by 11:59pm on Sunday, September 27, 2020.
