# Homework 1: Variables & Scanner

In this assignment you will be working with variables, and reading in user data with the Scanner class.

Note, in the examples, * indicates user input.

## 1. Calories

Write a program called Calories.java that computes the amount of calories a person burns in a week while walking. Each person burns a different amount of calories for every mile they walk. You will ask a user to input

1. how many miles they walked on average each day (a double)
2. an estimate of how many calories they burn per mile walked (a double).

The program will then print out how many calories the person burned that week by walking.

$javac Calories.java; java Calories How many miles did you walk each day? *2.3* How many calories do you burn per mile? *100.2* This week you burned 1613.22 calories by walking.  Requirements: • Use printf Print out two decimal points ## 2. Timer Write a program, Timer.java that computes the time when the user will finish all of their tasks. The program should ask the user for the following information: 1. The current time 2. How many tasks they need to complete 3. How long a task takes (we can assume that each task takes the same amount of time). Here is an example $ javac Tasks.java ; java Tasks
Enter the current hour: *23*
Enter the number of tasks: *1*
Enter the number of hours a task takes: *5*

You will finish at 4:00 o'clock.

$javac Tasks.java ; java Tasks Enter the current hour: *9* Enter the number of tasks: *3* Enter the number of hours a task takes: *2* You will finish at 15:00 o'clock.  You can assume that all times are integers that represent the time on a [24-hr “military” clock. For example, 7 PM is 19:00, or 19, in this representation. Requirements: • Use printf, dont worry about minutes or seconds, just hours. Use the % operator ## 3. Zoo time! Write a program, called Zoo.java, which will ask a prompt the user for the following information: 1. one animal 2. a noun 3. another animal 4. an adjective 5. a third animal 6. an adjective 7. a fourth animal 8. an adjective 9. a drink and then prints out the following song: $ javac Zoo.java; java Zoo

The monkeys stand for honesty
giraffes are insincere
And the elephants are kindly but they're dumb
orangutans are skeptical
Of changes in their cages
And the zookeeper is very fond of rum


In a text file called README.txt answer the following questions:

1. How much time did you spend on the homework
2. What did you learn from this homework
3. optional: What did you struggle with during this homework
4. optional: any other feedback you would like to share

Dont forget: make sure to fill in the header in all of your java files.

## Submitting

Submit the following files to the assignment called HW01 on Gradescope:

1. Zoo.java
2. Timer.java
3. Calories.java
4. README.txt

Make sure to name these files exactly what we specify here. Otherwise, our autograders might not work and we might have to take points off.