Bonjour a tous,
Je suis complètement débutant dans l'apprentissage de Java et j'essaye de faire cet exercice en anglais. (je suis actuellement aux US)
J'ai effectué la 1er partie qui est demandé, c'est a dire; le type de motif que l'utilisateur veut ( ex: triangle puis hauteur ) mais je n'arrive pas a trouver comment imprimer le losange et le v-shape.Pièce jointe 158745Pièce jointe 158745Pièce jointe 158745
Si quelqu’un qui comprend l'anglais et qui est dispose a m'aider ça serait vraiment cool merci beaucoup!!
l'énoncé de l'exercice en anglais (désolé) est en PJ:
voici ce que j'ai fais jusqu'ici:
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35 public class test { public static void main(String[] args) { // TODO Auto-generated method stub int height; int whichPattern; //public void running(){ Scanner sc = new Scanner(System.in); System.out.println("which pattern do you want(1/2/3)?: 1: triangle; 2: diamond; 3: V-shape"); whichPattern = sc.nextInt(); System.out.print("Please input the height: "); height = sc.nextInt(); System.out.println(); if(whichPattern == 1) trianglePrint(height); else if (whichPattern == 2) diamondPrint(height); else vPrint(height); } public static void trianglePrint(int height){ for(int i = 0; i<height; i++){ for(int s=0; s<height-i; s++){ System.out.print(" ");
Partager