Skip to content

Comments

fix a small bug in DummyHistoryHandler.java(proj2a)#32

Open
ceyewan wants to merge 1 commit intoBerkeley-CS61B:mainfrom
ceyewan:my-feature-branch
Open

fix a small bug in DummyHistoryHandler.java(proj2a)#32
ceyewan wants to merge 1 commit intoBerkeley-CS61B:mainfrom
ceyewan:my-feature-branch

Conversation

@ceyewan
Copy link

@ceyewan ceyewan commented Jul 16, 2024

I am a student from China. While working on proj2a, I found that the provided skeleton code did not produce the parabola and sinusoid as demonstrated in the documentation. Therefore, I modified this bug to achieve the correct demonstration.

The original code is as follows:

TimeSeries parabola = new TimeSeries();
for (int i = 1400; i < 1500; i += 1) {
    parabola.put(i, (i - 50.0) * (i - 50.0) + 3);
}
TimeSeries sinWave = new TimeSeries();
for (int i = 1400; i < 1500; i += 1) {
    sinWave.put(i, 1000 + 500 * Math.sin(i/100.0*2*Math.PI));
}

The image is as follows:
image

After modifying the code, it is as follows:

TimeSeries parabola = new TimeSeries();
for (int i = 0; i < 100; i += 1) {
    parabola.put(i, (i - 50.0) * (i - 50.0) + 3);
}
TimeSeries sinWave = new TimeSeries();
for (int i = 0; i < 100; i += 1) {
    sinWave.put(i, 1000 + 500 * Math.sin(i/100.0*2*Math.PI));
}

The image is as follows:
image

I would like to thank Berkeley, the professors, and the TAs for providing such great learning materials in CS61B.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant