Question
This is my code. It's supposed to calculate a water bill then add 20% for a sewer bill. I can not get it to work
This is my code. It's supposed to calculate a water bill then add 20% for a sewer bill. I can not get it to work right. Please can someone help me? It's just in the script that needs the fixing.
List = new Array()
List [0] = 5000;
List [1] = 15001;
List [2] = 30001;
List [3] = 50001;
List [4] = 100000;
Prices = new Array()
Prices [0] = 4.85
Prices [1] = 5.28
Prices [2] = 5.75
Prices [3] = 6.21
Prices [4] = 6.37
function Calculate(){
GallonsEntered = document.Biller.Gal.value
for(i=0; i< List.length; ++i){
if (GallonsEntered p = Prices[i] i = List.length (i + " " + p) } else { p = Prices [List.length] } } amount = ((GallonsEntered/1000) * p) * 1.2 document.Biller.Owes.value = amount }
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started