Home
JavaScript Fundamentals (1)

Coding Challenge:

Mark is on his lunch break from canvassing. He has a financial goal he's trying to reach by the end of the day. He wants to see how many more books he needs to get out and how many more people he needs to reach to achieve his financial goal.

Each book is $15 and Every 1 out of 10 people receive 2 books.

Your task is to write some code to help him:

  1. Store Marks Financial Goal and books he got out today in variables called financialGoal, booksOut.
  2. Calculate how much money mark should have in his canvassing wallet and how much further he needs to reach his goal.
  3. Calculate how many books he needs to get out to reach that goal and how many people he needs to reach before the end of the day. Log these to the screen
  4. BONUS: Create a Boolean variable that determines whether mark's has extra money in his wallet. and another boolean variable if mark has already reached his goal!
  5. BONUS2: Mark has 2 other books with different prices. a small book called an hd is $5 and a cookbook is $20. Calculate how much mark has in his wallet with the different books.

TEST DATA 1: Mark has gotten out 8 books in the first half and his goal is 180 today.

TEST DATA 2: Mark has gotten out 15 books in the first half and his goal is 200 today

Bonus DATA 1 : Mark has gotten out 3 books in the first half. His goal is 250 and he has $100 in his canvassing wallet.

Bonus DATA 2: Mark has gotten out 7 books in the first half. His goal is 150 and he has $100 in his canvassing wallet.

Bonus2 Data 1:  Mark has gotten out 3 hds 3 books and 2 cookbooks in the first half. His goal is $100, in his wallet he has $93.

Bonus2 Data 2: Mark has gotten out 0 hds 5 books and 3 cookbooks in the first half. His goal is $150, in his wallet he has $150.

Basic OperatorsStrings and Template Literals