14,331,362 members

Java

 Re: Halp please? Dice roll game. Richard MacCutchan6-May-18 21:52 Richard MacCutchan 6-May-18 21:52
 Solving symmetric tree problem by recursive solution ElenaRez6-May-18 6:52 ElenaRez 6-May-18 6:52
 Re: Solving symmetric tree problem by recursive solution Richard MacCutchan6-May-18 21:44 Richard MacCutchan 6-May-18 21:44
 Deep copy of List<> without knowing specific list type jackbrownii30-Apr-18 10:55 jackbrownii 30-Apr-18 10:55
 Re: Deep copy of List<> without knowing specific list type Manish K. Agarwal27-May-18 21:32 Manish K. Agarwal 27-May-18 21:32
 Student needing assistance while loop Victor McNeal21-Apr-18 9:15 Victor McNeal 21-Apr-18 9:15
 I can't seem to figure out what I am doing wrong with my while loop. For some reason it wont execute the loop it just goes on to the next piece of code. please let me know what is wrong with my syntax. ```package com.nec; import java.util.Scanner; public class Inputs { private static Scanner s; private static String grade; private static Boolean flag; private static double averageSum; private static int studentCounter; private static Double classAverage; public static void main(String[] args) { grade = ""; flag = true; averageSum = 0; studentCounter = 0; //Inserting While statement to to check for more information While (flag); { flag = (false); s = new Scanner (System.in); System.out.print("Enter your name: "); String name = s.next(); System.out.print("Enter scores in three subjects: "); int scores1 = s.nextInt(); int scores2 = s.nextInt(); int scores3 = s.nextInt(); double average = (scores1+scores2+scores3) /3.0; averageSum = averageSum + average; studentCounter++; //System.out.println("\nName: " +name); //System.out.println("Average: " +average); if (average >= 93) { grade = "A"; } if (average >= 90 && average < 93) { grade = "A-"; } if (average >= 87 && average < 90) { grade = "B+"; } if (average >= 83 && average < 87) { grade = "B"; } if (average >= 80 && average < 83) { grade = "B-"; } if (average >= 77 && average < 80) { grade = "C+"; } if (average >= 73 && average < 77) { grade = "C"; } if (average >= 70 && average < 73) { grade = "C-"; } if (average >= 67 && average < 70) { grade = "D+"; } if (average >= 63 && average < 67) { grade = "D"; } if (average >= 60 && average < 63) { grade = "D-"; } if (average >= 0 && average < 60) { grade = "F"; } System.out.println("\nName: " +name); System.out.println("Average: " +average); System.out.println("grade:" +grade); System.out.println("Do you have another set of scores to compute, enter 1 for yes and 0 for no"); int ans2 = s.nextInt(); //if statement to close the while loop if (ans2 == 1) flag = true; if (ans2 == 0) flag = false;} classAverage = averageSum / studentCounter; System.out.println("Class Average is:" +classAverage); } private static void While(Boolean flag2) { // TODO Auto-generated method stub } }```
 Re: Student needing assistance while loop Richard MacCutchan21-Apr-18 20:56 Richard MacCutchan 21-Apr-18 20:56
 Message Closed 9-Sep-19 23:31 Member 14585837 9-Sep-19 23:31
 Java JUnit test error CHUCHU YAO20-Apr-18 13:23 CHUCHU YAO 20-Apr-18 13:23
 Re: Java JUnit test error Richard MacCutchan20-Apr-18 20:43 Richard MacCutchan 20-Apr-18 20:43
 Re: Java JUnit test error jschell21-Apr-18 6:31 jschell 21-Apr-18 6:31
 Re: Java JUnit test error Richard MacCutchan21-Apr-18 20:58 Richard MacCutchan 21-Apr-18 20:58
 JAVA Swing GUI Invoice - problem with correct actionPerformed Member 1378720218-Apr-18 20:59 Member 13787202 18-Apr-18 20:59
 Re: JAVA Swing GUI Invoice - problem with correct actionPerformed Richard MacCutchan18-Apr-18 21:51 Richard MacCutchan 18-Apr-18 21:51
 Re: JAVA Swing GUI Invoice - problem with correct actionPerformed Member 1378720219-Apr-18 0:54 Member 13787202 19-Apr-18 0:54
 Re: JAVA Swing GUI Invoice - problem with correct actionPerformed Richard MacCutchan19-Apr-18 1:02 Richard MacCutchan 19-Apr-18 1:02
 Re: JAVA Swing GUI Invoice - problem with correct actionPerformed snoopy1118-Apr-18 23:17 snoopy11 18-Apr-18 23:17
 Re: JAVA Swing GUI Invoice - problem with correct actionPerformed Peter_in_278019-Apr-18 0:39 Peter_in_2780 19-Apr-18 0:39
 design a class Member 1365742917-Apr-18 21:18 Member 13657429 17-Apr-18 21:18
 Re: design a class Richard MacCutchan17-Apr-18 22:41 Richard MacCutchan 17-Apr-18 22:41
 jdbc connection Member 137686618-Apr-18 7:26 Member 13768661 8-Apr-18 7:26
 Re: jdbc connection Richard MacCutchan8-Apr-18 21:51 Richard MacCutchan 8-Apr-18 21:51
 i need help fast.i have only 2 days left Member 137677117-Apr-18 11:35 Member 13767711 7-Apr-18 11:35
 Last Visit: 18-Oct-19 23:52     Last Update: 18-Oct-19 23:52 Refresh « Prev1...12131415161718192021 Next »