1vstudent (ListVie viewal1studenta () : private void viewAllstudents() Databaseclass databaseclass-new Databaseclass (this); List studentList-databaseclas. String () studentInfo- new String (studentList.size()): String () phoneNumbers- new String (studentList.size ()1; for (int i -0;icstudentList.size ();i++) Student s-studentList.get (i); atudent Info[i]="ID:"+s.getID() +" Vize:"+s.getVizeMark ()+" Final: "+s.getFinalMark (): phoneNumbers(i]-s.get PhoneNumber (); ArrayAdapter adapter-new uykdapter<> (getApplicationContext (), android.R.layout.simple_list_item1, ivstudent.setAdapter (- public boolean onCreateOptionsMenu (Menu menu) { getMenuInflater ().inflate (R. menu. option_menu,menu); return super.onCreateOptionsMenu (menu); public boolean onoptionsItemSelected (GNonNull MenuItem item) { switch (item.getItemId ()) { case R.id.item newMark: Intent i-new Intent (MainActivity.this, startActivityForResult (i, MARK_CODE); break; -): case R.id.item exit: return super.onoptionsItemSelected (item); protected void onActivityResult (int requestCode, int resultCode, @Nullable Intent data) { super.onActivityResult (requestCode, resultCode, data); if (request Code=.. if (resultCode-= Activity.RESULT OK) { Double avg-Double.parseDouble (data.getStringExtra ("AVARAGE")); phoneNumber =data.getStringExtra ("PHONENUMBER"); if(avg>=50) else viewAllStudents (); private void sendSMS () { if (ActivityCompat.checkSelfPermission (this, Manifest.permission.SEND SMS) PackageManager.PERMISSION GRANTED) { SmsManager sms-SmsManager.getDefault(); sms.sendTextMessage (phoneNumber, null, "You passed!!!", null,null); }else ActivityCompat.requestPermissions (this, new String [] ( 100);
1vstudent (ListVie viewal1studenta () : private void viewAllstudents() Databaseclass databaseclass-new Databaseclass (this); List studentList-databaseclas. String () studentInfo- new String (studentList.size()): String () phoneNumbers- new String (studentList.size ()1; for (int i -0;icstudentList.size ();i++) Student s-studentList.get (i); atudent Info[i]="ID:"+s.getID() +" Vize:"+s.getVizeMark ()+" Final: "+s.getFinalMark (): phoneNumbers(i]-s.get PhoneNumber (); ArrayAdapter adapter-new uykdapter<> (getApplicationContext (), android.R.layout.simple_list_item1, ivstudent.setAdapter (- public boolean onCreateOptionsMenu (Menu menu) { getMenuInflater ().inflate (R. menu. option_menu,menu); return super.onCreateOptionsMenu (menu); public boolean onoptionsItemSelected (GNonNull MenuItem item) { switch (item.getItemId ()) { case R.id.item newMark: Intent i-new Intent (MainActivity.this, startActivityForResult (i, MARK_CODE); break; -): case R.id.item exit: return super.onoptionsItemSelected (item); protected void onActivityResult (int requestCode, int resultCode, @Nullable Intent data) { super.onActivityResult (requestCode, resultCode, data); if (request Code=.. if (resultCode-= Activity.RESULT OK) { Double avg-Double.parseDouble (data.getStringExtra ("AVARAGE")); phoneNumber =data.getStringExtra ("PHONENUMBER"); if(avg>=50) else viewAllStudents (); private void sendSMS () { if (ActivityCompat.checkSelfPermission (this, Manifest.permission.SEND SMS) PackageManager.PERMISSION GRANTED) { SmsManager sms-SmsManager.getDefault(); sms.sendTextMessage (phoneNumber, null, "You passed!!!", null,null); }else ActivityCompat.requestPermissions (this, new String [] ( 100);
Computer Networking: A Top-Down Approach (7th Edition)
7th Edition
ISBN:9780133594140
Author:James Kurose, Keith Ross
Publisher:James Kurose, Keith Ross
Chapter1: Computer Networks And The Internet
Section: Chapter Questions
Problem R1RQ: What is the difference between a host and an end system? List several different types of end...
Related questions
Question
100%
Besides there is an options menu that includes two options in the main activity. These are: 1. New Student 2. Exit When you click on the “New Student” option, a “New Activity” opens and the teacher enters the Student ID, Visa, Final Number, Phone Number and clicks the Add button. Thus, the student's information is recorded in the database . In addition, the grade point average is calculated by taking 40% of the student visa and 60% of the final. Both the grade point average and this student's phone number are sent to MainActivity. When registration is complete, the main activity is updated to include the list of the currently added student. In addition, if the average score coming from the main activity to NewActivity is equal to or greater than 50, an SMS is sent directly to the student's phone number indicating that he or she has passed the course. For this process, necessary permissions are obtained by following the permission procedure. If the student's average is less than 50, this time the student's phone number is called and an SMS is sent to the student notifying him/her of its failure. The permission procedure has been implemented to obtain the necessary permissions for both processes. Finally, the Exit option in the options menu is used to exit the application. The codes for an Android application that performs these operations are shown on the following pages. Fill in the blanks in the code according to the information provided
![MainActivity:
public elass Mainact ivity extends AppCompatActivity (
LintView 1vstudent:
Final atatic int MARK CODE-101
String phoneNumberi
protected void onCreate (Bundle savedInstancestate) {
auper.onCreate (savedinstancestate) a
setContentview (R.layout.activity main):
1vstudent- (ListView) findviewById (R.id.1v Student);
viewAl1students() :
private void viewAllstudents () (
Databaseclass databaseclass-new Databaseclass (this);
List<Student> studentList-databaseclas.
String () studentInfo new String (studentList.size()1:
String () phoneNumbers- new String (studentList.size(01;
for (int i -0;icstudentList.size ();i++)
Student S=studentList.get (i);
studentInfo[i]="ID: "+s.getID() +" Vize:"+s.getVizeMark () +"
Final:"+B. get Final Mark ();
phoneNumbers (i] -s.get PhoneNumber ();
ArrayAdapter<String> adapter=new
--)3B
AErayAdapter<> (getApplicationContext (), android.R.layout.simple_list_item 1,
1vstudent.setAdapter (
public boolean onCreateOptionsMenu (Menu menu) {
getMenuInflater ().inflate (R.menu. option_menu, menu);
return super.onCreateOptionsMenu (menu);
public boolean onOptionsItemSelected (@NonNull MenuItem item) {
switch (item.getItemId () ) {
case R.id.item newMark:
..) ;
Intent i=new Intent (MainActivity.this,
startActivityForResult (i, MARK_CODE) ; break;
case R.id.item exit:
return super.onoptionsItemSelected (item);
protected void onActivityResult (int request Code, int resultCode, ONullable Intent
data) {
super.onActivityResult (request Code, resultCode, data);
if(requestCode==.
if (resultCode== Activity.RESULT OK) {
Double avg3Double.parseDouble (data.getStringExtra ("AVARAGE"));
phoneNumber =data.getStringExtra ("PHONENUMBER");
if (avg>=50)
else
viewAllStudents ();
private void sendSMS () {
if (ActivityCompat.check SelfPermission (this, Manifest.permission. SEND SMS) ==
PackageManager.PERMISSION GRANTED) {
SmsManager sms SmsManager.getDefault();
sms.sendTextMessage (phoneNumber, null, "You passed!!!", null,null);
}else
ActivityCompat.request Permissions (this, new String []
100);](/v2/_next/image?url=https%3A%2F%2Fcontent.bartleby.com%2Fqna-images%2Fquestion%2F29ad0464-a5a4-4cf0-b194-f0e0990092ee%2F1e744e4c-6321-4f21-ac23-f90d717caf5a%2Fo5fr9og_processed.jpeg&w=3840&q=75)
Transcribed Image Text:MainActivity:
public elass Mainact ivity extends AppCompatActivity (
LintView 1vstudent:
Final atatic int MARK CODE-101
String phoneNumberi
protected void onCreate (Bundle savedInstancestate) {
auper.onCreate (savedinstancestate) a
setContentview (R.layout.activity main):
1vstudent- (ListView) findviewById (R.id.1v Student);
viewAl1students() :
private void viewAllstudents () (
Databaseclass databaseclass-new Databaseclass (this);
List<Student> studentList-databaseclas.
String () studentInfo new String (studentList.size()1:
String () phoneNumbers- new String (studentList.size(01;
for (int i -0;icstudentList.size ();i++)
Student S=studentList.get (i);
studentInfo[i]="ID: "+s.getID() +" Vize:"+s.getVizeMark () +"
Final:"+B. get Final Mark ();
phoneNumbers (i] -s.get PhoneNumber ();
ArrayAdapter<String> adapter=new
--)3B
AErayAdapter<> (getApplicationContext (), android.R.layout.simple_list_item 1,
1vstudent.setAdapter (
public boolean onCreateOptionsMenu (Menu menu) {
getMenuInflater ().inflate (R.menu. option_menu, menu);
return super.onCreateOptionsMenu (menu);
public boolean onOptionsItemSelected (@NonNull MenuItem item) {
switch (item.getItemId () ) {
case R.id.item newMark:
..) ;
Intent i=new Intent (MainActivity.this,
startActivityForResult (i, MARK_CODE) ; break;
case R.id.item exit:
return super.onoptionsItemSelected (item);
protected void onActivityResult (int request Code, int resultCode, ONullable Intent
data) {
super.onActivityResult (request Code, resultCode, data);
if(requestCode==.
if (resultCode== Activity.RESULT OK) {
Double avg3Double.parseDouble (data.getStringExtra ("AVARAGE"));
phoneNumber =data.getStringExtra ("PHONENUMBER");
if (avg>=50)
else
viewAllStudents ();
private void sendSMS () {
if (ActivityCompat.check SelfPermission (this, Manifest.permission. SEND SMS) ==
PackageManager.PERMISSION GRANTED) {
SmsManager sms SmsManager.getDefault();
sms.sendTextMessage (phoneNumber, null, "You passed!!!", null,null);
}else
ActivityCompat.request Permissions (this, new String []
100);

Transcribed Image Text:students in the database are displayed in a listview. MainActivity and other layouts
below:
ContactsWithSQLite
ContactsWithSQLite
ContactsWithSQLite
New Student
ID.1 Vize 30 Final:50
Exit
iD:1 Vize:30 Final:50
D.2 Vize 40 Final:30
ID.2 Vize:40 Final:30
ist li
0:3 Vize 40 Final:60
iD.3 Vize:40 Final:80
D:4 Vize 80 Final:60
ID.4 Vize:80 Final:80
D:5 Vize 60 Final:60
ID:5 Vize.60 Final:60
ID:6 Vize 40 Final:45
ID.6 Vize:40 Final:45
D8 Vize 58 Final 70
ID.8 Vize 58 Final:70
ADD
DG VIze 56 Fnal 14
ID:9 Vize:56 Final:14
MainActivity Ekranı
NewActivity Ekra
Option_Menu
Expert Solution

This question has been solved!
Explore an expertly crafted, step-by-step solution for a thorough understanding of key concepts.
Step by step
Solved in 2 steps

Recommended textbooks for you

Computer Networking: A Top-Down Approach (7th Edi…
Computer Engineering
ISBN:
9780133594140
Author:
James Kurose, Keith Ross
Publisher:
PEARSON

Computer Organization and Design MIPS Edition, Fi…
Computer Engineering
ISBN:
9780124077263
Author:
David A. Patterson, John L. Hennessy
Publisher:
Elsevier Science

Network+ Guide to Networks (MindTap Course List)
Computer Engineering
ISBN:
9781337569330
Author:
Jill West, Tamara Dean, Jean Andrews
Publisher:
Cengage Learning

Computer Networking: A Top-Down Approach (7th Edi…
Computer Engineering
ISBN:
9780133594140
Author:
James Kurose, Keith Ross
Publisher:
PEARSON

Computer Organization and Design MIPS Edition, Fi…
Computer Engineering
ISBN:
9780124077263
Author:
David A. Patterson, John L. Hennessy
Publisher:
Elsevier Science

Network+ Guide to Networks (MindTap Course List)
Computer Engineering
ISBN:
9781337569330
Author:
Jill West, Tamara Dean, Jean Andrews
Publisher:
Cengage Learning

Concepts of Database Management
Computer Engineering
ISBN:
9781337093422
Author:
Joy L. Starks, Philip J. Pratt, Mary Z. Last
Publisher:
Cengage Learning

Prelude to Programming
Computer Engineering
ISBN:
9780133750423
Author:
VENIT, Stewart
Publisher:
Pearson Education

Sc Business Data Communications and Networking, T…
Computer Engineering
ISBN:
9781119368830
Author:
FITZGERALD
Publisher:
WILEY