•
•
•
•
What is DaniWeb IT Discussion Community?
You're currently browsing the JavaScript / DHTML / AJAX section within the Web Development category of DaniWeb, a massive community of 397,775 software developers, web developers, Internet marketers, and tech gurus who are all enthusiastic about making contacts, networking, and learning from each other. In fact, there are 2,487 IT professionals currently interacting right now! Registration is free, only takes a minute and lets you enjoy all of the interactive features of the site.
Please support our JavaScript / DHTML / AJAX advertiser: Lunarpages Web Hosting
Views: 1004 | Replies: 1
![]() |
•
•
Join Date: Oct 2006
Posts: 2
Reputation:
Rep Power: 0
Solved Threads: 0
Hello Everyone, I am having quite a problem with a program I am trying to get working. I am trying to make a marks tracking program using an array that has an array of strings 3 elements long called Names.
Has a 2D array of integers 3 * 2 elements in size called Marks.
Has an array of floating point numbers 3 elements called Averages.
Prompt the user for 3 student names. Store the values in the Names array.
For each student: Prompt the user for marks in 2 classes: Math and Chemistry.
Calculate the average mark for each student. Store the averages in the Averages array.
print all student names, marks and averages on the screen. Here is what I have already..
<script type="text/javascript">
var Names = new Array();
var Marks = new Array();
var Averages = new Array();
Names[0] = "Matt";
Names[1] = "Tom";
Names[2] = "Kelly";
Marks[0][1] =
Marks[0][2] =
Marks[1][1] =
Marks[1][2] =
Marks[2][1] =
Marks[2][2] =
Averages[0] =
Averages[1] =
Averages[2] =
Names = prompt("Enter The First Students Name (Matt, Tom or Kelly)");
Marks = prompt("Enter The Math Mark for " + Names)
prompt("Enter The Chemistry Mark for " + Names)
</script>
I am completely stumped so any help at all would be awesome.
Has a 2D array of integers 3 * 2 elements in size called Marks.
Has an array of floating point numbers 3 elements called Averages.
Prompt the user for 3 student names. Store the values in the Names array.
For each student: Prompt the user for marks in 2 classes: Math and Chemistry.
Calculate the average mark for each student. Store the averages in the Averages array.
print all student names, marks and averages on the screen. Here is what I have already..
<script type="text/javascript">
var Names = new Array();
var Marks = new Array();
var Averages = new Array();
Names[0] = "Matt";
Names[1] = "Tom";
Names[2] = "Kelly";
Marks[0][1] =
Marks[0][2] =
Marks[1][1] =
Marks[1][2] =
Marks[2][1] =
Marks[2][2] =
Averages[0] =
Averages[1] =
Averages[2] =
Names = prompt("Enter The First Students Name (Matt, Tom or Kelly)");
Marks = prompt("Enter The Math Mark for " + Names)
prompt("Enter The Chemistry Mark for " + Names)
</script>
I am completely stumped so any help at all would be awesome.
The problem is that your array
Is actually a two dimensional array of characters...so
Names[0][0] = 'M'
Names[0][1] = 'A'
etc.
You will need to use something like this...
Names[0] "Matt"
Is actually a two dimensional array of characters...so
Names[0][0] = 'M'
Names[0][1] = 'A'
etc.
You will need to use something like this...
tmenu[3] = [["Departments", "#", "dropdown"]]; smenu[3] = new Array(); fmenu[3] = new Array(); smenu[3][1] = [["Administration", "#", "noFlyout"]]; smenu[3][2] = [["Human Resources", "#", "flyout"]]; fmenu[3][2] = new Array(); fmenu[3][2][1] = [["Home Page", "#"]]; fmenu[3][2][2] = [["Employment Opportunities", "#"]]; fmenu[3][2][3] = [["Teach in Iowa", "#"]]; fmenu[3][2][4] = [["Info for Teacher Candidates", "#"]]; fmenu[3][2][5] = [["Master Contract", "#"]]; fmenu[3][2][6] = [["Iowa Teaching Standards", "#"]]; fmenu[3][2][7] = [["Non-Discrimination Policy", "#"]]; smenu[3][3] = [["School Improvement", "#", "noFlyout"]]; smenu[3][4] = [["Financial Information", "#", "noFlyout"]]; smenu[3][5] = [["Facilities", "#", "noFlyout"]]; smenu[3][6] = [["Food Service", "#", "flyout"]]; fmenu[3][6] = new Array(); fmenu[3][6][1] = [["Home Page", "#"]]; fmenu[3][6][2] = [["Account Balances", "#"]]; smenu[3][7] = [["Child Care", "#", "noFlyout"]]; smenu[3][8] = [["Transportation", "#", "noFlyout"]]; smenu[3][9] = [["Adult Education", "#", "noFlyout"]];
![]() |
•
•
•
•
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
•
•
•
•
•
•
•
•
DaniWeb JavaScript / DHTML / AJAX Marketplace
- Javascript links not working (Web Browsers)
- JavaScript's window.opener (JavaScript / DHTML / AJAX)
- recommendations for JavaScript learning resources? (JavaScript / DHTML / AJAX)
- Javascript/HTML problem!!! (JavaScript / DHTML / AJAX)
- Javascript Useful? (IT Careers and Business)
Other Threads in the JavaScript / DHTML / AJAX Forum
- Previous Thread: Automatically populate text box with browser info...
- Next Thread: Multiple COmbo Box


Linear Mode