0% found this document useful (0 votes)
2 views

using_abstractions_project (1)

The document outlines a project to create a program simulating an online store purchase using functions. It specifies requirements such as including comments, greeting the customer, prompting for item selection and quantities, calculating item totals and grand total with tax, and rounding the total. Additionally, it includes a written response section requiring code segments and explanations of the functions used in the program.

Uploaded by

mishasour22
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
2 views

using_abstractions_project (1)

The document outlines a project to create a program simulating an online store purchase using functions. It specifies requirements such as including comments, greeting the customer, prompting for item selection and quantities, calculating item totals and grand total with tax, and rounding the total. Additionally, it includes a written response section requiring code segments and explanations of the functions used in the program.

Uploaded by

mishasour22
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 3

Using Abstractions Project

Part I: Coding
Create a program using functions that simulates purchasing items from an online store.
The program must include the following.

1. Include comments with your name, the date, and the purpose of your program at
the start of the program.

2. Include the name of your store and a greeting for your customer.

3. Prompt the user to select three items.

4. Display the price for each item. (You decide the prices for each item and code
them into your program. For example, the first item would always be $3.50.)

5. Prompt the user to enter how many of each item they would like to buy.

6. Display each item's name and its total.


a. Use a function to calculate each item's total.
b. Return the item's total.

7. Display the grand total for the purchases, including tax. You may choose the tax
rate.
a. Create a function that calculates the total of the items plus the tax.
b. Return the total amount.
c. Tax can be calculated by adding up the items and multiplying the total by
the tax rate.
d. Total can be calculated by adding the tax to the total value of the items.

To round the total to two decimal places, you may use the following calculation:

Math.round(number * 100) / 100;

Where number is a numerical value or a variable

Example:

Unless Otherwise Noted All Content © 2023 Florida Virtual School. FlexPoint Education Cloud™ is a trademark of Florida Virtual School
let total = 35.505544;
let roundedTotal = Math.round(total * 100) / 100;
console.log(roundedTotal);

Outputs 35.51

Expected Output
Your output may look different depending on the type of store you set up and your
customer inputs.

Welcome to Top of the World Art


Your one shop stop for all your artistic needs!
= ===================================================== =

Enter the name of your first item: > sketchpad


Sketchpad's price is: $7.39
How many sketchpads would you like to buy? > 2

Enter the name of your second item: > charcoal pencil


charcoal pencil's price is: $1.22
How many charcoal pencils would you like to buy? > 4

Enter the name of your second item: > kneaded eraser


kneaded eraser's price is: $2.47
How many kneaded erasers would you like to buy? > 1

Please wait while I calculate your total.

Your total for the sketchpads is: $14.78


Your total for the charcoal pencils is: $6.1
Your total for the kneaded erasers is: $2.47

Your grand total with tax is: $24.75

Thank you for shopping at Top of the World Art!

Unless Otherwise Noted All Content © 2023 Florida Virtual School. FlexPoint Education Cloud™ is a trademark of Florida Virtual School
Part II: Written Response
In the word processing program of your choice, respond to the following prompts. For
prompts two and three, your responses should be in complete sentences using proper
grammar, spelling, and punctuation.
1. Copy and paste (or screen capture and paste) two program code segments.

a. The first program code segment must include one of your functions and the
following:
i. The function's name

ii. At least one parameter

iii. The sequence programming construct

b. The second program code segment must show where the function is called in
the program.

2. Describe what the function does and how it contributes to the overall program.

3. Explain in detail, line by line, the way your function works. Your description must
have enough detail that someone else could recreate it.

Part III: What to Submit

Submit the following to your instructor:


1. The .js file for your program
2. A .txt file (text file) with your program code
3. A document with your written responses

Unless Otherwise Noted All Content © 2023 Florida Virtual School. FlexPoint Education Cloud™ is a trademark of Florida Virtual School

You might also like