Skip to content

Commit 2f0f283

Browse files
2 parents d1a7dd4 + ee9d5c3 commit 2f0f283

4 files changed

Lines changed: 215 additions & 25 deletions

File tree

‎Students/Nishan/loop.js‎

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
//print 9 to 0
2+
for(let i=9;i>=0;i--){
3+
console.log(i);
4+
}
5+
6+
// const arr =["superman","batman","wonderwomen","flash","greenlanton"]
7+
// reverse the array
8+
const arr =["superman","batman","wonderwomen","flash","greenlanton"]
9+
const reversedArr = [];
10+
for(let i=arr.length-1;i>=0;i--){
11+
reversedArr.push(arr[i]);
12+
}
13+
console.log(reversedArr);
14+
15+
// only run true login using also continue
16+
const letslearnUsersArray=[{
17+
name:"saugat Bagale",
18+
age:23,
19+
isLogin:true
20+
},{
21+
name:"Nishant",
22+
age:24,
23+
isLogin:false
24+
},
25+
{
26+
name:"Aakriti",
27+
age:22,
28+
isLogin:true
29+
},
30+
{
31+
name:"subin",
32+
age:19,
33+
isLogin:false
34+
},
35+
{
36+
name:"kamala",
37+
age:19,
38+
isLogin:true
39+
},
40+
{
41+
name:"suman",
42+
age:19,
43+
isLogin:false
44+
}
45+
]
46+
for(let i=0;i<letslearnUsersArray.length;i++){
47+
if(letslearnUsersArray[i].isLogin===false){
48+
continue;
49+
}
50+
console.log(letslearnUsersArray[i].name);
51+
}
52+

‎Students/Nishan/task3.js‎

Lines changed: 81 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,81 @@
1+
/* Create a system that processes student data, calculates grades, filters results, and generates reports. It should handle real-world logic like grade calculations, filtering by criteria, and data transformations.
2+
3+
What to Build:
4+
An array of student objects, where each student has: name, marks (array of subject scores), attendance percentage
5+
Functions that:
6+
Calculate average marks and assign grades (A/B/C/D based on ranges)
7+
Filter students by criteria (e.g., "show only students with > 75 average")
8+
Find top performer and lowest scorer
9+
Check eligibility (average > 40 AND attendance > 75%)
10+
Loops to iterate through data and transform it
11+
Conditionals to apply grading rules (use switch for grade assignment or if/else for eligibility)
12+
Generate a summary report showing: total students, pass count, fail count, average class score
13+
How to Approach It:
14+
Start with data structure — Create realistic student objects with nested arrays (marks per subject)
15+
Build utility functions — Each function should do ONE thing (calculate average, assign grade, filter students)
16+
Use loops strategically — .map() mindset (though not required): transform data from one form to another
17+
Apply game logic — Use conditionals creatively (e.g., bonus points if attendance > 90%)
18+
Combine everything — Chain functions and loops to build the final report
19+
Challenge Twist (Optional):
20+
Add a pass/fail rule: If marks < 40, fail regardless of attendance
21+
Add a merit scholarship checker: Show students eligible for scholarship (average > 80 AND attendance 100)
22+
Export data to a formatted string report using template literals
23+
This project forces them to design with objects, organize logic with functions, and process data with loops — all core pillars.
24+
*/
25+
// Sample student data
26+
const students = [
27+
{ name: "Ram", marks: [85, 90, 78], attendance: 92 },
28+
{ name: "Shyam", marks: [70, 75, 80], attendance: 85 },
29+
{ name: "Hari", marks: [60, 65, 58], attendance: 80 },
30+
{ name: "Gita", marks: [30, 35, 28], attendance: 70 },
31+
{ name: "Sita", marks: [95, 98, 92], attendance: 100 }
32+
];
33+
34+
// Function to calculate average marks and assign grades
35+
function calculateGrade(student) {
36+
const average = student.marks.reduce((sum, mark) => sum + mark, 0) / student.marks.length;
37+
let grade;
38+
if (average >= 90) {
39+
grade = 'A';
40+
} else if (average >= 80) {
41+
grade = 'B';
42+
}
43+
else if (average >= 70) {
44+
grade = 'C';
45+
} else if (average >= 40) {
46+
grade = 'D';
47+
}
48+
else {
49+
grade = 'F';
50+
}
51+
return { ...student, average, grade };
52+
}
53+
54+
// Process students to calculate grades
55+
const processedStudents = students.map(calculateGrade);
56+
57+
// Filter students with average > 75
58+
const topStudents = processedStudents.filter(student => student.average > 75);
59+
console.log("Top Students:", topStudents);
60+
61+
// Find top performer and lowest scorer
62+
const topPerformer = processedStudents.reduce((top, student) => student.average > top.average ? student : top, processedStudents[0]);
63+
const lowestScorer = processedStudents.reduce((low, student) => student.average < low.average ? student : low, processedStudents[0]);
64+
console.log("Top Performer:", topPerformer);
65+
console.log("Lowest Scorer:", lowestScorer);
66+
67+
// Check eligibility
68+
const eligibleStudents = processedStudents.filter(student => student.average > 40 && student.attendance > 75);
69+
console.log("Eligible Students:", eligibleStudents);
70+
71+
// Generate summary report
72+
const totalStudents = processedStudents.length;
73+
const passCount = processedStudents.filter(student => student.grade !== 'F').length;
74+
const failCount = totalStudents - passCount;
75+
const averageClassScore = processedStudents.reduce((sum, student) => sum + student.average, 0) / totalStudents;
76+
console.log("Summary Report:");
77+
console.log("- Total Students:", totalStudents);
78+
console.log("- Pass Count:", passCount);
79+
console.log("- Fail Count:", failCount);
80+
console.log("- Average Class Score:", averageClassScore.toFixed(2));
81+

‎Students/kamala/task3.js‎

Lines changed: 40 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,41 @@
1+
// for (let index = 0; index< 9; index++){
2+
// console.log(index)
3+
// }
4+
// const arrr=[]
5+
// for (let i=0; i<10; i++){
6+
// arrr.push(i)
7+
// }
8+
// // console.log(arrr)
9+
// // const arrr=[]
10+
// // for (let i=0; i<10; i++){
11+
// // arrr.push(i)
12+
// // }
13+
// // console.log(arrr)
114

2-
const num1 = 5;
3-
const num2 = new Number(5);
4-
console.log(num1,num2);
5-
console.log(num1+num2);
6-
7-
const num3 = 123.456789;
8-
console.log(typeof num1);
9-
console.log(num3.toPrecision(6)); // will give 6 significant digits meaning 123.456789 will become 123.457
10-
console.log(num3.toFixed(3)); // will give 3 digits after decimal point meaning 123.456789 will become 123.46
11-
// console.log(num3.valueOf()); // will give the primitive value of the number object meaning 123.456789 will become 123.456789
12-
console.log(Math.min(1,2,4,5))
13-
console.log(Math.max(1,2,4,5))
14-
console.log(Math.abs(-4))
15-
console.log(Math.round(4.5))//ans will be 5 because .5 and above round u
16-
console.log(Math.ceil(4.01)) // ans will be 5 because ceil means round up
17-
console.log(Math.floor(4.99999999)) // ans will be 4 because floor means round down
18-
console.log(Math.round(Math.random()*10)) //random number between 0 to 1 but not including 1
19-
// 0-1
20-
// 0.13453*10=1.3453
21-
// 0.99999*10=9.9999
22-
// round 1.5 => 2
23-
// round 9.9999 => 10
24-
// floor 9.9999 => 9
25-
26-
15+
// const arr= ["superman", "batman", "wonderwomen","flash"]
16+
// for(let i=arr/length-1;i>=0;i++){
17+
// console.log(arr[i])
18+
// }
19+
const array=[{
20+
name:"Shyam",
21+
age:23,
22+
isLogin:true
23+
},{
24+
name:"Sita",
25+
age:24,
26+
isLogin:false
27+
},
28+
{
29+
name:"Rita",
30+
age:22,
31+
isLogin:true
32+
},
33+
{
34+
name:"kamala",
35+
age:19,
36+
isLogin:false
37+
}
38+
]
39+
for(let i=0; i<array.length;i++){
40+
console.log(array[i].name)
41+
}

‎Students/kamala/task4.js‎

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
const letslearnUsersArray = [
2+
{
3+
name:"saugat Bagale",
4+
age:23,
5+
isLogin:true
6+
},
7+
{
8+
name:"Nishant",
9+
age:24,
10+
isLogin:false
11+
},
12+
{
13+
name:"Aakriti",
14+
age:22,
15+
isLogin:true
16+
},
17+
{
18+
name:"subin",
19+
age:19,
20+
isLogin:false
21+
},
22+
{
23+
name:"kamala",
24+
age:19,
25+
isLogin:true
26+
},
27+
{
28+
name:"suman",
29+
age:19,
30+
isLogin:false
31+
}
32+
];
33+
34+
let result = [];
35+
36+
for (let i = 0; i < letslearnUsersArray.length; i++) {
37+
if (letslearnUsersArray[i].isLogin === true) {
38+
result.push(letslearnUsersArray[i].name);
39+
}
40+
}
41+
42+
console.log(result);

0 commit comments

Comments
 (0)