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...
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 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...
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...
XML and JAVA Write a Java program that meets these requirements. It is important you follow...
XML and JAVA Write a Java program that meets these requirements. It is important you follow these requirements closely. • Create a NetBeans project named LastnameAssign1. Change Lastname to your last name. For example, my project would be named NicholsonAssign1. • In the Java file, print a welcome message that includes your full name. • The program should prompt for an XML filename to write to o The filename entered must end with .xml and have at least one letter...
Please write a java code. Write a generic program for New Home Construction Pricing with the...
Please write a java code. Write a generic program for New Home Construction Pricing with the following specifications. Note, each one of the 2, 3 or 4 bedroom homes are priced with standard type bathrooms. Update to deluxe or premium choice of bathrooms can be ordered by paying the difference in prices.    Types of homes Price 2 bedroom, 2 bathroom (standard type) and 1 car garage home = $350,000 3 bedroom, 2 bathroom (standard type) and 2 car garage...
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