Python,C,C++ and JAVA programs for CBSE, ISC, B.Tech and I.T Computer Science and MCA students

The Programming Project: Random Quotes

Thursday, August 29, 2013

Random Quotes

This is a command line utility that prints a "Maths Quote of the Day" on the user's terminal when run.
User's types "java MathQuoteOFDay" on the command line
System prints out a quote.
import java.util.*;
public class MathsQuoteOFDay
    {
    public static void main(String[] args)
        {
        Quotes qts = new Quotes();
            int n = (int)(Math.random()*10);
            System.out.println("");
            System.out.println(qts.getQuote(n));   
            System.out.println("");        
        }
    }
class Quotes
    {
    Quotes()
        {
        }
    public String getQuote(int n)
        {
        return (quotes[n]);
        }
    private static String quotes[]={"I like mathematics because it is not human and has nothing particular to do with this planet or with the whole accidental universe                         - because like Spinoza's God, it won't love us in return.  ~Bertrand Russell",
                    "If there is a God, he's a great mathematician.  ~Paul Dirac",
                    "Do not worry about your problems with mathematics, I assure you mine are far greater. ~Albert Einstein",
                    "There are things which seem incredible to most men who have not studied mathematics. ~ Aristotle",
                    "Mathematics is a game played according to certain simple rules with meaningless marks on paper. ~ David Hilbert",
                    "Go down deep enough into anything and you will find mathematics~ Dean Schlicter",
                    " Life is good for only two things, discovering mathematics and teaching mathematics. ~ Simeon Poisson",
                    "In mathematics you don't understand things. You just get used to them. ~ Johann von Neumann",
                    " Medicine makes people ill, mathematics make them sad and theology makes them sinful. ~ Martin Luther",
                    "A man whose mind has gone astray should study mathematics. ~ Francis Bacon"};
    }

No comments:

Post a Comment