Skip to content

Commit 67ab23e

Browse files
committed
calorie tracker
1 parent bd337ef commit 67ab23e

File tree

9 files changed

+109
-11
lines changed

9 files changed

+109
-11
lines changed

src/SUMMARY.md

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,17 @@ battleship
4747
CLI Hangman
4848
Tic Tac Toe AI
4949
50+
TODO App
51+
52+
Task Description - data formats
53+
54+
Approximate PI
55+
56+
Pomodoro timer ()
57+
Terminal ANKI (might require threads)
58+
59+
Simple REST API
60+
HTML
5061
-->
5162

5263
# Modern Java
@@ -55,6 +66,7 @@ Tic Tac Toe AI
5566
- [Asking for Help](./prelude/asking_for_help.md)
5667
- [Toy Problems](./prelude/toy_problems.md)
5768
- [Lies](./prelude/lies.md)
69+
- [AI](./prelude/ai.md)
5870
- [Getting Started](./getting_started.md)
5971
- [First Steps](./first_steps.md)
6072
- [Comments](./first_steps/comments.md)
@@ -168,11 +180,12 @@ Tic Tac Toe AI
168180
- [Challenges](./loops/challenges.md)
169181

170182
# Concepts
171-
- [Software is an Interdisciplinary Field]()
172183

173184
# Projects
174185

175-
- [Calorie Tracker]()
186+
<!-- Software is an Interdisciplinary Field -->
187+
- [Prelude](./projects/prelude.md)
188+
- [Calorie Tracker](./projects/calorie_tracker.md)
176189

177190
# Data Types II
178191

src/prelude/ai.md

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
# AI
2+
3+
Do not use any form of AI when you are learning.
4+
5+
I could go into exactly why or shadowbox against why you might think its a good idea,
6+
but instead I am just going to ask that you trust me.
7+
8+
Don't do it.
9+
10+
If you find it hard to resist the temptation, install something like [this](https://getcoldturkey.com/)
11+
on your machine to block yourself from accessing AI websites.
12+
13+
When you get stuck reach out to a person for help.

src/projects/calorie_tracker.md

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
# Calorie Tracker
2+
3+
A calorie is the amount of energy needed to raise the temperature of
4+
1 gram of water by 1 degree celcius. A kilo-calorie, often shortened to kcal,
5+
is one thousand calories.
6+
7+
Food consumed by humans provides a certain amount of calories. Somewhat confusingly
8+
when people talk about "calories," as might be reported on food labels, they really mean
9+
kilo-calories.
10+
11+
For most of the history of the human species food was not an abundant resource. As such
12+
when food is abundant our brains are predisposed to consuming as much of it as possible.
13+
This is a behavior likely evolved in order that one best withstand periods of famine.[^biology]
14+
15+
The problem is that, while many places in the world still experience regular food shortages,
16+
many people have an extreme abundance of food available to them at all times. Not only that,
17+
the food they do have access to is often designed to be as addictive to consume as possible.
18+
19+
As such many of these people gain extreme amounts of weight.
20+
This, in turn, lead to many health problems.
21+
22+
Whether someone gains or loses weight over a given period of time comes down to "CiCo" - Calories In, Calories Out.
23+
If someone eats more in calories than they burn they are at a calorie surplus and will gain weight.
24+
If someone eats fewer calories than they burn they are at a calorie deficit and will lose weight.
25+
26+
There are also people out there in the world with the opposite problem. Not eating enough leads to starvation.
27+
Whether because of trauma, upbringing, or some other circumstance: some people will not naturally eat enough even
28+
when food is available to them.
29+
30+
## Your Goal
31+
32+
Your goal is to make a program that helps someone track the number of calories they have consumed
33+
in a given day.
34+
35+
The intent is to help them be intentional about the number of calories they are consuming.
36+
37+
We will count it as a success if the program you produce at least helps them track the total.
38+
39+
## Future Goals
40+
41+
When you learn enough to do the following, come back to this project and expand it.
42+
43+
* Make it so that if the computer running the program is turned off they do not lose information
44+
* Expand the program to also help them record the macro-nutritional value of the food they ate
45+
* Expand the program to also let them track their weight over time
46+
* Make it so that they can track their progress over multiple days, months, or years
47+
* Anything else you can think of
48+
49+
50+
51+
[^biology]: I am not an evolutionary biologist, but this is my understanding.

src/projects/prelude.md

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
# Prelude
2+
3+
Separate from the challenges at the end of each section I will be putting some projects
4+
sections throughout the book.
5+
6+
While the purpose of the challenges is to make you practice what you just read,
7+
the purpose of the projects is for you to put that knowledge into action.
8+
9+
This is for two reasons
10+
11+
1. If you don't practice for real, it is very difficult to learn things.
12+
2. I want to drive home that software is an interdisciplinary field.
13+
14+
The first reason means that, while be some early hand-holding, I largely expect
15+
you to put together projects on your own using what you have been shown.
16+
This means you will struggle. The hope is that in that struggle you are forced to learn,
17+
but you can always ask for help.
18+
19+
By that second point I mean we make software to do things in the real world.
20+
To do this requires understanding who would use the software, why, and for what purpose.
21+
I am going to try my best to have projects that make you interact with the world outside
22+
of software construction.

src/standard_input/challenges.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ void main() {
2727
// 1. Call IO.readln to get their age
2828
// 2. Interpret their age as an int
2929
// 3. Add one to that age
30-
// 2. Call IO.print/IO.println to say what age they will be next year
30+
// 4. Call IO.print/IO.println to say what age they will be next year
3131
}
3232
```
3333

@@ -49,7 +49,7 @@ void main() {
4949

5050
## Challenge 4
5151

52-
["Mad Libs"](https://en.wikipedia.org/wiki/Mad_Libs) are a word game where you ask people for nouns, verbs, and adjectives absent any context
52+
["Mad Libs"](https://en.wikipedia.org/wiki/Mad_Libs) are a word game where you ask people for nouns, verbs, adjectives, etc. absent any context
5353
and then fill them in to a template.
5454

5555
For example
@@ -66,5 +66,5 @@ I saw a dog today and flew.
6666
Unfortunately the clown stopped me at the elephant.
6767
```
6868

69-
Make a program that asks a user for some nouns, verbs, etc. and produces
69+
Make a program that asks a user for some nouns, verbs, etc. and prints
7070
a Mad Lib using those words.

src/standard_input/characters.md

Lines changed: 0 additions & 1 deletion
This file was deleted.

src/standard_input/floating_point_numbers.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,11 @@
33
If you expect someone to type a floating point value you can turn the `String`
44
you get from `IO.readln` into a `double` using `Double.parseDouble`.
55

6-
```java,do_not_run
6+
```java,no_run
77
void main() {
88
String gpaString = IO.readln("What is your GPA? ");
99
double gpa = Double.parseDouble(gpaString);
10-
IO.println("You are " + age + " years old!");
10+
IO.println("You're GPA is " + gpa);
1111
}
1212
```
1313

src/standard_input/integers.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
If you expect someone to type an integer value you can turn the `String`
44
you get from `IO.readln` into an `int` using `Integer.parseInt`.
55

6-
```java,do_not_run
6+
```java,no_run
77
void main() {
88
String ageString = IO.readln("How old are you? ");
99
int age = Integer.parseInt(ageString);

src/standard_input/other_types.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
Just as you can turn a `String` into an `int` using `Integer.parseInt` and you can
44
turn a `String` into a `double` using `Double.parseDouble`, you can use `Boolean.parseBoolean` to turn a `String` into a `boolean`.
55

6-
```java,do_not_run
6+
```java,no_run
77
void main() {
88
String happyString = IO.readln("Are you happy? ");
99
boolean happy = Boolean.parseBoolean(happyString);
@@ -14,7 +14,7 @@ void main() {
1414
But lest you become too comfortable, know that there is no `Character.parseCharacter` to turn a `String` into a character.
1515
It is not always going to be the case that there is just one way to convert a `String` to any given type.
1616

17-
```java,do_not_run,panics
17+
```java,no_run,panics
1818
void main() {
1919
String gradeString = IO.readln("What is your letter grade? ");
2020
// Does not exist!

0 commit comments

Comments
 (0)