学习Javascript [英] Learning Javascript

查看:83
本文介绍了学习Javascript的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在学习Java,并正在学习一个程序,该程序可以读取作业成绩,期中考试1,中期成绩2和成绩,并计算整体平均成绩和最终成绩。假设作业的最大点为150,midterm1,midterm2和final的最大点为100.总体平均值计算如下:



作业:40%

midterm1:15%

midterm2:20%


决赛:25%


我想假设使用计算总体平均值的函数,以及计算最终成绩的另一个函数。你也可以在程序中使用

扩展if或者一个switch语句。


到目前为止我有这个;


[HTML] vr hw,mt1,mt2,fin,avg;


hw = parseFloat(提示(输入作业等级。));

mt1 = parseFloat(提示(输入Midterm 1 Grade。));

mt2 = parseFloat(提示(输入Midterm 2 Grade。));

fin = parseFloat(提示(输入最终成绩。));



if(hw> 150)

document.write(Homework points to large。< BR>);

if(hw< 0)

document.write(" Homework points to small。< BR>");

if(mt1> 100)

document.write(Midterm 1 points to large。< BR>);

if(mt1< 0)

document.write(" Midterm 1 points to small。< BR>");

if(mt2> 100)

document.write(" Midterm 2 points to large。< BR>");

if(mt2< 0)

document.write(Midterm 2 points to small。< BR>);

if(fin> 100)

document.write("最终积分是大的。< BR>");

if(fin< 0)

document.write(" Final points to small。< BR>");


hw = .40 * 150;

mt1 = .15 * 100;

mt2 = .20 * 100;

fin = .25 * 100;


avg =(hw + mt1 + mt2 + fin);



var grade;


if(avg< = 50)

document.write(" Grade is a F 。");

else if(avg< = 60)

document.write(& 等级是D.;;

否则如果(平均值<= 70)

document.write(等级为C);

else if(avg< = 80)

document.write(" Grade is a B。");

else if( avg< = 90)

document.write(Grade is a A。);


< / SCRIPT>

< / HEAD>

< BODY>


< / BODY>

< / HTML> [/ HTML]


我做得不好?

Hi, I am learning Java, and working on a program that reads the grades of homework, midterm1, midterm2, and final, and calculates the overall average and final letter grade. Assume that the maximum point of the homework is 150, and those of midterm1, midterm2 and final are 100. The overall average is to be calculated as follows:



homework: 40%

midterm1: 15%

midterm2: 20%

final: 25%

And am suppose to use a function that calculates the overall average, and another function that calculates the final grade. You are also to use an
extended if or a switch statement in the program.

I have this so far;

[HTML]vr hw,mt1,mt2,fin,avg;

hw= parseFloat(prompt("Enter Homework Grade."));
mt1= parseFloat(prompt("Enter Midterm 1 Grade."));
mt2= parseFloat(prompt("Enter Midterm 2 Grade."));
fin= parseFloat(prompt("Enter Final Grade."));



if(hw>150)
document.write("Homework points are to large.<BR>");
if(hw<0)
document.write("Homework points are to small.<BR>");
if(mt1>100)
document.write("Midterm 1 points are to large.<BR>");
if(mt1<0)
document.write("Midterm 1 points are to small.<BR>");
if(mt2>100)
document.write("Midterm 2 points are to large.<BR>");
if(mt2<0)
document.write("Midterm 2 points are to small.<BR>");
if (fin>100)
document.write("Final points are to large.<BR>");
if (fin<0)
document.write("Final points are to small.<BR>");

hw=.40*150;
mt1=.15*100;
mt2=.20*100;
fin=.25*100;

avg=(hw+mt1+mt2+fin);


var grade;

if (avg<=50)
document.write("Grade is an F.");
else if(avg<=60)
document.write("Grade is an D.");
else if(avg<=70)
document.write("Grade is an C.");
else if(avg<=80)
document.write("Grade is an B.");
else if (avg<=90)
document.write("Grade is an A.");

</SCRIPT>
</HEAD>
<BODY>

</BODY>
</HTML>[/HTML]

What am I not doing correctly?

推荐答案


我做得不好?
What am I not doing correctly?



1)在错误的部分发布;

2)将Java误认为Javascript。


我会将你的问题转到Javascript论坛部分;看到本页顶部附近的蓝色菜单栏

:选择''Forums''和''Javascript / Ajax''。


亲切的问候,


Jos

1) posting in the wrong section;
2) mistaking Java for Javascript.

I''ll move your question to the Javascript forum section; see the blue menu bar
near the top of this page: select ''Forums'' and ''Javascript/Ajax''.

kind regards,

Jos



1)在错误的部分张贴;

2)将Java误认为Javascript。


我会将你的问题移到Javascript论坛部分;看到本页顶部附近的蓝色菜单栏

:选择''Forums''和''Javascript / Ajax''。


亲切的问候,


Jos
1) posting in the wrong section;
2) mistaking Java for Javascript.

I''ll move your question to the Javascript forum section; see the blue menu bar
near the top of this page: select ''Forums'' and ''Javascript/Ajax''.

kind regards,

Jos



谢谢,我希望现在我的问题在正确的区域,我会得到我需要的帮助完成我的任务!


Thanks, I hope with my question in the correct area now, I will get the help I need to finish my assignment!



我正在学习Java,并正在开发一个程序来读取作业成绩,midterm1,midterm2,最后,并计算整体平均和最终字母等级。假设作业的最大点为150,midterm1,midterm2和final的最大点为100.总体平均值计算如下:



作业:40%

midterm1:15%

midterm2:20%


决赛:25%


我想假设使用计算总体平均值的函数,以及计算最终成绩的另一个函数。你也可以在程序中使用

扩展if或者一个switch语句。


到目前为止我有这个;


[HTML] vr hw,mt1,mt2,fin,avg;


hw = parseFloat(提示(输入作业等级。));

mt1 = parseFloat(提示(输入Midterm 1 Grade。));

mt2 = parseFloat(提示(输入Midterm 2 Grade。));

fin = parseFloat(提示(输入最终成绩。));



if(hw> 150)

document.write(Homework points to large。< BR>);

if(hw< 0)

document.write(" Homework points to small。< BR>");

if(mt1> 100)

document.write(Midterm 1 points to large。< BR>);

if(mt1< 0)

document.write(" Midterm 1 points to small。< BR>");

if(mt2> 100)

document.write(" Midterm 2 points to large。< BR>");

if(mt2< 0)

document.write(Midterm 2 points to small。< BR>);

if(fin> 100)

document.write("最终积分是大的。< BR>");

if(fin< 0)

document.write(" Final points to small。< BR>");


hw = .40 * 150;

mt1 = .15 * 100;

mt2 = .20 * 100;

fin = .25 * 100;


avg =(hw + mt1 + mt2 + fin);



var grade;


if(avg< = 50)

document.write(" Grade is a F 。");

else if(avg< = 60)

document.write(& 等级是D.;;

否则如果(平均值<= 70)

document.write(等级为C);

else if(avg< = 80)

document.write(" Grade is a B。");

else if( avg< = 90)

document.write(Grade is a A。);


< / SCRIPT>

< / HEAD>

< BODY>


< / BODY>

< / HTML> [/ HTML]


我做得不好?
Hi, I am learning Java, and working on a program that reads the grades of homework, midterm1, midterm2, and final, and calculates the overall average and final letter grade. Assume that the maximum point of the homework is 150, and those of midterm1, midterm2 and final are 100. The overall average is to be calculated as follows:



homework: 40%

midterm1: 15%

midterm2: 20%

final: 25%

And am suppose to use a function that calculates the overall average, and another function that calculates the final grade. You are also to use an
extended if or a switch statement in the program.

I have this so far;

[HTML]vr hw,mt1,mt2,fin,avg;

hw= parseFloat(prompt("Enter Homework Grade."));
mt1= parseFloat(prompt("Enter Midterm 1 Grade."));
mt2= parseFloat(prompt("Enter Midterm 2 Grade."));
fin= parseFloat(prompt("Enter Final Grade."));



if(hw>150)
document.write("Homework points are to large.<BR>");
if(hw<0)
document.write("Homework points are to small.<BR>");
if(mt1>100)
document.write("Midterm 1 points are to large.<BR>");
if(mt1<0)
document.write("Midterm 1 points are to small.<BR>");
if(mt2>100)
document.write("Midterm 2 points are to large.<BR>");
if(mt2<0)
document.write("Midterm 2 points are to small.<BR>");
if (fin>100)
document.write("Final points are to large.<BR>");
if (fin<0)
document.write("Final points are to small.<BR>");

hw=.40*150;
mt1=.15*100;
mt2=.20*100;
fin=.25*100;

avg=(hw+mt1+mt2+fin);


var grade;

if (avg<=50)
document.write("Grade is an F.");
else if(avg<=60)
document.write("Grade is an D.");
else if(avg<=70)
document.write("Grade is an C.");
else if(avg<=80)
document.write("Grade is an B.");
else if (avg<=90)
document.write("Grade is an A.");

</SCRIPT>
</HEAD>
<BODY>

</BODY>
</HTML>[/HTML]

What am I not doing correctly?



允许我在浏览器中输入积分,但不计算成绩?????

Allows me to enter points in browser, but is not calculating grades?????


这篇关于学习Javascript的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆