Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 3

Nishat Tasmia

ID-1720540

Problem 1.

function show_grade() {

var name = document.getElementById("studentname").value;

var total_mark = parseInt(document.getElementById("totalmark").value);

var grade;

if (total_mark >= 90) {

grade = "A";

} else if (total_mark >= 85 && total_mark < 90) {

grade = "A-";

} else if (total_mark >= 80 && total_mark < 85) {

grade = "B+";

} else if (total_mark >= 75 && total_mark < 80) {

grade = "B";

} else if (total_mark >= 70 && total_mark < 75) {

grade = "B-";

} else if (total_mark >= 65 && total_mark < 70) {

grade = "C+"

} else if (total_mark >= 60 && total_mark < 65) {

grade = "C";

} else if (total_mark >= 55 && total_mark < 60) {

grade = "C-";

} else if (total_mark >= 50 && total_mark < 55) {

grade = "D+";

} else if (total_mark >= 45 && total_mark < 50) {

grade = "D";

} else {

grade = "F";

}
document.getElementById("result").innerText = "Name: " + name + " " + "Grade: " + grade;

Problem 2.

function show_discount_amount() {

var name = document.getElementById("studentname").value;

var cgpa = parseInt(document.getElementById("studentcgpa").value);

var credits_completed = parseFloat(document.getElementById("creditcompleted").value);

var discounted_amount;

if (cgpa > 3.5 && credits_completed > 50) {

discounted_amount = credits_completed * 200;

} else if (cgpa > 3.2 && credits_completed > 40) {

discounted_amount = credits_completed * 150;

} else if (cgpa > 3 && credits_completed > 25) {

discounted_amount = credits_completed * 100;

} else {

discounted_amount = 0;

document.getElementById("discount").innerText = "Name: " + name + " " + "CGPA: " + cgpa + " " +
"Discount: " + discounted_amount + " taka.";

Problem 3.

function show_tuition_fee() {

var total_courses = parseInt(document.getElementById("studentcgpa").value);

var tuition_fees_per_course = parseInt(document.getElementById("creditcompleted").value);


var total_fees = total_courses * tuition_fees_per_course;

var total_payable_fees;

if (total_fees > 60000 || total_courses > 5) {

total_payable_fees = ((total_fees / 100) * 80) + 1000;

} else if (total_fees > 50000 || total_courses > 4) {

total_payable_fees = ((total_fees / 100) * 85) + 2000;

} else if (total_fees > 40000 || total_courses > 3) {

total_payable_fees = ((total_fees / 100) * 90) + 3000;

} else {

total_payable_fees = ((total_fees / 100) * 95) + 4000;

document.getElementById("tuitionfee").innerText = "Total payable tuition fees amount: " +


total_payable_fees + " " + " taka.";

You might also like