IdentifiantMot de passe
Loading...
Mot de passe oublié ?Je m'inscris ! (gratuit)
Navigation

Inscrivez-vous gratuitement
pour pouvoir participer, suivre les réponses en temps réel, voter pour les messages, poser vos propres questions et recevoir la newsletter

Eclipse Java Discussion :

Besoin d'aide programmation algorithme


Sujet :

Eclipse Java

Vue hybride

Message précédent Message précédent   Message suivant Message suivant
  1. #1
    Candidat au Club
    Homme Profil pro
    Étudiant
    Inscrit en
    Novembre 2018
    Messages
    2
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : France, Essonne (Île de France)

    Informations professionnelles :
    Activité : Étudiant
    Secteur : High Tech - Éditeur de logiciels

    Informations forums :
    Inscription : Novembre 2018
    Messages : 2
    Par défaut Besoin d'aide programmation algorithme
    Bonjour à tous !

    Désolé de vous déranger mais voila j'ai un problème avec mon algorithme java qui ne cesse de me renvoyer des erreurs et après avoir fait le tour encore et encore, je ne pense pas pouvoir le résoudre seul, c'est pour cela que je vous demande de l'aide...

    Déja l'énnoncé :

    Ecrire un programme pour un marriage. Le programme collecte les informations suivantes :

    -Le nombre de personne
    -Le type de service

    Le hall vert peut accueillir jusqu'à 100 personnes (1000 euros)
    Le hall jaune peut accueillir jusqu'à 250 personnes (2000 euros)
    le hall rouge peut accueillir jusqu'à 500 personnes (3000 euros)

    Le programme doit reserver le plus petit hall en fonction du nombre de personne. Si le nombre de personne est supérieur à 500 alors, imprimer un message "Désolé, il n'y a pas de hall pouvant accommoder ce nombre de personne"

    Si le nombre est en dessous de 500, demandé à l'utilisateur quel type de service il veut :
    Buffet : 10 euros par personne invité
    Service complet : 120 euros par table ( chaque table peut accueillir 8 personne).

    Voila pour l'énnoncé, voila mon programme qui bug maintenant :

    import java.util.Scanner;
    public class Problem {

    static Scanner Input = new Scanner (System.in);


    public static void main(String[] args) {
    System.out.print("Enter the number of head count : ");
    int numberEntered = Input.nextInt();
    System.out.print("Enter the type of catering, B for buffet/f for full service");
    char tcatering = Input.next(). charAt (0);

    char tcatering = Input.next(). charAt(0);

    { if (tcatering == "B")
    tcatering = (char) (numberEntered*10);

    else if (tcatering == "F")
    tcatering = (char) ((numberEntered/8)*120);

    {
    if (Input.nextInt () > 500)

    {

    System.out.println("Sorry, no hall that accommodates this number of people is available.");
    break;
    }

    else if (Input.nextInt () > 0 && Input.nextInt() <= 100 );
    char greenhall;
    char halltype = greenhall;
    int hallprice = 1000;
    {

    }else if (Input.nextInt () > 100 && Input.nextInt () <= 250 );
    char yellowhall;
    char halltype = yellowhall;
    int hallprice = 2000;

    }else if
    (Input.nextInt () > 250 && Input.nextInt () <= 500);
    char redhall;
    char halltype = redhall;
    int hallprice = 3000;

    double totalcost = tcatering + hallprice;
    systeme.out.println ("The halltype is reserved",halltype, "The total cost is :",totalcost);
    {

    }
    }
    }
    }


    Si vous pouviez me donner des pistes ou un peu d'aide j'en serais extrêment reconnaisant !
    Je me tiens à votre écoute et disposition.
    Merci

  2. #2
    Candidat au Club
    Homme Profil pro
    Étudiant
    Inscrit en
    Novembre 2018
    Messages
    2
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : France, Essonne (Île de France)

    Informations professionnelles :
    Activité : Étudiant
    Secteur : High Tech - Éditeur de logiciels

    Informations forums :
    Inscription : Novembre 2018
    Messages : 2
    Par défaut
    J'ai modifié mon programme mais il continue à m'afficher des erreurs, un coup de main serais vraiment apprécié s'il vous plait.

    import java.util.Scanner;
    public class Problem {

    static Scanner Input = new Scanner (System.in);


    public static void main(String[] args) {
    System.out.print("Enter the number of head count : ");
    int numberEntered = Input.nextInt();
    System.out.print("Enter the type of catering, B for buffet/f for full service");
    char tcatering = Input.next(). charAt (0);


    { if (tcatering == "B")
    tcatering = (char) (numberEntered*10);

    else if (tcatering == "F")
    tcatering = (char) ((numberEntered/8)*120);

    {
    if (Input.nextInt () > 500)

    {

    System.out.println("Sorry, no hall that accommodates this number of people is available.");
    break;
    }

    else if (Input.nextInt () > 0 && Input.nextInt() <= 100 );
    char greenhall;
    char halltype = greenhall;
    int hallprice = 1000;
    break;
    {

    }if (Input.nextInt () > 100 && Input.nextInt () <= 250 );
    char yellowhall;
    char halltype = yellowhall;
    int hallprice = 2000;
    break;


    }if
    (Input.nextInt () > 250 && Input.nextInt () <= 500);
    char redhall;
    char halltype = redhall;
    int hallprice = 3000;
    break;

    double totalcost = tcatering + hallprice;
    System.out.println("The ",halltype," is reserved. The total cost is :$",totalcost);
    {

    }
    }
    }
    }

Discussions similaires

  1. Besoin d'aide "Programmation graphique"
    Par magic-moad dans le forum C++
    Réponses: 3
    Dernier message: 22/11/2009, 15h38
  2. Besoin d'aide - programmation basique
    Par Mr_Trickster dans le forum Langage
    Réponses: 3
    Dernier message: 10/11/2008, 08h41
  3. Réponses: 2
    Dernier message: 13/06/2007, 11h03
  4. Besoin d'aide pour algorithme de traitement d'images
    Par Zenman94 dans le forum Algorithmes et structures de données
    Réponses: 13
    Dernier message: 07/04/2005, 14h31

Partager

Partager
  • Envoyer la discussion sur Viadeo
  • Envoyer la discussion sur Twitter
  • Envoyer la discussion sur Google
  • Envoyer la discussion sur Facebook
  • Envoyer la discussion sur Digg
  • Envoyer la discussion sur Delicious
  • Envoyer la discussion sur MySpace
  • Envoyer la discussion sur Yahoo