CONNEXION
  • RetourJeux
    • Sorties
    • Hit Parade
    • Les + populaires
    • Les + attendus
    • Soluces
    • Tous les Jeux
    • Gaming
  • RetourActu Gaming
    • News
    • Astuces
    • Tests
    • Previews
    • Toute l'actu gaming
  • RetourBons plans
    • Bons plans
    • Bons plans Smartphone
    • Bons plans Hardware
    • Bons plans Image et Son
    • Bons plans Amazon
    • Bons plans Cdiscount
    • Bons plans Decathlon
    • Bons plans Fnac
    • Tous les Bons plans
  • RetourJVTech
    • Actus High-Tech
    • Intelligence Artificielle
    • Smartphones
    • Mobilité urbaine
    • Hardware
    • Image et son
    • Tutoriels
    • Tests produits High-Tech
    • Guides d'achat High-Tech
    • JVTech
  • RetourCulture
    • Actus Culture
    • Culture
  • RetourVidéos
    • A la une
    • Gaming Live
    • Vidéos Tests
    • Vidéos Previews
    • Gameplay
    • Trailers
    • Chroniques
    • Replay Web TV
    • Toutes les vidéos
  • RetourForums
    • Hardware PC
    • PS5
    • Switch 2
    • Xbox Series
    • Switch
    • Pokemon pocket
    • FC 25 Ultimate Team
    • League of Legends
    • Tous les Forums
  • PC
  • PS5
  • Xbox Series
  • Switch 2
  • PS4
  • One
  • Switch
  • iOS
  • Android
  • MMO
  • RPG
  • FPS
En ce moment Genshin Impact Valhalla Breath of the wild Animal Crossing GTA 5 Red dead 2
Liste des sujets

Programmation java basic

Eleck4
Eleck4
Niveau 9
16 avril 2015 à 15:56:38

Yo tout le monde, j'ai un exercice qui me bloque depuis un moment, en faite j’ai réussi a faire le code mais je ne suis pas trop sur qu'il soit correcte. Donc j’espère que vous pourrez m'aider, merci d'avance. Voici le code

public class ComputerPersonStats {

public ComputerPersonStats() { }

public static void main (String[]args) {

int n = 1;
int nbFem = 0;
int nbHom = 0;
String firstName = "";
String lastName = "";
String Sex = "";
int Age = 0;
Scanner myScan = new Scanner (System.in);
while ( n <= 15) {
System.out.println ("Enter the person's first name please");
firstName = myScan.next();
System.out.println ("Enter the person's last name please");
lastName = myScan.next();
System.out.println ("the person's fullname is : " + firstName+ " " + lastName);
System.out.println ("Enter the person age in years please");
Age = myScan.nextInt();
System.out.println ("the age is : " + Age + " years old");
System.out.println ("Enter the sex of the person please");
Sex = myScan.next();
if (Sex.equals ("f")) {
System.out.println ("the person is a women");
nbFem ++; }
if (Sex.equals ("m")) {
System.out.println ("the person is a men");
nbHom ++;

}

}
System.out.println ("There are " + nbHom + " men and " + nbFem + " women");
}
}

Nh0j
Nh0j
Niveau 10
17 avril 2015 à 12:07:22

Lu,

http://pastebin.com/dSBdnELa

Sous forums
  • Aide à l'achat Mac
  • Création de sites web
  • Internet
  • Macintosh
  • Création de Jeux
  • Linux
  • Programmation
  • Steam Deck
  • Hardware
La vidéo du moment