Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

In JAVA- Step 1---Create a File called ResultDB.txt having RorNo and Marks separated by space in each line. Insert appropriate values. Step 2---Create a class

In JAVA-

Step 1---Create a File called ResultDB.txt having RorNo and Marks separated by space in each line. Insert appropriate values.

Step 2---Create a class called Result.java having member variables rollNo and marks. Add appropriate constructor.

Step 3---Create a singleton class called StudentDAO.java having an array called results to store the Result objects of the file ResultDB.txt. Initialize the array in a static block so that it reads the file, create the Student object and store it in the results array during loading of the class StudentDAO.java. This singleton class maintains a maximum of 5 instances and return the instances in round robin fashion within getInstance() method. StudentDAO.java also has a non-static method with signature int getMarks(int rollNo) that queries the array and returns the corresponding marks.

Step 4---Create a class called ResultQuery.java that, within a loop, get an instances of StudentDAO.java using getInstance() method, print the instance returned, call getMarks() method with a random rollNo and print the marks.

-------------

Please provide the txt file (in written text form ofc) mentioned in the question.

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

App Inventor

Authors: David Wolber, Hal Abelson

1st Edition

1449397484, 9781449397487

More Books

Students also viewed these Programming questions

Question

Describe effectiveness of reading at night?

Answered: 1 week ago

Question

find all matrices A (a) A = 13 (b) A + A = 213

Answered: 1 week ago