List based assignment
Assignemnt 1
Every Student has some marks associated with it. Student details contains its id and name.
And for Marks, there are subjectId, studentId and number of marks a student scored.
Following are the requirements which is required to gain from above scenario (i.e. Student and marks)
-
Input:- (subjectId, percentage, pass/fail)
Output:- for input pass, evaluate that how much students(id, name) are passed in the inputted subjectId for input fail, evaluate that how much students(id, name) are failed in the inputted subjectId
Note:- percentage is the input which defines the minimum passing criteria
e.g.
Pass count: 15
Fail count: 10
-
Input:- (subjectId, count, top/bottom)
Output:- based on the last input(top/bottom), output the students details who have scored max/min in that subjectId
e.g.
input: 1 5 top
output:
Kunal 85
Himanshu 84
Geetika 83
Anmol 82
Mahesh 81
-
Input:-
(top/bottom, count)
OutPut:-
Overall top/least scorer based on all the subjects score, fetch students name
count- input defines that how much students name are to be printed on console
e.g.
input: top 2
output:
Himanshu 75%
Geetika 74% -
Input:-
(percentage, good_scholarship, normal_or_no_scholarship)
Output:- two groups of students with the amount of scholarship
e.g.
input: 85% 2000 500
output:
Kunal 2000
Himanshu 500
Geetika 2000
Mahesh 500
-
Input:-
(pass/fail, percentage)
count and print the number of students and all names who are passed/fail,
Pass or fail would be decided by percentage input field.
e.g.
input: fail 30
output:
Kunal 28%
Himanshu 29%
-
Find the student(s) who have scored 95% or above and print its details.
input: 95%
output:
Kunal 95%
Himanshu 96%
Geetika 97%
-
For every student, find its marks in detail (just like detailed Report card of a student.)
Note:- must use groupBy method of List
input: reportcard
output:
Kunal 75 70 80 75 75%
Himanshu 74 70 81 75 75%
Geetika 70 70 85 75 75%
Developer Notes:
There would be two case classes
- Student(id: Long, name: String)
- Marks(subjectId: Int,studentId: Long, marksObtained: float)
In order to fill data in those case classes, either take inputs from a file, or take static inputs. But there must be atleast 5 subjects, and atleast 10 students.
e.g. List(Student(1, "Kunal"), Student(2, "Himanshu"), Student(3, "Geetika") ....)
List(Marks(1, 1, 95), Marks(2, 1, 75), ...)
So basically here Kunal has marks 95 and 75 for the paper 1 and 2 respectively.
Assignemnt 2
- Find the last element of list with its index value(dont use inbuilt methods to extract last element directly)
- print the table of each element in the List
- aggregate the contents of two lists of same size into a single list
List(1,2) and List("a", "b") results List(List(1, "a"), List(2, "b")) - find sum and multiplication of the list (dont use inbuilt methods)
- apply quicksort and mergesort on the Lists
- implement Stack and Queue using Lists.
Collection Based Assignment Here comes up with yet another student assignment and it goes something like this, every Student has some marks associated with them. Student details contains its id and name. And for Marks, there are subjectId, studentId and number of marks a student scored.
Assignment 1 Now, I require a case class named ScoreCard having fields (studentId: Long, marks: Map[Long, Float], percentage: Float).
- Write a method which takes no parameter and generates a Map with key student name and value as ScoreCard. As there can be more than one student with same name, the logic we have to follow is that, if two or more student has same name the key shold be the name of the student and the values (ScoreCard s) should be in a List, otherwise the key should be the student name and value should be the case class ScoreCard. e.g. Map should be Map[String, AnyRef].
- Write a method which takes input as student name and print the score cards. If it finds one or more than one score card print all of them other wise print "No data found". The print should be in increasing order of the student id.
Assignment 2 The Student class should contain one more field this time, gender. The values of gender must be set in a Enumeration.
- Write a method getScoreCardByGender to return a tuple of ScoreCards (e.g. (List[ScoreCard], List[ScoreCard])), where first field in the tuple has male student's score card and the second field has female student's score cards.
- Write a method which calls the getScoreCardByGender method and gives the result which has more than 50%.
- Write a method to find out similar percentage between the two groups (male, female). for example Geetika -75, Kunal -75
- Write a method fo find out the percentage that girls group has scored but no same percentage has got in the boys group. e.g. ( Geetika -75, Neha - 73, charmy - 72) - (Kunal -75, Anmol - 73, Nitin - 71) = Charmy-72