top of page
Writer's pictureEverything++

Free help for your programming assignment!

Updated: Aug 19, 2020



Programming is hard! Most of the time you will be writing code to do something that you have never had to do before. You may even want the computer to do something IT has never done before! So what can you do when you are stuck?

  1. Review the requirements of your assignment

  2. Figure out compile-time versus run-time errors

  3. Figure out logic errors

  4. Take a break

Review the Requirements of Your Assignment

Make sure that you understand the problem that you are trying to solve. You should be able to read the assignment, step-by-step, and write down what steps the computer will need to do to accomplish the goal. This type of exercise results in what is called "psuedo-code." Psuedo-code is not meant to be compiled and run. It is simply a way to outline a program in general terms so that it can be converted later into the programming language of choice, once the logic has been worked out.


An Example

Assignment:

Write a program that creates three variables: an int, a double, and a String.

Put the value 113 into the first variable, the value 2.71828 into the second, and the value "Computer Science" into the third. It does not matter what you call the variables...this time.

Then, display the values of these three variables on the screen, one per line.

Psuedo Code:

Define int a, double b, string c

make a = 113

make b = 2.71828

make c = "Computer Science"

output a

output b

output c





Again, the above psuedo-code is meant to be generic. When you write your psuedo-code you can make it a little bit more specific, such as writing "cout << a;" instead of "output a" if you are using a C based language. However, you do not want to get too specific because it gets in the way of just working out the logic.


Figuring out Compile-Time error or Run-Time errors

Compile-time errors happen when you try to compile, or build, your program. Modern Integrated Development Environments (IDE), such as Visual Studio, will show you errors and warnings when it detects a problem with your code. The problem could be in the syntax, how the code is written, or the compiler may be having trouble locating a file that it needs for your program. Either way, the compiler will tell you what is wrong and in some cases provide you with an error code.

Run-time errors happen after your program has successfully been built and is being tested. They typically result in the program crashing. You may get an error code when your program crashes, which will help to determine where the problem is. If you are using an IDE that has debugging capability, such as Visual Studio, the debugger will stop at the line of code that has caused the error.

Whether you have a compile-time or runtime-error, you can use the available information to figure out what is wrong. Review the line of code that is causing the error. Sometimes the problem in that line of code is actually being caused by a syntax error in the line above it. Do a Google search for the text of the error and the error code, if any. Do a Google search for the general task you are trying to perform, such as "c++ display values on screen." Figuring out what is causing a compile-time or runtime-error can take some time, but the old saying "you learn from your mistakes"has never been more true.

If you are doing this assignment for school, make sure that your solution is accomplished using what you have been taught in school. Your teacher will know that you didn't write the code if you are using keywords or advanced concepts that have not been covered yet.



Figuring Out Logic Errors

Sometimes your program compiles properly, and it doesn't crash, but it is just not doing what you want. That is a logic error. Go back and review your psuedo-code. Did you leave something out? Check your actual code, does it perform the same steps as the psuedo-code? How long have you been at this program? Maybe it's time to take a break.


Take a Break

Give your body, eyes, and brain a rest now and then. If you can, go lay down and close your eyes for a few minutes. It is very likely that you won't be able to clear your mind and you will continue to think of your programming problem. This is OK. Lie there and think about it in a relaxed, calm, manner. Sometimes the answer will just pop out of nowhere. Other times you will only come up with possible alternate ways to write the code. All of this is good as it is hopefully moving you forward. Go back to your code after your break, but don't wait too long:


Resources

If you are in school, check with your teachers and other students. They may be able to give you extra push in the right direction that you need. Online resources are abundant and Google is one of the best. FaceBook groups are a third option, which is likely how you found this page!

Conclusion

There are a lot of resources for a stuck programmer. Stick with it and keep learning. The more you learn, the more you will be able to accomplish. Keep learning, keep doing or:

Learn();

Do();

Repeat();


Good luck and thanks for reading! What is the toughest coding situation you have been in and how did you overcome it? What programming languages do use? Let us know in the comments below, we would love to hear from you!



88 views1 comment

Recent Posts

See All

1 Comment


hamiltont1999
Aug 16, 2020

Write a java program (name it JaggedArray) that will print the elements in the following jagged array in different lines as shown in the output. First rewrite the jagged array in the form: String ?? arr2 = new String ??? .arr[?] = new ??? .arr[?] = new ??? .arr[?] = new ??? String[][] arr2 = {{ "This","will"},{ "print","some","jagged"},{ "array" }}; Output: This will print some jagged array

Like
bottom of page