Go Back   CodingForums.com > :: Client side development > JavaScript programming

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 12-20-2012, 05:41 AM   PM User | #1
Diexaint
New to the CF scene

 
Join Date: Dec 2012
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Diexaint is an unknown quantity at this point
[CODE](REQUEST)Grade Calculator

I really hope someone can help me immediately. My sister needs to finish this project so she can pass her Web Development subject. Apparently she can't focus on this because she is loaded with other projects and the deadline for this is tomorrow. Apparently, I know nothing about coding or programming since it is not my course. These are the instructions.

I. Applications. Do the following.
a. Create a JavaScript using function that will compute the students’ grades from Prelims, Midterms and Finals to get the Final Academic Grade for SY 2012 – 2013.
First, you have to get first the 30% of the Prelims, 30% of the Midterms and 40% of the Finals to get the Final Academic Grade of a student.
Your program should display the result of the GRADE of a student including his/her Name, Student Number and Subject Code and Subject Description. For the additional information, the program must give a remark whether the student passed or failed the subject base on the Final Academic Year result.
b. Save it as Surnameofthestudent_GradesComputaiton_Finals.html
c. Create a JavaScript program that will display an array of integers no less than 55 by 3’s. Save it as Surnameofthestudent_Array_Finals.html
d. Create a Folder and name it as Surnameofthestudent_Finals, and put inside of it your exam file.

Student Number: 0557-0512-2625
Name: Cassandra Andrews
Subject Code: IT112
Subject Description: WebDev

The grades inputted can be of your choice, meaning any grade will do. I hope I get a fast response for this. Thank you for anyone willing to help.
Diexaint is offline   Reply With Quote
Old 12-20-2012, 07:23 AM   PM User | #2
Philip M
Supreme Master coder!

 
Philip M's Avatar
 
Join Date: Jun 2002
Location: London, England
Posts: 17,044
Thanks: 197
Thanked 2,412 Times in 2,390 Posts
Philip M has a spectacular aura aboutPhilip M has a spectacular aura aboutPhilip M has a spectacular aura about
Please have a look at forum Rule #1.5.

This forum is not a free coding service. As a general rule, the people helping out in this forum don't write code for others (especially code that appears to be for homework), but try to help with fixing code that doesn't work. You may perhaps get someone to write this script for you, but you'll be far more likely to get help if you have made a substantial effort and written some code yourself. Then someone here will almost certainly help you correct/improve your work.


It is your responsibility to die() if necessary….. - PHP Manual
__________________

All the code given in this post has been tested and is intended to address the question asked.
Unless stated otherwise it is not just a demonstration.
Philip M is online now   Reply With Quote
Old 12-20-2012, 07:36 AM   PM User | #3
felgall
Master Coder

 
felgall's Avatar
 
Join Date: Sep 2005
Location: Sydney, Australia
Posts: 5,465
Thanks: 0
Thanked 499 Times in 491 Posts
felgall is a jewel in the roughfelgall is a jewel in the roughfelgall is a jewel in the rough
Sounds like someone has put off doing something that was expected to take weeks if not months for them to do and now is complaining because they don't have the time to do it with only hours before it is due.

This is certainly NOT the way to proceed with programming courses. You need to tackle programming assignments IMMEDIATELY when they are first given as the number of times you may need to ask your teacher or on a forum such as this one for assistance in understanding the small pieces of the assignment may take a lot longer than you might expect. Particularly if you are one of the majority who doesn't really have an aptitude for programming.

If you have a month to do the project and you have been asking for help with numerous different problems for four weeks and the assignment is due tomorrow then there is a slight possibility that someone might take pity on you and tell you how to fix it.

The other alternative is to offer to pay someone to do it for you and then they will write something way too advanced compared to what the teacher expects making it obvious that you have cheated and you end up failing anyway. Only by doing most of the work yourself will you end up with a result that works as an answer to the course because unless the person doing the work has actually done the course then their way of coding is likely to be very different from what the course is teaching. Since most JavaScript courses are taught by people with almost no exposure to JavaScript themselves beyond that of their ten your old (obsolete) textbook the script someone who knows JavaScript would write to solve the problem would possibly not even be recognisable as JavaScript to the teacher.

So even if you could pay someone to write the script for you it wouldn't help you pass the course.
__________________
Stephen
Learn Modern JavaScript - http://javascriptexample.net/
Helping others to solve their computer problem at http://www.felgall.com/
felgall is offline   Reply With Quote
Old 12-20-2012, 07:36 AM   PM User | #4
Diexaint
New to the CF scene

 
Join Date: Dec 2012
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Diexaint is an unknown quantity at this point
Sorry, I didn't have time to read the rules. I tried to work on it after searching about this stuff on the net a bit. I'm not really sure if I'm doing this right.

<html>
<head><title>Grade Calculator</title></head>
<script language=JavaScript>
function average (a,b,c)
{
var total, avgPrelims, avgMidterm, avgFinals;
avgPrelims= parseFloat(a)*.30;
avgMidterm= parseFloat(b)*.30;
avgFinals= parseFloat(c)*.40;
total = parseFloat(avgPrelims)+parseFloat(avgMidterm)+parseFloat(avgFinals);
window.alert('The average of your Prelims is'+ avgPrelims);
window.alert('The average of your Midterms is'+ avgMidterm);
window.alert('The average of your finals is'+ avgFinals);
window.alert('Your total is'+total);
}
</script>
<script language=JavaScript>
var a = window.prompt('Enter Prelims Grade');
var b = window.prompt('Enter Midterm Grade');
var c = window.prompt('Enter Finals Grade');
average (a,b,c);
</script>
</html>
Diexaint is offline   Reply With Quote
Old 12-20-2012, 07:41 AM   PM User | #5
Diexaint
New to the CF scene

 
Join Date: Dec 2012
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Diexaint is an unknown quantity at this point
Quote:
Originally Posted by felgall View Post
Sounds like someone has put off doing something that was expected to take weeks if not months for them to do and now is complaining because they don't have the time to do it with only hours before it is due.

This is certainly NOT the way to proceed with programming courses. You need to tackle programming assignments IMMEDIATELY when they are first given as the number of times you may need to ask your teacher or on a forum such as this one for assistance in understanding the small pieces of the assignment may take a lot longer than you might expect. Particularly if you are one of the majority who doesn't really have an aptitude for programming.

If you have a month to do the project and you have been asking for help with numerous different problems for four weeks and the assignment is due tomorrow then there is a slight possibility that someone might take pity on you and tell you how to fix it.

The other alternative is to offer to pay someone to do it for you and then they will write something way too advanced compared to what the teacher expects making it obvious that you have cheated and you end up failing anyway. Only by doing most of the work yourself will you end up with a result that works as an answer to the course because unless the person doing the work has actually done the course then their way of coding is likely to be very different from what the course is teaching. Since most JavaScript courses are taught by people with almost no exposure to JavaScript themselves beyond that of their ten your old (obsolete) textbook the script someone who knows JavaScript would write to solve the problem would possibly not even be recognisable as JavaScript to the teacher.

So even if you could pay someone to write the script for you it wouldn't help you pass the course.
Thing is, this was given to her and her classmates today. Or maybe yesterday in other countries.
Diexaint is offline   Reply With Quote
Old 12-20-2012, 07:55 AM   PM User | #6
Philip M
Supreme Master coder!

 
Philip M's Avatar
 
Join Date: Jun 2002
Location: London, England
Posts: 17,044
Thanks: 197
Thanked 2,412 Times in 2,390 Posts
Philip M has a spectacular aura aboutPhilip M has a spectacular aura aboutPhilip M has a spectacular aura about
Your code barely starts to address the assignment as set.

alert() and prompt() are obsolete, except perhaps for debugging. So is <script language=JavaScript>

What is "Create a JavaScript program that will display an array of integers no less than 55 by 3’s" supposed to mean???? Surely no more than 55??

It is not really in your best interests that others do your all or most homework for you. Your teacher may gain a false and exaggerated idea of your programming capabilities and so not offer you the support you need. Also, if you hand in other people's work which you do not completely understand, then you will start to fall behind and your difficulties will increase.
__________________

All the code given in this post has been tested and is intended to address the question asked.
Unless stated otherwise it is not just a demonstration.
Philip M is online now   Reply With Quote
Old 12-20-2012, 06:39 PM   PM User | #7
felgall
Master Coder

 
felgall's Avatar
 
Join Date: Sep 2005
Location: Sydney, Australia
Posts: 5,465
Thanks: 0
Thanked 499 Times in 491 Posts
felgall is a jewel in the roughfelgall is a jewel in the roughfelgall is a jewel in the rough
Quote:
Originally Posted by Diexaint View Post
Sorry, I didn't have time to read the rules. I tried to work on it after searching about this stuff on the net a bit. I'm not really sure if I'm doing this right.
Very little of it is even close

<script language=JavaScript> <-- obsolete usage

avgPrelims= parseFloat(a)*.30; <-- use Number() instead of parseFloat for converting to numbers

window.alert(); <-- reference to window unnecessary ands alert is only for debugging

var a = window.prompt(); <-- prompt is also only for debugging

So there is not much meaningful JavaScript there.

You need a form to collect the input and should use innerHTML to output the result into the web page. Also make sure you place your JavaScript immediately before the </body> tag so that the HTML can load before any scripts run.
__________________
Stephen
Learn Modern JavaScript - http://javascriptexample.net/
Helping others to solve their computer problem at http://www.felgall.com/
felgall is offline   Reply With Quote
Old 12-20-2012, 08:14 PM   PM User | #8
Philip M
Supreme Master coder!

 
Philip M's Avatar
 
Join Date: Jun 2002
Location: London, England
Posts: 17,044
Thanks: 197
Thanked 2,412 Times in 2,390 Posts
Philip M has a spectacular aura aboutPhilip M has a spectacular aura aboutPhilip M has a spectacular aura about
Quote:
Originally Posted by felgall View Post
avgPrelims= parseFloat(a)*.30; <-- use Number() instead of parseFloat for converting to numbers
Both parseFloat() and Number() are redundant here as * results in automatic type conversion.
__________________

All the code given in this post has been tested and is intended to address the question asked.
Unless stated otherwise it is not just a demonstration.
Philip M is online now   Reply With Quote
Old 12-20-2012, 09:13 PM   PM User | #9
felgall
Master Coder

 
felgall's Avatar
 
Join Date: Sep 2005
Location: Sydney, Australia
Posts: 5,465
Thanks: 0
Thanked 499 Times in 491 Posts
felgall is a jewel in the roughfelgall is a jewel in the roughfelgall is a jewel in the rough
Quote:
Originally Posted by Philip M View Post
Both parseFloat() and Number() are redundant here as * results in automatic type conversion.
I agree that in that particular instance the value would be automatically converted to a number. My comment was intended in more general terms that where a conversion to a number is required then Number() is the function to call rather than parseFloat() .
__________________
Stephen
Learn Modern JavaScript - http://javascriptexample.net/
Helping others to solve their computer problem at http://www.felgall.com/
felgall is offline   Reply With Quote
Old 12-20-2012, 09:28 PM   PM User | #10
Old Pedant
Supreme Master coder!

 
Old Pedant's Avatar
 
Join Date: Feb 2009
Posts: 23,248
Thanks: 59
Thanked 3,998 Times in 3,967 Posts
Old Pedant is a name known to allOld Pedant is a name known to allOld Pedant is a name known to allOld Pedant is a name known to allOld Pedant is a name known to allOld Pedant is a name known to all
The 55 * 3 refers to, I think, the fact that the instructor wants to see those 3 grades (prelim, midterm, final) for *AT LEAST* 55 different students.

It would be impractical to prompt for 165 different numbers. How would you keep track of it all?

I think it would even be impractical to create an HTML <form> that allows inputting all that data.

I *SUSPECT* that the instructor simply wants you to create HTML with all the information and then just use JavaScript to do the calculations.

Read this part of the assignment:
Your program should display the result of the GRADE of a student including his/her Name, Student Number and Subject Code and Subject Description. For the additional information, the program must give a remark whether the student passed or failed the subject base on the Final Academic Year result.

Are you going to prompt( ) for all *THAT* information for each student? Of course not!

So start by creating the HTML.

Something like this, with the student info repeated 55 times:
Code:
<table>
<tr>
    <th>Student</th>
    <th>ID</th>
    <th>Code</th>
    <th>Description</th>
    <th>Prelim</th>
    <th>Midterm</th>
    <th>Final</th>
    <th>GRADE</th>
    <th>Passed?</th>
</tr>
<tr>
    <td>Adam Abel</td>
    <td>10111</td>
    <td>COMP101</td>
    <td>Introduction to Programming</td>
    <td>78%</td>
    <td>82%</td>
    <td>87%</td>
    <td>[grade to be computed by JS]</td>
    <td>[PASS/FAIL to be computed by JS]</td>
</tr>
... another 54 students ...
</table>
__________________
An optimist sees the glass as half full.
A pessimist sees the glass as half empty.
A realist drinks it no matter how much there is.
Old Pedant is offline   Reply With Quote
Old 12-21-2012, 07:57 AM   PM User | #11
Philip M
Supreme Master coder!

 
Philip M's Avatar
 
Join Date: Jun 2002
Location: London, England
Posts: 17,044
Thanks: 197
Thanked 2,412 Times in 2,390 Posts
Philip M has a spectacular aura aboutPhilip M has a spectacular aura aboutPhilip M has a spectacular aura about
Quote:
Originally Posted by Old Pedant View Post
The 55 * 3 refers to, I think, the fact that the instructor wants to see those 3 grades (prelim, midterm, final) for *AT LEAST* 55 different students.
What on earth would be the point of that? Why 55 students? Why not 37 or 63? Surely half a dozen would be enough for the purposes of the programming exercise.

The assignment is "Create a JavaScript program that will display an array of integers no less than 55 by 3’s."
__________________

All the code given in this post has been tested and is intended to address the question asked.
Unless stated otherwise it is not just a demonstration.

Last edited by Philip M; 12-21-2012 at 08:28 AM..
Philip M is online now   Reply With Quote
Old 12-21-2012, 08:03 PM   PM User | #12
Old Pedant
Supreme Master coder!

 
Old Pedant's Avatar
 
Join Date: Feb 2009
Posts: 23,248
Thanks: 59
Thanked 3,998 Times in 3,967 Posts
Old Pedant is a name known to allOld Pedant is a name known to allOld Pedant is a name known to allOld Pedant is a name known to allOld Pedant is a name known to allOld Pedant is a name known to all
Yes, and what other integers would you find in a gradebook that is supposed to contain prelim, midterm, and final scores? Looks to me like those are the 3 integers. So what can the "55 by" mean other than 55 students?

I do agree that for the purpose of the exercise it would prove the concept if there were as few as 2 or 3 students. But I didn't write "55 by 3" part.

Or do you think that the "55 by 3" is a separate assignment from the grading one? It could well be. Certainly not explained well in the instructions.

Ah, well. I think it's a moot point. I don't think Diexaint will be back.
__________________
An optimist sees the glass as half full.
A pessimist sees the glass as half empty.
A realist drinks it no matter how much there is.
Old Pedant is offline   Reply With Quote
Old 12-22-2012, 09:52 AM   PM User | #13
Philip M
Supreme Master coder!

 
Philip M's Avatar
 
Join Date: Jun 2002
Location: London, England
Posts: 17,044
Thanks: 197
Thanked 2,412 Times in 2,390 Posts
Philip M has a spectacular aura aboutPhilip M has a spectacular aura aboutPhilip M has a spectacular aura about
Quote:
Originally Posted by Old Pedant View Post
Or do you think that the "55 by 3" is a separate assignment from the grading one? It could well be. Certainly not explained well in the instructions.

That was my understanding. But it is shameful that students are supposed to interpret the supposed meaning of such ambiguous and poorly-written assignments. Another possibility is that 55 is a typo for 5.
__________________

All the code given in this post has been tested and is intended to address the question asked.
Unless stated otherwise it is not just a demonstration.
Philip M is online now   Reply With Quote
Reply

Bookmarks

Tags
code, coding, java, javascript, request

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 07:54 AM.


Advertisement
Log in to turn off these ads.