Professional Documents
Culture Documents
(Polytechnic)
Last but not the least I convey my gratitude to all the teachers for
providing me the technical skill that will always remain as my asset
and to all non- teaching staffs for the cordial support they offered.
Thank you
TABLE OF CONTENTS
1.Introduction
2.Basic function
3.Proposed system
a. Description
b. System requirements
4.System Design
5.Source code
6. Application.
7.Testing
Test Yourself
More Button
Number of Questions
More Button
Number Of Questions
Import Data
PROPOSED SYSTEM
The following documentation is a project the “Name of the term paper allotted”. It is a detailed
summary of all the drawbacks of the old system and how the new proposed system overcomes these
shortcomings. The new system takes into account the various factors while designing a new system.
It keeps into the account the Economical bandwidth available for the new system. The foremost thing
that is taken care of is the Need and Requirements of the User.
DESCRIPTION
Before developing software we keep following things in mind that we can develop powerful and quality
software
PROBLEM STATEMENT
FUNCTIONS TO BE PROVIDED:
The system will be user friendly and completely menu driven so that the users shall have no problem in
using all options.
SYSTEM REQUIRMENTS
Language: Java
import android.app.DatePickerDialog;
import android.content.Intent;
import android.content.SharedPreferences;
import android.net.Uri;
import android.os.Bundle;
import android.util.Log;
import android.view.Menu;
import android.view.MenuInflater;
import android.view.MenuItem;
import android.widget.DatePicker;
import android.widget.ListView;
import android.widget.TextView;
import android.widget.Toast;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.appcompat.app.AppCompatActivity;
import com.google.gson.Gson;
import java.io.BufferedReader;
import java.io.File;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.time.LocalDate;
import java.util.Collections;
import java.util.List;
import java.util.stream.Collectors;
import remcv.com.github.examprep.controller.DatabaseCrud;
import remcv.com.github.examprep.controller.DatabaseHandler;
import remcv.com.github.examprep.model.ExamItem;
import remcv.com.github.examprep.utils.TableConstants;
import remcv.com.github.examprep.utils.Utils;
import remcv.com.github.examprep.view.DialogNumberOfSubject;
import remcv.com.github.examprep.view.ExamItemAdapter;
import remcv.com.github.examprep.view.MyDialogDatePicker;
// fields - layout
private TextView countdown_TV;
private TextView numberOfSubjects_TV;
private TextView totalNumberOfSubjects_TV;
private ListView problems_LV;
// methods - lifecycle
@Override
protected void onCreate(Bundle savedInstanceState)
{
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
// initialize data
initializeData();
// initiate layout
initializeLayout();
// ListView adapter
adapter = new ExamItemAdapter(databaseHandler.getList(), MainActivity.this);
problems_LV.setAdapter(adapter);
// handle events
problems_LV.setOnItemClickListener((parent, view, position, id) ->
onListViewItemClicked(position));
}
@Override
protected void onStop()
{
super.onStop();
// save database
databaseHandler.saveDb(sourceFile);
}
@Override
protected void onActivityResult(int requestCode, int resultCode, @Nullable Intent
data)
{
super.onActivityResult(requestCode, resultCode, data);
/*
1 - add item
2 - update OR delete
3 - import database from tsv file
*/
if (resultCode == RESULT_OK)
{
switch (requestCode)
{
case ADD_ITEM_REQUEST_CODE:
onAddItemReturn(data);
break;
case UPDATE_DELETE_ITEM_REQUEST_CODE:
onUpdateDeleteReturn(data);
break;
case UPLOAD_TSV_REQUEST_CODE:
onUploadReturn(data);
break;
}
}
Collections.sort(databaseHandler.getList());
adapter.notifyDataSetChanged();
updateData();
updateUI();
}
int requestCode = 2;
startActivityForResult(intent, requestCode);
}
@Override
public boolean onOptionsItemSelected(@NonNull MenuItem item)
{
switch (item.getItemId())
{
case R.id.settingsMenu_itemAdd:
onAddButtonClicked();
break;
case R.id.settingsMenu_itemGenerateRandomList:
onGenerateRandomListOfSubjectsClicked();
break;
case R.id.settingsMenu_itemChangeExamDate:
onChangeExamDateMenuItemClicked();
break;
case R.id.settingsMenu_itemSetNoSubjectsInTest:
createAlertDialogNumberOfQuestions();
break;
case R.id.settingsMenu_itemImport:
onImportButtonClicked();
break;
}
return true;
}
if (list == null)
{
Toast.makeText(this, "Not enough subjects or categories in your list",
Toast.LENGTH_SHORT).show();
}
else
{
// send the list to TestSubjectsActivity
Gson gson = new Gson();
String listJson = gson.toJson(list);
startActivity(toTestSubjectsActivityIntent);
}
}
startActivityForResult(getCsvIntent, UPLOAD_TSV_REQUEST_CODE);
}
// methods - data
public void initializeData()
{
// instantiate a DatabaseCrud implementation
databaseHandler = new DatabaseHandler(MainActivity.this);
// instantiate the database File object by accessing the Android device app
storage
sourceFile = new File(getApplicationContext().getFilesDir(),
databaseHandler.getDatabasePath());
// create the .csv file if it doesn't exist (for first time users)
try
{
sourceFile.createNewFile();
}
catch (IOException e)
{
Log.e(TAG, "initializeData() " + e.getMessage());
}
// calculate solvedNumberOfSubjects
solvedNumberOfSubjects = (int) databaseHandler.getList().stream()
.filter(ExamItem::getIsDone)
.count();
if (buttonName.equals("deleteButton"))
{
onDeleteReturn(index);
}
else // buttonName.equals("updateButton")
{
onUpdateReturn(index, data);
}
}
try
{
inputStream = getContentResolver().openInputStream(csvUri);
BufferedReader reader = new BufferedReader(new
InputStreamReader(inputStream));
// if no exception was thrown until here, then clear the old list
databaseHandler.getList().clear();
String line;
String[] lineArray;
reader.close();
inputStream.close();
// methods layout
public void initializeLayout()
{
countdown_TV = findViewById(R.id.countdownTextView_AM);
numberOfSubjects_TV = findViewById(R.id.numberOfSubjects_AM);
problems_LV = findViewById(R.id.problemsListView_AM);
totalNumberOfSubjects_TV = findViewById(R.id.totalNumberOfSubjects_AM);
@Override
public boolean onCreateOptionsMenu(Menu menu)
{
MenuInflater inflater = getMenuInflater();
inflater.inflate(R.menu.settings_menu, menu);
return true;
}
public void updateUI()
{
numberOfSubjects_TV.setText(String.valueOf(numberOfSubjectsToTest));
totalNumberOfSubjects_TV.setText(String.format("Subjects (%d solved / %d)",
solvedNumberOfSubjects, databaseHandler.getList().size()));
countdown_TV.setText(Utils.calculateDaysLeft(examDate));
}
@Override
public void getNumber(int number)
{
numberOfSubjectsToTest = number;
// update UI
numberOfSubjects_TV.setText(String.valueOf(numberOfSubjectsToTest));
}
@Override
public void onDateSet(DatePicker view, int year, int month, int dayOfMonth)
{
examDate = LocalDate.of(year, month + 1, dayOfMonth);
// update UI
updateUI();
}
}
DialogNumberOfSubject.java
package remcv.com.github.examprep.view;
import android.app.AlertDialog;
import android.app.Dialog;
import android.content.Context;
import android.content.DialogInterface;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.widget.EditText;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.appcompat.app.AppCompatDialogFragment;
import java.text.BreakIterator;
import remcv.com.github.examprep.R;
// nested interface
public interface DialogNumberOfSubjectListener
{
void getNumber(int number);
}
// constructor
@NonNull
@Override
public Dialog onCreateDialog(@Nullable Bundle savedInstanceState)
{
//
//
AlertDialog.Builder builder = new AlertDialog.Builder(getActivity());
builder.setView(view)
.setTitle("Number of Subject for Exam")
.setNegativeButton("cancel", new DialogInterface.OnClickListener()
{
@Override
public void onClick(DialogInterface dialog, int which)
{
dismiss();
}
})
.setPositiveButton("save", new DialogInterface.OnClickListener()
{
@Override
public void onClick(DialogInterface dialog, int which)
{
int numberOfQuestions =
Integer.parseInt(numberOfSubject_ET.getText().toString());
dnoq.getNumber(numberOfSubject);
}
});
return builder.create();
}
// methods
@Override
public void onAttach(@NonNull Context context)
{
super.onAttach(context);
try
{
dnoq = (DialogNumberOfSubjectListener) context;
}
catch (ClassCastException e)
{
throw new ClassCastException(context.toString() + " must implement
DialogNumberOfSubjectListener");
}
}
}
AddExamItemActivity.java
package remcv.com.github.examprep;
import androidx.appcompat.app.AppCompatActivity;
import android.content.Intent;
import android.os.Bundle;
import android.util.Log;
import android.widget.Button;
import android.widget.CheckBox;
import com.google.android.material.textfield.TextInputLayout;
import remcv.com.github.examprep.utils.TableConstants;
import remcv.com.github.examprep.utils.Utils;
// fields - layout
private TextInputLayout categoryNumber_TIL;
private TextInputLayout problem_TIL;
private Button addItem_Button;
private CheckBox subjectIsSolved_CB;
// methods - lifecycle
@Override
protected void onCreate(Bundle savedInstanceState)
{
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_add_exam_item);
// initialize data
// initialize layout
initializeLayout();
// methods - data
public void initializeData()
{
// TODO
}
// methods layout
public void initializeLayout()
{
categoryNumber_TIL = findViewById(R.id.categoryNumberTextInputLayout_AAEI);
problem_TIL = findViewById(R.id.problemTextInputLayout_AAEI);
addItem_Button = findViewById(R.id.addItemButton_AAEI);
subjectIsSolved_CB = findViewById(R.id.subjectSolvedCheckBox_AAEI);
}
}
TestSubjectsActivity.java
package remcv.com.github.examprep;
import androidx.appcompat.app.AppCompatActivity;
import android.content.Intent;
import android.os.Bundle;
import android.widget.ListView;
import android.widget.TextView;
import com.google.gson.Gson;
import com.google.gson.reflect.TypeToken;
import java.lang.reflect.Type;
import java.util.ArrayList;
import java.util.List;
import remcv.com.github.examprep.model.ExamItem;
import remcv.com.github.examprep.utils.TableConstants;
import remcv.com.github.examprep.utils.Utils;
import remcv.com.github.examprep.view.ExamItemAdapter;
// fields - data
private List<ExamItem> examItems;
private ExamItemAdapter adapter;
// initialize layout
initializeLayout();
// initialize data
initialDataSetup();
// update layout
updateLayout();
}
// methods - data
public void initialDataSetup()
{
// get list of Exam items
Intent getListIntent = getIntent();
String listStringJson =
getListIntent.getStringExtra(TableConstants.RANDOM_LIST);
// set adapter
adapter = new ExamItemAdapter(examItems, TestSubjectsActivity.this);
}
// methods - layout
public void initializeLayout()
{
minutes_TV = findViewById(R.id.minutesTextView_ATS);
subjects_LV = findViewById(R.id.problemsListView_ATS);
}
UpdateDeleteItemActivity.java
package remcv.com.github.examprep;
import androidx.appcompat.app.AppCompatActivity;
import android.content.Intent;
import android.os.Bundle;
import android.widget.Button;
import android.widget.CheckBox;
import com.google.android.material.textfield.TextInputLayout;
import remcv.com.github.examprep.utils.TableConstants;
import remcv.com.github.examprep.utils.Utils;
// fields - layout
private TextInputLayout categoryNumber_til;
private TextInputLayout problem_til;
private Button updateButton;
private Button deleteButton;
private CheckBox subjectIsSolved_CB;
@Override
protected void onCreate(Bundle savedInstanceState)
{
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_update_delete_item);
// initialize layout
initializeLayout();
// initialize data
initializeData();
// handle events
deleteButton.setOnClickListener(v -> onDeleteButtonClicked());
updateButton.setOnClickListener(v -> onUpdateButtonClicked());
}
// close activity
finish();
}
// methods - data
public void initializeData()
{
Intent intent = getIntent();
categoryNumber_til.getEditText().setText(String.valueOf(categoryNumber));
problem_til.getEditText().setText(problem);
subjectIsSolved_CB.setChecked(isDone);
}
// methods - layout
public void initializeLayout()
{
categoryNumber_til = findViewById(R.id.categoryNumberTextInputLayout_AUDI);
problem_til = findViewById(R.id.problemTextInputLayout_AUDI);
updateButton = findViewById(R.id.updateItemButton_AUDI);
deleteButton = findViewById(R.id.deleteItemButton_AUDI);
subjectIsSolved_CB = findViewById(R.id.subjectSolvedCheckBox_AUDI);
}
}
APPLICATIONS
Early exam preparation provides several benefits as
it enables students to cover the syllabus on time, identify
their strengths and weaknesses, and practice efficiently. It
reduces stress and improves retention by allowing a better
pace of learning, and assists in managing time during the
actual exam .Exam prep apps can also help for easy
completion of syllabus without any hassle of completing it
within a very short time by alotting fixed time for each
subject .It also stops the stagnation of subjects with a lot of
syllabus left.
TESTING
Testing is the major control measure used during software development. Its
basic function is to detect errors in the software. During requirement analysis
and design, the output is a document that is usually textual and non- executable.
After the coding phase, computer programs are available that can be executed
for testing purpose. This implies that testing not only has to uncover errors
introduced during coding, but also errors introduced during previous phase.
Thus the goal of testing is to uncover the requirements, design and coding
errors in the programs. The Source code declared above for the program of
Scientific Calculator has been tested and it has been found that the above
source code is valid .The program involves many type of conversions. These
conversions has to be done carefully.
Our project will be able to implement in future after making some changes
and modifications as we make our project at a very low level. So the
modifications that can be done in our project are:
To make it screen touch so no need to touch key buttons and one more
change which can we made is to add snaps of the person who use it.We shall
further update the software with better features from time to time.