Only using three methods (including main) and an array of 10 whole numbers, I need to create a program that does these stuff:    Count how many people who passed the exam.  Print the statistics. (eg. grade A, B, C, D, E...) How many people passed or failed their exam.    Here's what I have right now. The only problem I have is that I don't know how to return multiple values.   public class Array10PassFail  public static int countPass (int [] num) {     int count = 0;     int counter = 0; for (int i = 0; i &lt; num.length; i++)     {         if (num [i] &gt;= 50)         {             count++;         }         else if (num [i] &lt; 50)         {             counter++;         }     }  return count; }    public static int printStats (int [] num) {     int aTotal = 0, bTotal = 0,cTotal = 0, dTotal = 0, eTotal = 0;     for (int i = 0; i &lt; num.length; i++)     {         if (num[i] &gt;= 80)         {             aTotal++;         }         else if (num[i] &gt;= 70)         {             bTotal++;         }         else if (num[i] &gt;= 60)         {             cTotal++;         }         else if (num[i] &gt;= 50)         {             dTotal++;          }         else if (num[i] &lt; 50)         {             eTotal++;          }     }     return aTotal; }  public static void main (String [] args)  {     Scanner sc = new Scanner(System.in);       int [] num = new int [10];      for (int i = 0; i &lt; num.length; i++)     {         System.out.print("Enter score: ");          num[i] = sc.nextInt();      }      int passf = countPass(num);      System.out.println("There are " + passf + " people who passed and " + ??? + " who failed. ");  }
I want to return two objects from a Java method and was wondering what could be a good way of doing so?  The possible ways I can think of are: return a HashMap (since the two Objects are related) or return an ArrayList of Object objects.  To be more precise, the two objects I want to return are (a) List of objects and (b) comma separated names of the same.  I want to return these two Objects from one method because I dont want to iterate through the list of objects to get the comma separated names (which I can do in the same loop in this method).  Somehow, returning a HashMap does not look a very elegant way of doing so.
How to batch watermark JPG files? I have around 15,000 JPG files that need to be watermarked. Is there any way to process these images en masse and add a watermark?  The images may be different sizes, I want the watermark placed in the center of the images. How do I align an image to centre? How do I align an image to centre?  In a beamer presentation I have a 2-3 items on a slide followed by an image. The image is not wide enough to cover whole slide, so it leaves around 30% space from right. How do I adjust it to leave enough space on both sides?  \begin{frame} \frametitle{Outlook} \begin{itemize} \item apps \item apps \item apps \includegraphics[scale=0.3]{P2P}     \end{itemize} \end{frame} In fact, of these, only Charcoal shows a recent time stamp. Prove that $\sum_{n=2}^\infty (\ln n)^{- \ln n}$ converges As the title suggests, I'd like to prove that the sum $$ \sum_{n=2}^\infty (\ln n)^{- \ln n} $$ is finite.  The root and ratio test both fail here, but  suggests that there is a comparison that can be used to show convergence.  The only thought I have is that it may help to write the terms as $e^{-\ln(n)\ln(\ln(n))}$, but this has not led me to any particular insight.  Any ideas are appreciated. How would you implement an LRU cache in Java? Please don't say EHCache or OSCache, etc. Assume for purposes of this question that I want to implement my own using just the SDK (learning by doing). Given that the cache will be used in a multithreaded environment, which datastructures would you use? I've already implemented one using  and , but I'm curious if any of the new concurrent collections would be better candidates.  UPDATE: I was just reading through  when I found this nugget:     If you need constant-time access and want to maintain the insertion order, you can't do better than a LinkedHashMap, a truly wonderful data structure. The only way it could possibly be more wonderful is if there were a concurrent version. But alas.   I was thinking almost exactly the same thing before I went with the LinkedHashMap + Collections#synchronizedMap implementation I mentioned above. Nice to know I hadn't just overlooked something.  Based on the answers so far, it sounds like my best bet for a highly concurrent LRU would be to extend  using some of the same logic that LinkedHashMap uses. I'm not asking the diagonal values, but the length and breadth ones of the Nexus 7. And only of the LCD screen, not the entire hardware. Lyman and Balmer series Verb form of "must needs" Then touching the shoulder of a townsman who stood near to him, he addressed him in a formal and courteous manner:      "I pray you, good Sir," said he, "who is this woman? -- and wherefore is she here set up to public shame?"      "You must needs be a stranger in this region, friend," answered the townsman, looking curiously at the questioner and his savage companion, "else you would surely have heard of Mistress Hester Prynne and her evil doings. She hath raised a great scandal, I promise you, in godly Master Dimmesdale's church. "   As far as I know we always use first form of the verb after "must". For instance: "You must go". We never say "You must goes". Also, we never use -s/es with a verb that comes with "You". What are the circumstances in which writer has used "needs" after "You must" in "You must needs to be a stranger in this region."? Why is there no analog for $\Theta_\text{QCD}$ for the weak interaction? Is this topological term generated? If not, why not? Is this related to the fact that $SU(2)_L$ is broken? How do you setup a TeX document to self publish a book online? I am a casual TeX user. Mostly I have used it to type up some reports/homeworks for class in my graduate engineering work. In the past I have used document type "article". And then kept all the defaults.  I need to self publish something online. At the highest level I would like to know: How do you setup a TeX document to self publish a book online?  Some more low level questions:   Is there a document type for "book" and what is its name? I am looking at Amazon Createspace. : filetype=pdf, trim size, margins (gutter and outside margins). All of these various trim size, margins gutter/outside can be adjusted in the Tex document?   Has anyone seen any good TeX templates for Amazon Createspace? If you could demonstrate how to tweak a specific "book" document type that would be very helpful also.    Other than the above questions, please feel free to offer any other sort of help since I am completely new to this process (advice, links to good tutorials, links to wikibooks). What is Quantization? Uploading both data and files in one form using Ajax? How do I uninstall Ubuntu? How do I format drive and unistall Ubuntu 11.10?  I wanted a dual boot and was given an option to overwrite Windows XP partition and said yes.  Format options don't work.  I tried a few dos prompts and probably not using correct fdisk.  Format options state drive is busy closed all windows.  Tried to boot windows XP and disk says its corrupt. Many To Many Relationships If you have two envelopes, and ... Singular values of the data matrix and eigenvalues of the covariance matrix Does an Action Surge grant a second bonus action? We were trying to understand how the "Action Surge" rule works, and after some discussion we came to a standstill.      Starting at 2nd level, you can push yourself beyond your normal limits for a moment. On your turn, you can take one additional action on top of your regular action and a possible bonus action   The keyword "possible" is what threw us off. Half the group thought it meant "additional action or bonus action", and the other half thought it was "additional action and bonus action".  So which is it? Can I make an ender portal on creative? I've updated Minecraft PE, and in the update notes it states that they've added the End. But when I made a new creative world and built a portal, it didn't work.  I've been looking online at tutorials, but cannot get the portal to open. So how do you create an Ender Portal? Low-RAM Linux Distro Specifically for serving static sites How to handle a native OS (Ubuntu) file upload window in selenium webdriver with python? This is my first time here but I have already posted this question on SO. I keep getting solutions for Windows + Java and not for Linux or python for that matter.  I am using Selenium and Python to automate a file upload application for the past many hours but nothing helpful!   The HTML DOM structure for this file upload is an input tag with its type attribute value = 'file'. I know I can make use of the send_keys.   The problem is I am not supposed to use send_keys() (as per the question I am trying to solve). The assumption is there are other ways of doing it.  Can anyone suggest me alternative ways to upload the file? I do get solutions for windows but not for Linux(Ubuntu). I know there are applications/tools to automate GUI components like AutoIt but there is nothing for Linux close to AutoIt.  I can say I have done my homework to find a solution. Only after not finding anything useful, I am asking this question, please help!