Guest User

Untitled

a guest
May 15th, 2018
53
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 1.44 KB | None | 0 0
  1. /* Ask for user input. Their input must be added to an array named "ints". Only ints are allowed in this one.
  2.  * Then ask for user input again and add their input to an array named "doubles". This array must only be doubles.
  3.  * Then ask for user input again and add their input to a float named "String". Must only be Strings in this array.
  4.  *
  5.  * Repeat this 3 times.
  6.  * if any of the numbers in the int array do NOT evenly divide by 5, print: #here# "Not this one!"
  7.  * Print each array. Only have 1 value of the array per line. For example:
  8.  * String Array:
  9.  * dog
  10.  * cat
  11.  *
  12.  * int Array:
  13.  * 12
  14.  * 13
  15.  *
  16.  * double Array:
  17.  * 12.5
  18.  * 32.61
  19.  *
  20.  * NOTE: Make sure to use as many classes as possible for practice.
  21.  * -------------
  22.  * Once done with this assignment, try to create a calculator and a tic-tac-toe board using arrays.
  23.  */
  24.  
  25. package practiceProblem2;
  26.  
  27. import java.util.Scanner;
  28.  
  29. public class Main {
  30.     public static void main(String[] args) {
  31.         userInput();
  32.        
  33.     }
  34.    
  35.    
  36.    
  37.    
  38.    
  39.    
  40.     public static void userInput() { // need to figure out how to do user input.
  41.             Scanner sc = new Scanner(System.in);
  42.             String stringUI = System.out.println("Please input a String: ");
  43.             String st = sc.nextLine();
  44.             String[] sInputArray;
  45.             for (int x = 1; x <= 3; x++) {
  46.                 String[] sInputArray = new String[stringUI];
  47.                 System.out.println("String added to sInputArray.");
  48.            
  49.             sc.close();
  50.             }
  51.     }
  52. }
Add Comment
Please, Sign In to add comment