Question

In: Computer Science

Write a java code that could be used to show the simulation of a tornado. use...

Write a java code that could be used to show the simulation of a tornado. use the understanding of the mix of low temperature and high temperature wind go create a spinning vortex.

***POSTED INCORRECT QUESTION**
here is the real question:
plz write a simple java code to show a spinning circle of particles.

Solutions

Expert Solution

ain.java:

import java.util.Scanner;
import games.Spin;

public class Mains {
    //Declaring Scanner object as console.
    static Scanner console = new Scanner(System.in);
    //Declaring Spin game object as spin
    static Spin spin = new Spin();

    //Available games array
    static String[] content = {"spin", "tof"};
    //Navigation options array
    static String[] navigateGame = {"start", "back"};

    public static void main (String[] args) {

        // Setting the default number for inputNumber
        int inputNumber = 0;

        // Setting the defult value for inputString
        String inputString = "";

        // The main game loop
        boolean game = true;

        // Spin game loop
        boolean spinGame = false;

        // Truth or false game loop
        boolean tofGame = false;            

        System.out.print("Welcome! Please select a game: ");
        for (int i = 0; i < content.length; i++) {
            System.out.print(content[i]);
            if (i < content.length -1) {
                System.out.print(", ");
            }
        }

        //New line..
        System.out.println();

        //The main game loop
        while (game) {

            //This is the input we will enter to the console.
            inputString = console.nextLine();

            //If we are not in any of the games..
            if (!spinGame && !tofGame) {
                //Looping through the array
                for (String s : content) {
                    //If the entered input, contains any word that is in the array, enter switch statement, to find out which word was it.
                    if (inputString.equalsIgnoreCase(s)) {
                        //Entering switch statement to find out which of the values matched in the array.
                        switch (inputString) {
                            //Spin game match
                            case "spin":
                                //Start spin game
                                spinGame = true;
                            break;

                            //Tof game match.
                            case "tof":
                                //Start tof game
                                tofGame = true;                        
                            break;                            
                        }
                        //Getting out of the for loop, so we won't get could not find game error after match found.
                        break;
                    } else {
                        //No match found, throw error.
                        System.out.println("Could not find game!");
                        //Break out of the loop.
                        break;
                    }
                }                
            }

            /*
            * Spin Game Start
            */


            //Setting up the text once user entered the game.

            if (spinGame) {
                System.out.println("Welcome to the spin game!");
                System.out.println("Please enter 'start' to start and 'back' to go back.");
            }

            /*
            * Main Spin Game loop
            */

            while (spinGame) {

                //This is the input we will pass the console.
                inputString = console.nextLine();

                //Looping through the array for selected navigation option.
                for (String s : navigateGame) {
                    //Checking if the entered value contains any word inside the navgiation options array.
                    if (inputString.equalsIgnoreCase(s)) {
                        //Entering the switch statement to find out what word.
                        switch (inputString) {

                            //Case start game
                            //This will spin the wheel once, and tell results.
                            case "start":
                                //Printing the spinned value frm spinWheel().
                                System.out.println(spin.spinWheel());
                                //Setting the console to receive more inputs.
                                inputString = console.nextLine();
                            break;

                            //Case back
                            //This will go back to the lobby.
                            case "back":
                                //Quit spinGame.
                                spinGame = false;
                                //Back to the top of the method.
                                main(args);
                            break;
                        }
                    }
                }
            }
        }
    }
}

Related Solutions

Java code. You will need to make classes that could be used to stage a battle...
Java code. You will need to make classes that could be used to stage a battle as described below. You have been tasked to create a number of items that can be used in an online game. All items can be used on a game character who will have a name, a number of health-points and a bag to hold the items.   Here are examples of items that can be made: Item type of item effectOnHealth other info Widow's Cloak...
Code in Java, Use both Set and TreeSet to show the differences between the Set and...
Code in Java, Use both Set and TreeSet to show the differences between the Set and TreeSet that Set still remove the duplicate but won't sort the elements. Create a class named DictionaryWord as: DictionaryWord - word: String                                                              - meanings: String + DictionaryWord (String word, String meanings) + getWord(): String + setWord (String word): void + getMeanings(): String + setMeanings(String meanings): void Write a program with the following requirements: Creates 8 DictionaryWord objects with: Word and meanings as the...
USE GENERICS TO WRITE THE JAVA CODE FOR THIS ASSIGNMENT In this assignment, rewrite two of...
USE GENERICS TO WRITE THE JAVA CODE FOR THIS ASSIGNMENT In this assignment, rewrite two of the following sorting methods (Insertion Sort, Selection Sort, Quick Sort, and Merge Sort) to sort ArrayList of objects using Comaprable interface. (60 points)
Code in Java, Use both Set and TreeSet in only one main to show the differences...
Code in Java, Use both Set and TreeSet in only one main to show the differences between the Set and TreeSet that Set still remove the duplicate but won't sort the elements. Create a class named DictionaryWord as: DictionaryWord - word: String                                                              - meanings: String + DictionaryWord (String word, String meanings) + getWord(): String + setWord (String word): void + getMeanings(): String + setMeanings(String meanings): void Write a program with the following requirements: Creates 8 DictionaryWord objects with: Word...
Create a new Java program named AllAboutMe (For JAVA we use blue J) Write code to...
Create a new Java program named AllAboutMe (For JAVA we use blue J) Write code to have the program print your name, favorite color, and three hobbies to a new text file called “AllAboutMe” using PrintStream. Submit code.
JAVA programming - please ONLY answer prompts with java code *Inheritance* will be used in code...
JAVA programming - please ONLY answer prompts with java code *Inheritance* will be used in code Classwork A zoo is developing an educational safari game with various animals. You will write classes representing Elephants, Camels, and Moose. Part A Think through common characteristics of animals, and write a class ZooAnimal. ☑ ZooAnimal should have at least two instance variables of different types (protected), representing characteristics that all animals have values for. ☑ It should also have at least two methods...
Please show screenshot outputs and fully functional code for the Java program. Write the following methods...
Please show screenshot outputs and fully functional code for the Java program. Write the following methods to   1) read the content of an array of 5 doubles public static double[] readingArray() 2) find and print:the smallest element in an array of 5 double public static void smallest(double [] array) 3) find and print:the largest element in an array of 5 doubles pubic static void largest (double [] array) In the main method - invoke readingArray and enter the following numbers...
JAVA CODE FOR BEGINNERS!! DON'T USE FOR OR WHILE METHODS PLEASE! Write a program that reads...
JAVA CODE FOR BEGINNERS!! DON'T USE FOR OR WHILE METHODS PLEASE! Write a program that reads three strings from the keyboard. Although the strings are in no particular order, display the string that would be second if they were arranged lexicographically.
Write a simple Java code to make a Binary Tree for the following tree: Don’t use...
Write a simple Java code to make a Binary Tree for the following tree: Don’t use serializable interface implantation /** Class to encapsulate a tree node. */ protected static class Node implements Serializable {
Write a java code snippet that allows a teacher to track her students’ grades. Use a...
Write a java code snippet that allows a teacher to track her students’ grades. Use a loop to prompt the user for each student’s name and the grade they received. Add these values to two separate parallel ArrayLists. Use a sentinel to stop. Output a table listing each of the student’s names in one column and their associated grades in the second column.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT