Skip to content

Commit 65b4e64

Browse files
Merge pull request MontessoriVisualization#25 from Aakriti582/main
resolved merge conflicts
2 parents 6fc4aa2 + a4088dc commit 65b4e64

5 files changed

Lines changed: 278 additions & 41 deletions

File tree

‎.github/workflows/node.js.yml‎

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
# This workflow will do a clean installation of node dependencies, cache/restore them, build the source code and run tests across different versions of node
2+
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-nodejs
3+
4+
name: Node.js CI
5+
6+
on:
7+
push:
8+
branches: [ "main" ]
9+
pull_request:
10+
branches: [ "main" ]
11+
12+
jobs:
13+
build:
14+
15+
runs-on: ubuntu-latest
16+
17+
strategy:
18+
matrix:
19+
node-version: [18.x, 20.x, 22.x]
20+
# See supported Node.js release schedule at https://nodejs.org/en/about/releases/
21+
22+
steps:
23+
- uses: actions/checkout@v4
24+
- name: Use Node.js ${{ matrix.node-version }}
25+
uses: actions/setup-node@v4
26+
with:
27+
node-version: ${{ matrix.node-version }}
28+
cache: 'npm'
29+
- run: npm ci
30+
- run: npm run build --if-present
31+
- run: npm test

‎.vscode/launch.json‎

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
{
2+
// Use IntelliSense to learn about possible attributes.
3+
// Hover to view descriptions of existing attributes.
4+
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
5+
"version": "0.2.0",
6+
"configurations": [
7+
{
8+
"address": "TCP/IP address of process to be debugged",
9+
"localRoot": "${workspaceFolder}",
10+
"name": "Attach to Remote",
11+
"port": 9229,
12+
"remoteRoot": "Absolute path to the remote directory containing the program",
13+
"request": "attach",
14+
"skipFiles": [
15+
"<node_internals>/**"
16+
],
17+
"type": "node"
18+
},
19+
{
20+
"type": "chrome",
21+
"request": "launch",
22+
"name": "Launch Chrome against localhost",
23+
"url": "http://localhost:8080",
24+
"webRoot": "${workspaceFolder}"
25+
}
26+
]
27+
}

‎Students/Aakriti/task2.js‎

Lines changed: 20 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,9 +26,25 @@ let p1=createProduct("Laptop",1200,10)
2626
let p2=createProduct("Mouse",25,50)
2727
let p3=createProduct("Keyboard",100,20)
2828

29-
inventory=[p1,p2,p3]//all data was overridden by `p3
29+
// inventory=[{...p1,...p2,...p3}]//all data was overridden by `p3`
30+
// console.log(inventory)
31+
inventory=[
32+
{name:"Laptop",
33+
price:1200,
34+
quantity:10
35+
},
36+
{name:"Mouse",
37+
price:25,
38+
quantity:50
39+
},
40+
{name:"Keyboard",
41+
price:100,
42+
quantity:20
43+
}
3044

31-
// Updating Data (Accessing Constraints)
45+
]
46+
console.log(inventory)
47+
// Updating Data (Accessing Constraints):
3248

3349
// Oh no! The "Mouse" price was wrong. Access the second item in your inventory array and update its price to 30.
3450
// Access the "Laptop" (first item) and add a new property category with the value "Electronics".
@@ -48,7 +64,7 @@ const extraDetails={
4864
color:"Silver"
4965
}
5066

51-
let updatedLaptop={...inventory[0],...extraDetails}
67+
let updatedLaptop = { ...inventory[0], ...extraDetails };
5268
console.log(updatedLaptop)
5369

5470
// The Sale Function (Arrow Functions):
@@ -72,6 +88,7 @@ console.log("The total value of Keyboard is",totalValOfKeyboard)
7288
// Write an if statement: If adminUser.permissions.canEdit is true, console log "Access Granted: Inventory updated."
7389
// Why this works:
7490
// Functions: They practice passing arguments (name, price) effectively.
91+
7592
// Objects: They learn to store grouped data instead of just single variables.
7693
// Spread: Real-world use case (adding extra specs to a product).
7794
// Nested Access: Reviewing how to dig into data (user.permissions.canEdit).

‎Students/Aakriti/task3.js‎

Lines changed: 172 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,175 @@
1-
//check whether a person is elligible to vote or not
2-
//should be 18 plus and should havea citizenship to cast vote
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.
32

4-
const age=24
5-
const citizenshipNum=23456
6-
if (age>=18){
7-
if(Boolean(citizenshipNum)){
8-
console.log("You are elligible to cast vote...")
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+
let students=[
26+
{name:"Aakriti",marks:[90,60,70,30],attendance:69},
27+
{name:"Monika",marks:[20,40,20,47],attendance:29},
28+
{name:"Hangma",marks:[20,60,90,47],attendance:89},
29+
{name:"Hari",marks:[80,69,97,90],attendance:30},
30+
{name:"Gita",marks:[80,39,17,90],attendance:70},
31+
{name:"Subash",marks:[80,99,97,90],attendance:100},
32+
{name:"Sita",marks:[20,60,20,47],attendance:85},
33+
{name:"Shree",marks:[90,70,90,89],attendance:25}
34+
35+
]
36+
console.log(students)
37+
38+
function calcAvg(stu){
39+
40+
let totalMarks=0;
41+
for(j=0; j<stu.marks.length;j++){
42+
totalMarks+=stu.marks[j]
43+
}
44+
return totalMarks/stu.marks.length;
45+
}
46+
47+
let avgmarks=[];
48+
for(let i=0; i<students.length;i++){
49+
avgmarks.push(calcAvg(students[i]))
50+
}
51+
console.log("The average marks of each student",avgmarks)
52+
53+
let grade=[];
54+
for(let i=0; i<avgmarks.length;i++){
55+
56+
if (avgmarks[i]>=80 && avgmarks[i]<=100){
57+
grade.push("A")
58+
}
59+
else if(avgmarks[i]<=80 && avgmarks[i]>=60){
60+
grade.push("B")
61+
}
62+
else if(avgmarks[i]<=60 && avgmarks[i]>=40){
63+
grade.push("C")
64+
}
65+
else{
66+
grade.push("F")
67+
}
68+
}
69+
console.log("The grade of each student",grade)
70+
71+
72+
73+
//updating students profile
74+
for(let i=0; i<students.length;i++){
75+
students[i].Average_Marks=avgmarks[i]
76+
students[i].Grade=grade[i]
77+
78+
}
79+
console.log("Updated Students Profile with grade and avgmarks:",students)
80+
81+
//students with > 75 average
82+
for (let i=0; i<students.length;i++){
83+
if(students[i].Average_Marks>75){
84+
console.log(students[i].name)//with meassage
85+
}
86+
}
87+
//top performer
88+
let topPerformer=avgmarks[0]
89+
for (let i=0; i<avgmarks.length;i++){
90+
if(avgmarks[i]>topPerformer){
91+
topPerformer=avgmarks[i]
92+
93+
}
94+
95+
}
96+
// console.log(`${students[i].name} is a top performer with average marks: ${students[i].Average_Marks}`)
97+
console.log(`The top performer is : ${topPerformer}`)
98+
99+
//low scorer
100+
let lowScorer=avgmarks[0]
101+
for(let i=0; i<avgmarks.length;i++){
102+
if(avgmarks[i]<lowScorer){
103+
lowScorer=avgmarks[i]
104+
}
105+
}
106+
console.log(`The loe Scorer is : ${lowScorer}`)
107+
108+
// Check eligibility (average > 40 AND attendance > 75%)
109+
let eligibility=[]
110+
for(let i=0; i<avgmarks.length;i++){
111+
if(students[i].Average_Marks>40 && students[i].attendance >75){
112+
eligibility.push("PASS")
113+
}
114+
else{
115+
eligibility.push("FAIL")
9116
}
10117
}
11-
else{
12-
console.log("you are not allowed to vote!!!")
13-
}
118+
console.log("The pass/fail eligibilty of each student; ",eligibility)
119+
120+
//again updating with results
121+
for(let i=0; i<students.length;i++){
122+
students[i].Result=eligibility[i]
123+
124+
}
125+
console.log("Updated Students Profile with grade and avgmarks:",students)
126+
127+
128+
//pass count
129+
let pcount=0;
130+
for(let i=0;i<eligibility.length;i++){
131+
132+
if(eligibility[i]==="PASS"){
133+
pcount+=1
134+
}
135+
}
136+
console.log("The pass count in letslearn is: ",pcount)
137+
138+
//fail count
139+
let fcount=0;
140+
for(let i=0;i<eligibility.length;i++){
141+
142+
if(eligibility[i]==="PASS"){
143+
continue;
144+
}
145+
else{
146+
fcount+=1
147+
}
148+
}
149+
console.log("The fail count in letslearn is: ",fcount)
150+
//average class score
151+
function classScore(){
152+
let avgClassScore=0;
153+
for(let i=0; i<avgmarks.length;i++){
154+
avgClassScore+=avgmarks[i]
155+
}
156+
return avgClassScore/students.length
157+
}
158+
159+
console.log("The average score of class is : ",classScore(avgmarks))
160+
161+
// summary report showing: total students, pass count, fail count, average class score
162+
console.log("==============CLASS REPORT OF LETSLEARN=============")
163+
console.log(`\nThe total students in Letslearn is : ${students.length}\nPass count of lets learn : ${pcount} \nFail count of letslearn : ${fcount}\nAverage class score of letslearn is : ${classScore(avgmarks)}`)
164+
console.log("====================================================")
165+
166+
// Add a merit scholarship checker: Show students eligible for scholarship (average > 80 AND attendance 100)
167+
// function merit(){
168+
// for(let i=0; i<students.length;i++){
169+
// if(students[i].attendance===100 && students[i].avgmarks>80){
170+
171+
// }
172+
// return students[i].name
173+
// }
174+
// }
175+
// console.log(merit())

‎getStarted/js/shortingalgo.js‎

Lines changed: 28 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -45,40 +45,40 @@ for(let i=0;i<students.length;i++){
4545

4646
}
4747
console.log(avgmarks)
48-
let highestMark = avgmarks[0]
49-
for(let i=0;i<avgmarks.length;i++){
50-
if(avgmarks[i]>highestMark){
51-
highestMark = avgmarks[i]
52-
}
53-
}
54-
console.log("Highest Mark:", highestMark)
55-
let lowestMark = avgmarks[0]
48+
// let highestMark = avgmarks[0]
49+
// for(let i=0;i<avgmarks.length;i++){
50+
// if(avgmarks[i]>highestMark){
51+
// highestMark = avgmarks[i]
52+
// }
53+
// }
54+
// console.log("Highest Mark:", highestMark)
55+
// let lowestMark = avgmarks[0]
5656

57-
for(let i=0;i<avgmarks.length;i++){
58-
if(avgmarks[i]<lowestMark){
59-
lowestMark = avgmarks[i]
60-
}
61-
}
62-
console.log("Lowest Mark:", lowestMark)
57+
// for(let i=0;i<avgmarks.length;i++){
58+
// if(avgmarks[i]<lowestMark){
59+
// lowestMark = avgmarks[i]
60+
// }
61+
// }
62+
// console.log("Lowest Mark:", lowestMark)
6363

64-
const accArray=[]
65-
for (let index = 0; index < avgmarks.length; index++) {
66-
let highestMark = avgmarks[0]
67-
for(let j=0;j<avgmarks.length;j++){
68-
if(avgmarks[j]>highestMark){
69-
highestMark = avgmarks[j]
70-
}
64+
// const accArray=[]
65+
// for (let index = 0; index < avgmarks.length; index++) {
66+
// let highestMark = avgmarks[0]
67+
// for(let j=0;j<avgmarks.length;j++){
68+
// if(avgmarks[j]>highestMark){
69+
// highestMark = avgmarks[j]
70+
// }
7171

72-
}
72+
// }
7373

74-
accArray.push(highestMark)
75-
const index = avgmarks.indexOf(highestMark)
76-
avgmarks[index] = -1
77-
console.log(avgmarks)
74+
// accArray.push(highestMark)
75+
// const index = avgmarks.indexOf(highestMark)
76+
// avgmarks[index] = -1
77+
// console.log(avgmarks)
7878

7979

8080

81-
}
82-
console.log("Sorted Marks:", accArray)
81+
// }
82+
// console.log("Sorted Marks:", accArray)
8383

8484

0 commit comments

Comments
 (0)