Preparing for First Year in Computer Science - Page 3 - Studies and Job Offers - HWzone Forums
adplus-dvertising
Skip to content
  • Create an account
  • About Us

    Hello Guest!

     
    Please note - in order to participate in our community, comment and open new discussions, you must join as a registered member.

    Our members enjoy many advantages, including the ability to participate in discussions, enjoy raffles and promotions for members of the site, and receive our weekly content directly by email.

    Do not like being harassed by email? You can register for the site but do not submit your registration to the weekly email updates.

Preparation for first year in computer science


ggg123

Recommended Posts

The guide looked fine. Just try typing the code when you ask and do not copy-paste.

Thanks Gil you help me a lot throughout the thread.

Another thing I wanted to ask - would you recommend using a style programming environment

Eclipse Which will allow me to more rapid, convenient and efficient programming and organized, or actually write using standard Notepad and compile using cmd?

I ask how academically it is customary to work, especially at the beginning.

Link to content
Share on other sites

  • תגובות 151
  • Opens on
  • Last comment
Eclipse completely, or any other environment that seems to you. There is no advantage to working with Knopf ... although there may be some use of cmd
With java there is no problem writing with eclipse, it really stick.

In any case, you should know the different compiling commands, especially when using the makefile files will be useful (probably in C ++ C)

great.

Standard version is enough for java? I just saw there were many more packages on the site.

Link to content
Share on other sites

And if linear algebra then the lectures of the legendary zilg

I began to watch the calculus and I want to combine algebra.

What is meant by linear algebra on the Technion video site?

There are several lectures in the algebra of Prof. David Tsilg: Algebra from 1, Modern Algebra, H. Algebra.

What's right for me?

Link to content
Share on other sites

Algebra A is the algebra of a mechanic at the Technion, and algebra 1 is the same at a lower level (and a bit more material).

Modern algebra is a different course.

And if you've already mentioned Notepad, Windows has alternatives like: http://www.notepad-plus-plus.org/ (The recommendation is not to use the usual Notepad for technical things).

Thanks.

As for the workplace recommendation, I have already downloaded Eclipse and it is completely round. Thanks anyway for the offer.

- - - Unified response: - - -

I saw a few minutes from Zilg's lecture ... There are no more such lecturers

I have seen 2 lectures by the Tel Aviv University's Aviv Censor, who is also an excellent lecturer, very clear and talkative.

I still have not seen Zilg.

Link to content
Share on other sites

Hey, I'm back.

I started as stated in the JAVA study and came to the conclusion that I had to do some exercises to understand properly.

I found a page of tasks on the university site and I was already caught in the second exercise.

This is the question:

Write a program that takes two integers from the user

0, and prints the average of all initial numbers

Within the range of numbers (including edges). If there are no prime numbers in the above range,

The program must print 0.

It can be assumed that the user will enter integers and are very large from * 0. Remember, do not print

Extra screen stuff (such as "please enter an integer").

Examples:

If the user entered the numbers 2 and * 11, the output would be 5.6 (because * 7, 5, 3, 2 and * 11 are

(2,11), and their numerical average is 28 / 5 = 5.6)

* The question must not be solved with arrays, strings or functions.

The way I tried to solve it - I ran a loop that ran between the two numbers that the user entered (variable i)

Within the loop there is another loop that runs numbers (n variable) from 2 to the endpoint range (not included). Then I performed a% n that repeats until n reaches y-1. If the remainder is always different from 0 it means that the number i is not a freak and therefore is initial and added to the values ​​- the sum of the prime numbers and the number of prime numbers. If the remainder is sufficient for one time, 0 is equal, meaning that i-freak means not initial and then nothing happens.

In the end I calculated the average.

The output I get always goes out wrong. For example I inserted input 2 and 11 and got output 6.5 (need to exit 5.6).

Here's the full code:




import java.util.Scanner;
public class EX2 {




public static void main (String [] args) {
Scanner s = new Scanner (System.in);
int x = s.nextInt ();
int y = s.nextInt ();
s.close ();
int s_prime = 0;
int n_prime = 0;
int first_prime = 2;
boolean prime;

for (int i = x; i <= y; i ++) {
if (i == first_prime) {
s_prime = s_prime + i;
n_prime ++;
}
else if (i <= 1) {
continue;
}
else {

for (int n = 2; n
if (i% n! = 0) {
prime = true;
}
else
{
prime = false;
break;
}
}
if (prime = true) {
s_prime = s_prime + i;
n_prime ++;
}
}
}

if (n_prime> 0) {
double average = s_prime / (double) n_prime;
System.out.println (average);
}
else
System.out.println ("0");
}


}


Link to content
Share on other sites

That's exactly the part I think, from my experience in the course, the most important, and the hardest to learn, especially if you have never programmed before the university.

From what I saw who you did not program alone before the course, it was a very difficult course for me. The one who prepared for me did not have any difficulty at all (still a lot of work, but a fun course in all).

I'm talking about your question, where is the error in the code, it's critical to learn to find mistakes in the code alone, in my opinion it's more important than learning to write one command or another. You will always have errors in the code, usually you will not have anyone who will pass you the code to tell you here you will change.

How to find errors in the code? There is no specific way to get you the answer, but in general you need to find the first point you came in. You thought the computer would do X and it turns out that it does Y.

If you decide to do it in your head then notice that you have to do it like a computer, line a row. You do exactly what the line says, without and then it divides in the first few or so, without any conclusions or jumps. ), And you'll find the point where he decides that a number in which he tells the amount you did even though he did not need or something similar, and think about what made him the wrong conclusion.

If you need I can give you the site of the course in my year, there is all the presentations of the lessons and exercises in the course ...

Link to content
Share on other sites

It is best that you forward your message to a programming forum.

Anyway, deddy right. What you need to do is fill out a tracking table. Make a column for each variable you have in the code (including i) and at each stage of the loop, you will update each row with the new value of the different variables.

Make sure the values ​​change as expected - if there is a problem with the code, you'll find it when a variable gets a value you did not expect. If you have not found such a mistake, you have a problem with logic.

Besides, you use x = x + 1 and once x ++. Be consistent (++ x better)

Link to content
Share on other sites

Thank you both for the tip.

Deddy- I agree with you regarding the difficulty. On the face of it, I seem to understand the material I'm reading, but it's hard for me to translate the question into code. It's as if I'm missing an intermediate stage that I'm missing.

Anyway I'd love to get the site.

Tomorrow I'll make your recommendation. By the way, I did not use x = x + 1, but x = x + i. Everywhere I had to promote in 1 I used ++

Link to content
Share on other sites

My mistake, you're right.

In any case, you do not lack any intermediate stage. Just a little experience. You learn only through your fingers.

It is also advisable to use meaningful names for variables. It's hard to understand what s_prime is and what n_prime is

Another thing:

else if (i <= 1) {
continue;
}
else

It would have been better if you put the big block in the first else (if i is greater than 1) and then have no else continue.

Link to content
Share on other sites

ארכיון

This discussion has been archived and new comments can not be added.


  • Latest news

  • Buzz-Zone: Everything hot on the net

×
  • Create new ...

At the top of the news:

new on the site