Small usefull program 11-23-2016, 08:08 PM
#1
So i was really bored had that idea to code something useful in small lines of code .
I ended up coding a small program to randomly choose a movies from some movies i choose why well it happens a lot to me that i have some movies to watch and can't choose which one to watch first.
your turn what can you code something useful in a max of 20 lines ?
I ended up coding a small program to randomly choose a movies from some movies i choose why well it happens a lot to me that i have some movies to watch and can't choose which one to watch first.
Spoiler:
Code:
import java.util.Scanner;
import java.util.Random;
public class Movies {
public static String[] chooseYourMovies(){
Scanner in=new Scanner(System.in);
in.useDelimiter("\\n");
System.out.println("how many movies you want to enter :");
String []movies=new String[in.nextInt()];
for(int i=0;i<movies.length;i++){
System.out.println(i);
movies[i]=in.next();}
return movies;}
public static void randomMovie(String[]movies){
Random rand=new Random();
System.out.println(movies[rand.nextInt(movies.length)]);}
public static void main(String[] args) {
randomMovie(chooseYourMovies());
}}your turn what can you code something useful in a max of 20 lines ?




![[+]](https://sinister.li/images/modern/collapse_collapsed.png)















