Marketplace

Related Articles

More

Related Categories

Recently Added

More

Join StudyUp.com Today

It's always free and anyone can join!

Watch StudyUp Demo Video Now

You Recently Visited

Third Grade Writing Prompts

Katrina Said:

Write a Java application that contains three parallel arrays that hold 10 elements each.?

We Answered:

import javax.swing.JOptionPane;

public class StudentIDArray {

public static void main(String[] args) {
//Initialize arrays
String[] id = new String[]{"3432","9977",
"7321","7564",
"3463","0542","1232","9754",
"7754","2323"};
String[] names = new String[]{"A",
"Hello", "World", "B",
"C", "X", "Y", "Nicole", "Brenan", "Andy"};
double[] avg = new double[]{90.2, 95.1, 87.7, 84.6, 80.6,
81.1, 75.3, 84.5, 88.8, 90.1};

String studentId=null;

//Do not stop while input dialog is not null.
while((studentId=JOptionPane.
showInputDialog(null, "Enter Student ID")) != null){

boolean found = false;

//Match the entered student id against all ids.
for(int i=0; i<id.length; i++){
if(studentId.equals(id[i])){
JOptionPane.showMessageDialog
(null, "Name:" + names[i] + ", Average: "
+ avg[i], "Student",
JOptionPane.
INFORMATION_MESSAGE);
found = true;
break;
}
}

//If not found. display this.
if(! found){
JOptionPane.showMessageDialog
(null, "No match found.", "Student",
JOptionPane.
INFORMATION_MESSAGE);
}
}
}
}

Warren Said:

Admission essay for University of Chicago?

We Answered:

Too generic

Discuss It!