In: Computer Science
Write a method in JAVA to do the following:
As the user to select from 2 different (default) pokemon or load their pokemon by giving you the name of their pokemon.
Based on their selection (default or supplied name), read the move list and damage range from the input file(you do not need to create this) for the selected pokemon.
Randomly select one of the default pokemon - Bulbasaur, Charmander, Squirtle (or you can add additional computer only options if you want) and read the move list and damage range from the input file(you do not need to create this) for the selected pokemon.
Write the game loop to play your pokemon battle, which includes Your attack then computers attack and showing how much damage was done and your Pokemon's remaining hp until a winner is declared, but with the new move sets and random damage based from an outside input file.
With input file:
import java.io.File;
import java.io.FileNotFoundException;
import java.io.PrintWriter;
import java.util.Scanner;
public class PokemonData {
public static void main(String[] args) throws
FileNotFoundException {
Scanner sc = new
Scanner(System.in);
System.out.print("Enter pokemon
name: ");
String name = sc.nextLine();
PrintWriter pw = new
PrintWriter(new File(name+".txt"));
int i=0;
pw.write("Minimum
Maximum\n");
while(i<4) {
System.out.print("Enter minimum damage of move#"+(i+1)+": ");
int min =
Integer.parseInt(sc.nextLine());
System.out.print("Enter maximum damage of move#"+(i+1)+": ");
int max =
Integer.parseInt(sc.nextLine());
pw.write(min
+"\t\t\t"+max+"\n");
i++;
}
System.out.println("Data written to
the file "+name+".txt successfuly.");
pw.close();
sc.close();
}
}