var message = ""
var end = false
while (end == false)
{
var name
name = prompt("What is the students name?")
var midTerm
midTerm = parseInt(prompt("What was the students midterm grade out of 50?"))
var midTermPercent
midTermPercent = midTerm / 50 * 100
var final
final = parseInt(prompt("What was the student's final Grade out of 100?"))
var homework
homework = parseInt(prompt("What was the student's homework grade out of 100?"))
var attendance
attendance = parseInt(prompt("What was the student's attendance score out of 50?"))
var attendancePercent
attendancePercent = attendance / 50 * 100
var overall
overall = midTerm + final + homework + attendance
var percent
percent = (overall / 3)
var grade
if (percent > 93)
{
grade = "A"
}
if ((percent < 92.99) && (percent > 85))
{
grade = "B"
}
if ((percent < 84.99) && (percent > 79))
{
grade = "C"
}
if ((percent < 78.99) && (percent > 72))
{
grade = "D"
}
if (percent < 71.99)
{
grade = "F"
}
var again
again = prompt("Do you wish to enter another Student? Y or N?")
if (again == "N")
{
end = true
}
if (again == "Y")
{
end = false
}
message = message + "\n" + "\nName: " + name + "\nMidterm: " + midTerm + "/50" + "\nfinal: " + final + "/100" + "\nHomework: " + homework + "/100" + "\nAttendance: " + attendance + "/50" + "\nOverall: " + overall + "/300" + "\nPercent: " + percent.toFixed(2) + "%" + "\nGrade: " + grade
}
alert(message)
Please Whitelist JSFiddle in your content blocker.
Help keep JSFiddle free for always by one of two ways:
Whitelist JSFiddle in your content blocker (two clicks)
Go PRO and get access to additional PRO features →
Join the 4+ million users, and keep the JSFiddle dream alive.
Ad-free
All ads in the editor and listing pages are turned completely off.
Use pre-released features
You get to try and use features (like the Palette Color Generator) months before everyone else.
Fiddle collections
Sort and categorize your Fiddles into multiple collections.
Private collections and fiddles
You can make as many Private Fiddles, and Private Collections as you wish!
Console
Debug your Fiddle with a minimal built-in JavaScript console.