boat

Javascript

interactive web design

prompt

 

A vet needs a computer program to input a payment from a customer and calculate the tax.

Follow the tasks below and see if you can solve the problem!

TASK 1 - Get organised

 
Create a project folder called JFocus2 inside your Javascript folder.
 

Download this image and save it in your project folder.

 

Download this webpage and save it in your project folder. Open it with a text editor, eg Sublime Text, and a web browser.

Task 2 - Video

 

Follow the video and see if you can get data from the keyboard into Javascript variables:

Task 3 - Create sentences!

 

Continue the code to also get the user's address from the keyboard.

Create 4 sentences in the console. Here are some examples:

  • Your name is Jack.
  • You live in Setagaya, Tokyo.
  • Your bill was $100.
  • The tax will be $20.

If there is an error, it is probably a syntax error. Syntax is the punctuation of a programming language. Double check your punctuaution!

Adaptation Challenge #1

Vincent The Vet has an offer for repeat customers.

A repeat customer only pays 10% tax. Everyone else still pays 20% tax.

Update your code so that the program also asks if the customer is a repeat customer.

IF the answer is yes, the tax is 10% of the payment.

ELSE, the tax is 20% of the payment.

Adaptation Challenge #2

Once all of the data is entered and the results are displayed, a dog barks.

Download the mp3 file, save it in your project folder and research how to make this happen. The user should not have to click a play button, the dog will bark automatically.

SUBMISSION

Submit your solution as instructed by your tutor.


Tags

browser file tags body save h1 html h4 h2 structure refresh h3 be organised! console parseInt variable input