Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

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