Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Write a program to read data (roll no, name, age and marks) of students. Now aft

ID: 3539397 • Letter: W

Question

Write a program to read data (roll no, name, age and marks) of students. Now after having read the students%u2019 data perform the following operations:

1.       Display students%u2019 data for names beginning with a particular letter (this letter should be taken as input)

2.       Display students%u2019 data for roll nos within a particular range (this should be taken from the user).

3.       Display students%u2019 data in descending order of their ages

For simplicity sake, consider roll nos from 1 to 100 only.

Sample program run (Text in bold is what your program should display)

Reading the students%u2019 data:

Enter roll number: 001

Enter name: Surya

Enter age: 30

Enter marks: 29

Do you want to enter another student%u2019s details (Y/N)? Y

Enter roll number: 045

Enter name: Sundeep

Enter age: 27

Enter marks: 40

Do you want to enter another student%u2019s details (Y/N)? Y

Enter roll number: 089

Enter name: Rakesh

Enter age: 28

Enter marks: 89

Do you want to enter another student%u2019s details (Y/N)? Y

Enter roll number: 034

Enter name: Charan

Enter age: 27

Enter marks: 46

Do you want to enter another student%u2019s details (Y/N)? N

Select an operation you want to perform on the students%u2019 data:

1.       Display students%u2019 data for names beginning with a particular letter

2.       Display students%u2019 data for roll nos within a particular range

3.       Display students%u2019 data in descending order of their ages

4.       Exit

What do you want to do (1-4)? 1

What is the beginning letter? S

Please find below the students%u2019 data beginning with letter %u2018S%u2019

001         Surya                     30           29

045         Sundeep              27           40

Do you want to perform another operation (Y/N)? Y

Select an operation you want to perform on the students%u2019 data:

1.       Display students%u2019 data for names beginning with a particular letter

2.       Display students%u2019 data for roll nos within a particular range

3.       Display students%u2019 data in descending order of their ages

4.       Exit

What do you want to do (1-4)? 2

Enter the starting roll number: 011

Enter the ending roll number: 034

Please find below the students%u2019 data in the range 011 and 034:

034         Charan                 27           46

Do you want to perform another operation (Y/N)? Y

Select an operation you want to perform on the students%u2019 data:

1.       Display students%u2019 data for names beginning with a particular letter

2.       Display students%u2019 data for roll nos within a particular range

3.       Display students%u2019 data in descending order of their ages

4.       Exit

What do you want to do (1-4)? 3

001         Surya                     30           29

089         Rakesh                 28           89

045         Sundeep              27           40

034         Charan                 27           46

Do you want to perform another operation (Y/N)? N

At this point the program should exit.

Note:

Follow proper naming conventions for your class and method names.

Have two classes, one for the logic and the other for the driver (have main method in this class).

Package your code.

Explanation / Answer

Code for Program to read rollno, marks of sub1,sub2 and sub3 and on basis of that display result in Java import java.io.*; class StudDetail { int RollNo; } class StudMarks extends StudDetail { float sub1; float sub2; float sub3; float TotalMarks; void getdata() { System.out.println(" Recording Entry"); try{ BufferedReader obj = new BufferedReader(new InputStreamReader(System.in)); String sRNo,sSub1,sSub2,sSub3; System.out.print("Enter Roll No : "); System.out.flush(); sRNo=obj.readLine(); RollNo=Integer.parseInt(sRNo); System.out.print("Enter Marks for Subject 1 : "); System.out.flush(); sSub1=obj.readLine(); sub1=Float.parseFloat(sSub1); System.out.print("Enter Marks for Subject 2 : "); System.out.flush(); sSub2=obj.readLine(); sub2=Float.parseFloat(sSub2); System.out.print("Enter Marks for Subject 3 : "); System.out.flush(); sSub3=obj.readLine(); sub3=Float.parseFloat(sSub3); TotalMarks=sub1+sub2+sub3; } catch(Exception e){} } void display() { System.out.println(" Displaying Record"); System.out.println("Roll No : "+RollNo); System.out.println("Subject 1 : "+sub1); System.out.println("Subject 2 : "+sub2); System.out.println("Subject 3 : "+sub3); System.out.println("Total Marks : "+TotalMarks); } void totalMarks() { System.out.println(" Displaying Total Marks"); System.out.println("Roll No : "+RollNo); System.out.println("Total Marks : "+TotalMarks); } } class StudentDatabase { publicstaticvoid main(String args[]) { System.out.println(" =====STUDENT DATABASE===== "); float HighMark_sub1; float HighMark_sub2; float HighMark_sub3; float StudHighMark; int No_of_stud=3,choice; String str; char c; try{ BufferedReader obj = new BufferedReader(new InputStreamReader(System.in)); System.out.print(" Enter number of Students : "); System.out.flush(); str=obj.readLine(); No_of_stud=Integer.parseInt(str); StudMarks SMobj[]=new StudMarks[No_of_stud]; while(true) { System.out.println(" Choose your choice..."); System.out.println("1) PASS ENTRY"); System.out.println("2) DISPLAY ALL RECORDS"); System.out.println("3) DISPLAY TOTAL MARKS for all students"); System.out.println("4) DISPLAY HIGHEST MARKS in each subject"); System.out.println("5) DISPLAY student who recived highest total marks"); System.out.println("6) Exit "); System.out.print("Enter your choice : "); System.out.flush(); str=obj.readLine(); choice=Integer.parseInt(str); switch(choice) { case 1 : for(int i=0;i
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote