Question

In: Computer Science

Write a program in Java for: Starting a brand new term, you decide you want to...

Write a program in Java for:

Starting a brand new term, you decide you want to make a good impression on your instructor. To do this, you want to create an application that helps process midterm exam scores, letting the instructor know which student(s) earned the lowest score so the instructor can suggest some extra help resources.

To begin, initialize two parallel arrays (hardcoding the values):

  • Names: Joey, Lisa, Karen, Mark, Christopher, etc.
  • Scores: 78.5, 97.0, 42.5, 86.5, 42.5, etc.

Once you have initialized the parallel arrays with values, display the lowest score and the student(s) with that score. Note more than one student may be “tied” for the lowest score. Your application should handle this.

An example run of the program, assuming usage of the data identified above is:

Example Run:
The lowest midterm score was 42.5.

The student(s) that earned this score:

Karen

Christopher

The student(s) may benefit from extra help.

Note: Make sure your application uses good design practices, such as using methods other than main().

For output, you must use the JOptionPane class.

Solutions

Expert Solution

import javax.swing.JOptionPane;

public class findinglowestscore{
public static ArrayList<String> findnames(double[] marksarray,double lowestmarks,String[] namesarray)
{ArrayList<String> namesofstudents=new ArrayList<String>();
for(int i=0;i<marksarray.length;i++)
{if(marksarray[i]==lowestmarks)
namesofstudents.add(namesarray[i]);
  
}
return namesofstudents;
}
public static void main(String[] args){
String[] names=new String[] {"joey","Lisa","Karen","Mark","Christopher"};
double[] marks=new double[] {78.5,97.0,42.5,86.5,42.5};
double minmarks=Integer.MAX_VALUE;
for(int j=0;j<marks.length;j++)
{minmarks=Math.min(marks[j],minmarks);
  
}
  
ArrayList<String> name=findnames(marks,minmarks,names);
  
String s="";
for(String na:name)
s=s+na+"\n";
JOptionPane.showMessageDialog(null, "The lowest midterm score was"+minmarks+".\nThe student(s) that earned this score:\n"+s);
}

}


Related Solutions

I want to write this program in java. Write a simple airline ticket reservation program in...
I want to write this program in java. Write a simple airline ticket reservation program in java.The program should display a menu with the following options: reserve a ticket, cancel a reservation, check whether a ticket is reserved for a particular person, and display the passengers. The information is maintained on an alphabetized linked list of names. In a simpler version of the program, assume that tickets are reserved for only one flight. In a fuller version, place no limit...
Write a java program that asks the user for the starting X and Y position of...
Write a java program that asks the user for the starting X and Y position of a mouse cursor as well as the starting X and Y movement, then prints out its position until X < 0 or X >100 Example 2: Enter the starting X position: 60 Enter the starting Y position: 60 Enter the starting X velocity: 4.7 Enter the starting Y velocity: 1 X:60    Y:60 X:64.7 Y:61 X:69.4 Y:63 X:74.1 Y:65 X:78.8 Y:67 X:83.5 Y:69 X:88.2 Y:71...
What we want the program to do: We need to write a program, in Java, that...
What we want the program to do: We need to write a program, in Java, that will let the pilot issue commands to the aircraft to get it down safely on the flight deck. The program starts by prompting (asking) the user to enter the (start) approach speed in knots. A knot is a nautical mile and is the unit used in the navy and by the navy pilots. After the user enters the approach speed, the user is then...
Write a JAVA program that allow a user to enter 2 number, starting point and end...
Write a JAVA program that allow a user to enter 2 number, starting point and end point. For example a user me enter 1 and 100. Your program will Add numbers from 1 to 100, add all the even number, and add all the odd numbers Output: The sum of number 1 to 100 is: The sum of even number 1 to 100 is: The sum of odd number 1 to 100 is:
Write a program in Java to: Ask the user how many scores they want to enter...
Write a program in Java to: Ask the user how many scores they want to enter (=> Create an array based the entered size) Ask the user to enter their scores in the quarter (Fill the array with the entered scores(assigned to elements)) ==>> Use a "for" loop Find the greatest score Calculate and show the average Show the final grade based on the average (For example A,B,C ... ) Print the scores (the elements of the array) => Use...
Write a Java program that will first ask the user how many grades they want to...
Write a Java program that will first ask the user how many grades they want to enter. Then use a do…while loop to populate an array of that size with grades entered by the user. Then sort the array. In a for loop read through that array, display the grades and total the grades. After the loop, calculate the average of those grades and display that average. Specifications Prompt the user for the number of grades they would like to...
Write the program in java Write a program that does basic encrypting of text. You will...
Write the program in java Write a program that does basic encrypting of text. You will ask the user the filename of a text file which contains a few sentences of text. You will read this text file one character at a time, and change each letter to another one and write out to an output file. The conversion should be done a -> b, b->c , … z->a, A->B, B->C, …. Z->A. This means just shift each letter by...
Based on three criteria of Performance, Price, and Brand, we want to decide to by a...
Based on three criteria of Performance, Price, and Brand, we want to decide to by a computer. According to our preferences, the weights of the criteria are 0.581, 0.309, and 0.110, respectively. A study comparing three personal computers of hp. Asus, and Apple resulted in the following pairwise comparison matrix for the performance criterion: Apple 12 1/2 Performance ap Asus Apple Asus 3 1/3 1/2 According to the Analytical Hierarchy Process (AHP) method, (use three decimals in your calculations, for...
If you were starting a new job, would you want to be paid at the top...
If you were starting a new job, would you want to be paid at the top of your pay range or in the middle? What are the advantages and disadvantages to both? Provide an explanation for your response. Support your response with an APA cited reference(s).
You are a new blue jeans manufacturer and is starting operations this month. You must decide...
You are a new blue jeans manufacturer and is starting operations this month. You must decide on which cost accounting system to use in order to account for your manufacturing costs. You can choose from using the job order cost system or the process cost system. What system would you choose and why? Please be detailed in your answer as to why you chose the specific system.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT