han285
February 28, 2018, 1:26am
1
This lesson has been nothing but trouble.
Here is the set up of the problem:
import java.util.ArrayList;
public class Temperatures {
public static void main(String[] args) {
ArrayList<Integer> weeklyTemperatures = new ArrayList<Integer>();
weeklyTemperatures.add(78);
weeklyTemperatures.add(67);
weeklyTemperatures.add(89);
weeklyTemperatures.add(94);
System.out.printIn( weeklyTemperatures.get(0) );
Of course, I type the answer correct but it says incorrect for lowest temperature.
I want to understand what I’m doing wrong.
Is it my answer or the white space?
mtf
February 28, 2018, 2:18am
2
We do not see a closing brace for your main method or for the class. Did you just not paste them in to the post, or are they actually missing?
han285
February 28, 2018, 3:54am
3
It’s there.
import java.util.ArrayList;
public class Temperatures {
public static void main(String[] args) {
ArrayList<Integer> weeklyTemperatures = new ArrayList<Integer>();
weeklyTemperatures.add(78);
weeklyTemperatures.add(67);
weeklyTemperatures.add(89);
weeklyTemperatures.add(94);
System.out.printIn( weeklyTemperatures.get(0) );
}
}
mtf
February 28, 2018, 5:31pm
4
Perhaps the white space is tripping up the SCT…
System.out.println(weeklyTemperatures.get(0));
ArrayList Access
han285
March 2, 2018, 12:50am
5
Still getting the same wrong answer. I think it’s a glitch but I know it’s the right answer.
1 Like
han285
March 2, 2018, 12:57am
6
What do you mean the SCT??
mtf
March 2, 2018, 12:57am
7
Have you tried refreshing the session? A different browser? If all else fails, can you Get Code?
Submission Correctness Test
The program that runs in the background behind each lesson page. It is not exhaustive, sometimes fickle and other times lenient.
han285
March 2, 2018, 1:16am
8
I have tried you have suggested to me and get still the same results. After I get the code it’s correct but the spaces move the code slightly. I don’t know why. Maybe space sensitive?
So, the SCT is sometimes not going to work on a lesson, correct?
mtf
March 2, 2018, 1:27am
9
Perhaps not as we expect it might. For the most part, when the instructions have been followed exactly and correctly the lessons pass as expected.
You’re supposed to print the lowest temperature but you’re printing the first. 67 is the lowest temperature so the last line of your code should be
System.out.printIn( weeklyTemperatures.get(1) )
Wording left me stumped too.
If you’re feeling a bit adventurous you could write a for loop to check for the lowest temperature.
system
Closed
March 14, 2018, 9:09am
12
This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.