gpt4 book ai didi

Javascript 显示输出计算

转载 作者:行者123 更新时间:2023-11-28 05:02:42 25 4
gpt4 key购买 nike

我正在尝试显示总工作时间,假设是 40 允许输入小时工资让我们说 35.. 最后 显示总数为 1400..有人可以帮忙吗。

<!DOCTYPE html> <html> <head> <meta charset="utf-8">     <title>
assignment3</title> <script type= "text/javascript"> <!-- var name;
//string enterted by user
var input; //string enterted by user
var hours; //string enterted by user
var payRate; //string enterted by user
var grossPay; //string enterted by user

// read the name

name = window.prompt("What is your name?"); /*paranthesis missing and quotation marks misplaced */
input = window.prompt("Enter the hours you worked.");
hours = ParseInt();

input = window.prompt("Enter you hourly wage.");
payRate = ParseFloat();

grossPay = hours * payRate;

//result
document.writeln ("<h1> Hello" + name + " your gross pay is $" + grossPay+" <h1>");
//--> </script> </head> <body> </body> </html>

最佳答案

看起来您没有在 hourspayRate 内存储任何东西。请尝试使用 hours = ParseInt(input);payRate = ParseFloat(input);

关于Javascript 显示输出计算,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/40003646/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com