You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Stringcandidate[] = {"Obama or Romney", "Biden or Ryan", "presidential", "vice-presidential"};
Stringname = JOptionPane.showInputDialog(null, "Hi! What's your name?");
intx = Integer.parseInt(JOptionPane.showInputDialog(null, "Hello " + name + ", how many hours would you like to study this Friday night? "));
while (x <= 5)
x = Integer.parseInt(JOptionPane.showInputDialog(null, "You aren't studying enough, please try again."));
if (x > 5)
JOptionPane.showMessageDialog(null, name + ", you're gonna be successful in the future.");
doubletotal;
intcounter;
inthours;
doubleaverage;
total = 0;
counter = 1;
while (counter <= 4)
{
hours = Integer.parseInt(JOptionPane.showInputDialog(null, "Enter the number of hours you studied every Friday for the " + count[counter] + " Friday of this week."));
total = total + hours;
counter++;
}
average = total / 4;
JOptionPane.showMessageDialog(null, "You studied an average of " + average + " hours this past month on Fridays");
intcounter2;
counter2 = 0;
while (counter2 <= 1)
{Stringpresident = JOptionPane.showInputDialog(null, "Which " + candidate[counter2 + 2] + " candidate do you prefer? " + candidate[counter2] + "? Enter \"don't care\" to quit.");
if (president.equals("Obama") || president.equals("Romney") || president.equals("Biden") || president.equals("Ryan"))
JOptionPane.showMessageDialog(null, "Good for you! Have a cookie.");
counter2++;
}
intgradeTotal;
intgradeCounter;
doublegradeAverage;
gradeCounter = 0;
gradeTotal = 0;
StringletterGrade = (JOptionPane.showInputDialog(null, "Please input your first letter grade to be averaged, enter N for \"0\", or press Q to quit: "));
while (!letterGrade.equals("Q")) {
if (letterGrade.equals("A"))
gradeTotal += 95;
if (letterGrade.equals("B"))
gradeTotal += 85;
if (letterGrade.equals("C"))
gradeTotal += 75;
if (letterGrade.equals("D"))
gradeTotal += 65;
if (letterGrade.equals("F"))
gradeTotal += 50;
if (letterGrade.equals("N"))
gradeTotal += 0;
gradeCounter++;
letterGrade = JOptionPane.showInputDialog(null, "Please input your next letter grade to be averaged, or press Q to quit: ");