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

READ CAREFULLY AND LOOK ON BOTH PAGES . This is all one problem . Please ! Probl

ID: 3705354 • Letter: R

Question

READ CAREFULLY AND LOOK ON BOTH PAGES . This is all one problem . Please !

Problem: The First Lego Robotic League regional competition coaches have decided to select student teams for the upcoming National First League Robotics Competition. The robotic competition is based on scores from the first three rounds of competition. The selected members will advance to the national competition in June. Students with an average round score of 85 or higher and who competed in Category 1 or 2 during the regional competition are eligible for the national competition. The league statistician has compiled a list of First Lego Robotic League students. He has placed the information in a file called ROBOT.txt.

Dr. Rebecca Caldwell informed the statistician that you knew the java programming language. So, now the league has contracted you to prepare a report based on the information in the database (textfile). The database (ROBOT.txt) contains the following information:

· Name

· Category

· 1st Round Score

· 2nd Round Score

· 3rd Round Score

Sample Data:

ZimmermanD,1,88,75,76

Secondly, she needs you to prepare a report containing the following information:

1. Read and display the contents of the file.

2. Display the names of all eligible students’ name, category and his/her round average score. The list should be in alphabetical order by name.

3. Display the names of all eligible students in Category 1.

4. Display the names of all eligible students in Category 2.

5. Display the total number of eligible students in Category1.

6. Display the total number of eligible students in Category 2.

Submit the following for grading:

1. This sheet signed and dated.

2. Printed copies of the program and output.

3. Copies of program and output to my digital dropbox in Blackboard.

4. All materials related to this proficiency examination.

Sample Output:

Task #1

*********************************************************

Name Category Round 1 Round 2 Round 3

ZimmermanD 1 88 75 76

RegoneN 1 100 96 100

BrennonT 1 74 80 85

MouseM 1 87 83 90

ByrdT 2 78 77 80

WashingtonD 1 95 76 76

EricX 2 83 93 95

HouseS 1 91 71 91

ShawI 2 74 71 91

BarberP 1 88 85 92

CharlesD 2 86 95 81

DunlapK 2 91 95 70

JoeS 1 84 93 71

MatthewD 2 81 89 75

BrianW 1 98 74 71

RichardC 2 96 100 98

SahanaG 1 87 89 88

MichaleF 2 94 88 96

AarushiA 1 74 77 74

SahanaG 2 70 73 79

*********************************************************

Task #2

*********************************************************

All Eligible Students:

Name Grade Level Round Average

BarberP 1 88.33

CharlesD 2 87.33

DunlapK 2 85.33

EricX 2 90.33

MichaleF 2 92.67

MouseM 1 86.67

RegoneN 1 98.67

RichardC 2 98.00

SahanaG 1 88.00

*********************************************************

Task #3

*********************************************************

All Eligible Students in Category 1:

BarberP

MouseM

RegoneN

SahanaG

*********************************************************

Task #4

*********************************************************

All Eligible Students in Category 2:

CharlesD

DunlapK

EricX

MichaleF

RichardC

*********************************************************

Task #5

*********************************************************

There are 4 eligible students in Category 1.

*********************************************************

Task #6

*********************************************************

There are 5 eligible students in Category 2.

*********************************************************

Secondly, she needs you to prepare a report containing the Sample Proficiency Examination You have 3 hours to complete this e use printed references during this examination. Read the probem L. Read and display the contents of the file 2. Display the names of all eligible students' name, category and his/her Yeu are only allowed t programming language. Please sign below prior to submitting your cernife shar thi Display the names of all eligible students in Category l Display the names of all eligible students in Category 2 Display the total number of eligible students in Category 1 nion represens my oun wenk I did sor use any other materials other tha 5. Problem: The First Lego Robotic League regional competition coaches have decided to select student teams for the upcoming National First League Robotics Competition. The robotic competition is based on scores from the first three rounds of competition. The selected members will advance to the national competition in June Students with an average round score of 85 or higher and who competed in Category I or 2 during the regional competition are L This sheet signed and dated 2. Printed copies of the program and output. 3. Copies of program and output to my digital dropbox in 4. All materials related to this proficiency examination. compiled a list of First Lego Robotic League students. He has placed Sample Output Task #1 the information in a file called ROBOTtxt. programming language. So, now the league has contracted you to prepare a report based on the information in the database (textfile). The database (ROBOT.txt) contains the following information: Name Category Round 1 Round 2 Round 3 RegoneN BremnonT MouseM ByrdT .Category 100 Round Score 87 78 95 76

Explanation / Answer

======================================================================================

package chegg;

import java.io.*;

import java.util.*;

public class Players implements Comparable<Players>{

private String name;

private int category;

private int fscore;

private int sscore;

private int tscore;

// consttructor to assign the values.

public Players(String name, int category, int fscore, int sscore, int tscore) {

this.name = name;

this.category = category;

this.fscore = fscore;

this.sscore = sscore;

this.tscore = tscore;

}

@Override

public int compareTo(Players player) {

String compareName=((Players)player).name;

/* For Ascending order*/

return this.name.compareTo(compareName);

/* For Descending order do like this */

//return compareage-this.studentage;

}

@Override

public String toString() {

return "";

}

public static void main(String[] args) throws IOException {

// TODO Auto-generated method stub

//FileInputStream in = null;

// File file = new File("ROBOT.txt"); // Place the file at proper location.

// Scanner input = new Scanner(file);

// Creating array list of employees.

List<Players> playersList= new ArrayList<Players>();

//String player[]; // Array to store the player info.

  

//Reading file contents using bufferedreader

BufferedReader br = new BufferedReader(new FileReader("ROBOT.txt"));

String readLine = "";

  

while ((readLine = br.readLine()) != null) { // read line by line.

//System.out.println(readLine);

// split the line into tokens.

String[] player = readLine.split(",");

// adding player to list

//System.out.println(player[0] + player[1] + player[2] + player[3] + player[4]);

playersList.add(new Players(player[0], Integer.valueOf(player[1]),

Integer.valueOf(player[2]), Integer.valueOf(player[3]), Integer.valueOf(player[4])));

  

}

br.close();   

  

  

//Q1: Print all the players info.

System.out.println("TASK #1");

System.out.println(" ========================================================================= ");

System.out.format("%-25s%12s%10s%10s%10s", " NAME", "GRADE LEVEL", "ROUND 1", "ROUND 2", "ROUND 3");

System.out.println(" ========================================================================= ");

  

for (Players p : playersList) {

//for (String[] player : p) {

//System.out.println(p.name);

System.out.format("%-25s%12d%10d%10d%10d", p.name, p.category, p.fscore, p.sscore, p.tscore);

System.out.println();

}

System.out.println(" ========================================================================= ");

  

//System.out.println(playersList);

  

// Q2

System.out.println("TASK #2");   

System.out.println(" ========================================================================= ");

System.out.format("%-25s%10s%10s", " NAME", "GRADE LEVEL", "ROUND AVERAGE");

System.out.println(" ========================================================================= ");

Collections.sort(playersList);

double avg = 0; // For calculating average

// Printing

for (Players p : playersList) {

//for (String[] player : p) {

//System.out.println(p.name);

avg = ((double)p.fscore + p.sscore + p.tscore)/3;

if (avg >= 85) {

System.out.format("%-25s%10s%10.5s", p.name, p.category, avg);

System.out.println();

}

}

System.out.println(" ========================================================================= ");

  

//Q3

System.out.println("TASK #3");   

System.out.println(" ========================================================================= ");

//System.out.format("%-25s%10s%10s", " NAME", "GRADE LEVEL", "ROUND AVERAGE");

System.out.println(" All Eligible Students in Category 1 are: ");

  

//double avg = 0; // For calculating average

// Printing

int eligiblecountround1 = 0;

for (Players p : playersList) {

//for (String[] player : p) {

//System.out.println(p.name);

avg = ((double)p.fscore + p.sscore + p.tscore)/3;

if (avg >= 85 && p.category == 1) {

//System.out.format("%-25s%10s%10.5s", p.name, p.category, avg);

eligiblecountround1++;

System.out.println(p.name);

}

}

System.out.println(" ========================================================================= ");

  

//Q4

System.out.println("TASK #4");   

System.out.println(" ========================================================================= ");

//System.out.format("%-25s%10s%10s", " NAME", "GRADE LEVEL", "ROUND AVERAGE");

System.out.println(" All Eligible Students in Category 2 are: ");

  

//double avg = 0; // For calculating average

// Printing

int eligiblecountround2 = 0;

for (Players p : playersList) {

//for (String[] player : p) {

//System.out.println(p.name);

avg = ((double)p.fscore + p.sscore + p.tscore)/3;

if (avg >= 85 && p.category == 2) {

//System.out.format("%-25s%10s%10.5s", p.name, p.category, avg);

eligiblecountround2++;

System.out.println(p.name);

}

}

System.out.println(" ========================================================================= ");

  

System.out.println("TASK #5");   

System.out.println(" ========================================================================= ");

//System.out.format("%-25s%10s%10s", " NAME", "GRADE LEVEL", "ROUND AVERAGE");

System.out.println(" Number of Eligible students in Round 1 are: ");

System.out.println(eligiblecountround1);

  

System.out.println(" ========================================================================= ");

  

System.out.println("TASK #6");   

System.out.println(" ========================================================================= ");

//System.out.format("%-25s%10s%10s", " NAME", "GRADE LEVEL", "ROUND AVERAGE");

System.out.println(" Number of Eligible students in Round 2 are: ");

System.out.println(eligiblecountround2);

  

System.out.println(" ========================================================================= ");

  

  

}

}

=================================================

Output:

TASK #1

=========================================================================

NAME GRADE LEVEL ROUND 1 ROUND 2 ROUND 3
=========================================================================

ZimmermanD 1 88 75 76
RegoneN 1 100 96 100
BrennonT 1 74 80 85
MouseM 1 87 83 90
ByrdT 2 78 77 80
WashingtonD 1 95 76 76
EricX 2 83 93 95
HouseS 1 91 71 91
ShawI 2 74 71 91
BarberP 1 88 85 92
CharlesD 2 86 95 81
DunlapK 2 91 95 70
JoeS 1 84 93 71
MatthewD 2 81 89 75
BrianW 1 98 74 71
RichardC 2 96 100 98
SahanaG 1 87 89 88
MichaleF 2 94 88 96
AarushiA 1 74 77 74
SahanaG 2 70 73 79

=========================================================================

TASK #2

=========================================================================

NAME GRADE LEVELROUND AVERAGE
=========================================================================

BarberP 1 88.33
CharlesD 2 87.33
DunlapK 2 85.33
EricX 2 90.33
MichaleF 2 92.66
MouseM 1 86.66
RegoneN 1 98.66
RichardC 2 98.0
SahanaG 1 88.0

=========================================================================

TASK #3

=========================================================================


All Eligible Students in Category 1 are:

BarberP
MouseM
RegoneN
SahanaG

=========================================================================

TASK #4

=========================================================================


All Eligible Students in Category 2 are:

CharlesD
DunlapK
EricX
MichaleF
RichardC

=========================================================================

TASK #5

=========================================================================


Number of Eligible students in Round 1 are:

4

=========================================================================

TASK #6

=========================================================================


Number of Eligible students in Round 2 are:

5

=========================================================================