Question

In: Computer Science

Write a method in JAVA to do the following: As the user to select from 2...

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();
   }
}

Solutions

Expert Solution


Related Solutions

JAVA: Write a program to perform time conversion. The user will select from the following menu:...
JAVA: Write a program to perform time conversion. The user will select from the following menu: Hours to minutes Days to hours Minutes to hours Hours to days. Each choice has a separate method which is called when the user makes the selection. Please see the output below: Hours to minutes. 2. Days to hours. 3. Minutes to hours. 4. Hours to days. Enter your choice: 2 Enter the number of days: 5 There are 120 hours in 5 days.
IN JAVA PROGRAMMING Write a complete Java program to do the following: a) Prompt the user...
IN JAVA PROGRAMMING Write a complete Java program to do the following: a) Prompt the user to enter the name of the month he/she was born in (example: September). b) Prompt the user to enter his/her weight in pounds (example: 145.75). c) Prompt the user to enter his/her height in feet (example: 6.5). d) Display (print) a line of message on the screen that reads as follows: You were born in the month of September and weigh 145.75 lbs. and...
IN JAVA PROGRAMMING Write a complete Java program to do the following: a) Prompt the user...
IN JAVA PROGRAMMING Write a complete Java program to do the following: a) Prompt the user to enter a six-digit integer. b) Take the integer and break it up into two pieces of three-digits each (make sure you keep the order of digits). c) Display each 3-digit piece on a separate line with a proper message before each piece. For example, if the user enters  450835 as the integer, then the program should display the following output: Right 3-digit piece: 835...
Write a Java program to do the following: Specifics: Write an application that prompts a user...
Write a Java program to do the following: Specifics: Write an application that prompts a user for two integers and displays every integer between them. Display a message if there are no integers between the entered values. Make sure the program works regardless of which entered value is larger. Save the file as InBetween.java. Don’t forget to create the application/project  InBetweenTest.java Class that has the main method and an object to use the InBetween class.
Create a java program that will do the following: Create a method called getInt.Allow the user...
Create a java program that will do the following: Create a method called getInt.Allow the user to enter up to 20 student names,and for each student 3 quiz scores (in the range 0-100). Once input is done, display each student’s name, their three quiz scores, and their quiz score average, one student per line. The output table does not need to line up perfectly in columns.Use dialog boxes for all input and output.Use the method to input the three scores.Parameter...
Write a method in JAVA that does this: Presents the user with a header stating this...
Write a method in JAVA that does this: Presents the user with a header stating this is for assignment: Lab, and the names Bob and Bill Present the user with a menu to run a random method(just make this a dummy method) , another random method method,(just make this a dummy method) or another dummy method (just make this a dummy method) Repeat the menu until the user enters -1.
2. Write a Java program to read a string (a password)from the user and then   check...
2. Write a Java program to read a string (a password)from the user and then   check that the password conforms to the corporate password policy.   The policy is:   1) the password must be at least 8 characters   2) the password must contain at least two upper case letters   3) the password must contain at least one digit   4) the password cannot begin with a digit   Use a for loop to step through the string.   Output “Password OK” if the password...
IN JAVA Write a MAIN METHOD that asks for user input of a positive integer and...
IN JAVA Write a MAIN METHOD that asks for user input of a positive integer and a negative integer validates the inputs using a loop and then calls the METHOD from Question 3 and prints the result. The MAIN should have two variables (appropriately typed), get the input from the user and store them in the variables after validating them, then call the method from question 3 (sending parameters, if necessary) and print the returned value with an appropriate descriptive...
Write a Java program to do the following: Ask the user to enter 10 first names...
Write a Java program to do the following: Ask the user to enter 10 first names (one word - no hyphen or apostrophe) using the keyboard. 1) Display the list of names one per line on the Console. 2) Display the names again, after eliminating duplicates using a HashSet (Your code MUST use HashSet).
Java Programing Write a program called reverseProg.   This program will do the following Asks the user...
Java Programing Write a program called reverseProg.   This program will do the following Asks the user to input a string, it reads the string and does the followings Prints the string in reverse order. Displays the characters that are in position 7th, 8th and 9th of this string Displays the length of the string Displays the string in all UPPER CASE Sample output example: Enter a string: Wilmington University String Entered is: Wilmington University Wilmington University spelled backward is: ytsirevinU...
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT