Java gibt mehrere Zeichenfolgen in einer Methode zurückJava

Java-Forum
Anonymous
 Java gibt mehrere Zeichenfolgen in einer Methode zurück

Post by Anonymous »

Ich versuche, ein Programm zu schreiben, das den Benutzern fragt, was ihr Haustiername ist, Spezies, findet Durstniveau und gibt eine Antwort entsprechend. Sag mir, was ich falsch mache oder mich in die richtige Richtung zeige.class dinoo
{
public static void main(String[] p)
{

explain();
output();

System.exit(0);
< /code>

} < /p>

public static void explain()
{

print("The following program demonstrates use of user input by asking for pet name.");

return;
}

public static String askpetname()
{
Scanner scanner = new Scanner(System.in);

print("Name your dinosaur pet!");

String petname = scanner.nextLine();

print("Awesome, cool dinosaur name, what species is " + petname+ " ?");

String petspecies = scanner.nextLine();

return petname, petspecies;
}

public static int thirstlevel()
{
Random ran = new Random();

int thirst = ran.nextInt(11);
int hunger = ran.nextInt(11);

return thirst,hunger;
}

public static String anger(int thirst, int hunger)
{
double angerscore = (thirst+hunger)/2;
String temper;

if(angerscore

Quick Reply

Change Text Case: 
   
  • Similar Topics
    Replies
    Views
    Last post