Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Learning Objectives: This assignment is designed to practice: 1. Basic understanding of JavaScript variables, including; aThe declaration, initialization and assignment processes 2.Obtain user input by

Learning Objectives: This assignment is designed to practice: 1. Basic understanding of JavaScript variables, including; aThe declaration, initialization and assignment processes 2.Obtain user input by via the prompt() function and present output to the user through the alert() function 3.Data type conversion in variables (strings to numbers, convert to upper case) 4.Use of the conditional if and if/else statements 5.Use of arithmetic and logic operators 6.Use of comments Directions: You are provided an html program, assignment6.html. Your responsibility is to insert the JavaScript statements that will solve the problem discussed below, and to comment the html file with the requested information per the requirements. For the JavaScript, you will only complete the section inside of the 1 Problem to solve: The Good Sipping Coffee Shop has a frequent buyer club that awards points to its customers based on the number of coffees purchased each month. The points are awarded as follows: If a customer purchased no coffees, they earn 0 points If a customer purchased 1 coffee, they earn 2 points If a customer purchased 2 coffees, they earn 5 points If a customer purchased 3 coffees, they earn 9 points If a customer purchased more than 3 coffees, they earn 9 points plus an additional 2 points for each coffee above 3. Preferred Customers receive a bonus of double award points. The Good Sipping Coffee Shop website needs to be updated to ask the customer to enter the number of coffees purchased last month, confirm if they are a Preferred Customer, and then calculate and display the number of award points earned. Requirements: For this assignment; 1.Your program will calculate the award points as described above. 2.You will generate HTML comments to add your name, section and TA name. Each on a separate line within the tags. This will (should) NOT be visible in the document on the web browser. 3.You will then add JavaScript code to the provided assignment6.html skeleton file within the 4.A typical program flow would declare the variables needed to solve the problem, initialize the variables, solicit input, perform the data manipulation and/or calculations and display the result. 5.Utilize JavaScript comments to explain the steps you are preforming within your code. A JavaScript comments form is: /* Place your comment between the stars */ 6.You will utilize prompt() functions to request input from the customer. Your message should be descriptive enough to solicit data from someone not familiar with the assignment. 2 7.You will utilize the alert() function to display your output as a clear and understandable message to the customer. 8.Variable names should be descriptive. For example, if a program is calculating the total dollar amount paid for a bill at a restaurant, it may have a variable named tipAmount. 9.Utilize at least one if/else statement. Consider using the if/else in determining the bonus points. Additional Information: Since the contents of a text box, which is what the prompt() function generates, is going to be used in mathematical operations, use the function parseInt() to convert the text to a number. Otherwise your calculation operations will not perform as expected. Example: variableName = parseInt(variableName) To simplify the comparison of solicited text, it is often easier to convert this text to upper case. Example: variableName = variableName.toUpperCase();

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Big Data Systems A 360-degree Approach

Authors: Jawwad ShamsiMuhammad Khojaye

1st Edition

0429531575, 9780429531576

More Books

Students also viewed these Databases questions