Please help with this JAVA PROGRAMMING 1 Assignment. This is the instructions and the code I have done so far. Please help figure out what to do next. I am so stuck. Thank you. You are creating a database of fey creatures found in Western Arkansas. Your data includes the creature's species, description, diet, and difficulty to catch. Include the following in your database: Species Description Diet Danger Level Times Caught Sprite Small winged humanoid berries medium 1 Goblin Common evil fey Omnivorous medium 5 Troll Large, dangerous, ugly humanoids high 1 Boggart Mischievous teleporting goblin-like creature stolen pies low 4 Gnome Small, shy, burrowing burrowing critters low 2 Dryad tree-maiden spirit tied to a forest unknown medium 0 Using one or more arrays, display this list. Modify the program so the user enters a number. Then, display all the creatures (and their info) who have been caught at least that many times. In addition to the above, allow the user to enter the name of a creature. If that creature is in the list, add one to the number of times that creature has been caught and display the list again. Otherwise, let the user know it isn't in the list. import java.util.*; public class FirstDatabase { public static void main (String args[]) { Scanner kb = new Scanner(System.in); System.out.println("How many fiends would you like to enter?"); int friends = kb.nextInt(); kb.nextLine(); System.out.println(); //array for user input //String array for names of friends String[] names = new String [friends]; //array to store ages int ages [] = new int [friends]; //array to store addresses String[] addresses = new String [friends]; for (int i=0; i
Please help with this JAVA PROGRAMMING 1 Assignment. This is the instructions and the code I have done so far. Please help figure out what to do next. I am so stuck. Thank you.
You are creating a
Species | Description | Diet | Danger Level | Times Caught |
Sprite | Small winged humanoid | berries | medium | 1 |
Goblin | Common evil fey | Omnivorous | medium | 5 |
Troll | Large, dangerous, ugly | humanoids | high | 1 |
Boggart | Mischievous teleporting goblin-like creature | stolen pies | low | 4 |
Gnome | Small, shy, burrowing | burrowing critters | low | 2 |
Dryad | tree-maiden spirit tied to a forest | unknown | medium | 0 |
Using one or more arrays, display this list.
Modify the program so the user enters a number. Then, display all the creatures (and their info) who have been caught at least that many times.
In addition to the above, allow the user to enter the name of a creature. If that creature is in the list, add one to the number of times that creature has been caught and display the list again. Otherwise, let the user know it isn't in the list.
import java.util.*;
public class FirstDatabase {
public static void main (String args[])
{
Scanner kb = new Scanner(System.in);
System.out.println("How many fiends would you like to enter?");
int friends = kb.nextInt();
kb.nextLine();
System.out.println();
//array for user input
//String array for names of friends
String[] names = new String [friends];
//array to store ages
int ages [] = new int [friends];
//array to store addresses
String[] addresses = new String [friends];
for (int i=0; i<friends; i++)
{
//user input for names
System.out.print("Please enter the name of friend "+(i+1)+":");
names[i] = kb.nextLine();
//user input for age
System.out.print("Please enter the age of friend "+(i+1)+":");
ages[i] = kb.nextInt();
kb.nextLine();
//user input for addresses
System.out.print("Please enter the address of friend "+(i+1)+":");
addresses[i] = kb.nextLine();
System.out.println();
}
//format for table display
Formatter chart = new Formatter();
System.out.println();
System.out.println("Information Chart");
chart.format("%5s%15s%25s\n","Name","Age","Address");
for (int i=0; i<friends; i++)
{
chart.format("%5s%15s%25s\n",names[i], ages[i], addresses[i]);
}
//print statement for chart
System.out.println(chart);
}
}
Trending now
This is a popular solution!
Step by step
Solved in 2 steps