Hello so I am trying to work on this code for my Java Script class and I am stuck on how to proceed. The instructions for the problem we were given were as follows:
Create a simple self-checkout system. Prompt for the prices and quantities of three items. Calculate the subtotal of the items. Then calculate the tax using a tax rate of 5%. Print out the line items with the quantity and total, and then print out the subtotal, tax amount, and total.
Here is my code so far:
// Make a function for a simple self-checkout system.
// prompt the user for quantity of the items
// Prompt the user for the prices of the items
function self_Checkout () {
var prices = [x, y, z,];
var x = prompt('Enter value');
var quantity_x = prompt('Enter value for quantity of item 1');
return x * quantity_x;}
{ if
var y = prompt('Enter value');
var quantity_y = prompt('Enter value for quantity of item 2');
return y * quantity_y;
{ if
var z = prompt('Enter value');
var quantity_z = prompt('Enter value for quantity of item 3');
return z * quantity_y;
// Multiply entire total by a tax rate of 5%
// Return value of total of all items + tax to user
// Use console.log or document.write?
}
Now the assignment also mentions how we are supposed to use loops objects and arrays also in this problem. I have attempted to add a array in the code. Some help on how to proceed in my code would be much appreciated, hopefully i explained it well enough to get some help.