Add this tag to your question to indicate that you are new to the language of your code. This will often be taken in to consideration by reviewers when assessing your code.
0
votes
0answers
1 views
Fixing Nested For Loops
I am having some trouble getting some nested 'for loops' to work the way I need them to. I've been searching to try and find an answer and this seems to happen quite often, but as I am still fairly ...
4
votes
1answer
47 views
Tic-Tac-Toe game using the minimax algorithm
I have written a Tic-Tac-Toe game in Python that contains, among others, a player that uses the minimax algorithm. I am not exactly a beginner at Python, but I'm not very experienced with it - so I ...
3
votes
1answer
60 views
Fictional Hotel Website
I've made a fictional hotel website that shows you hotel details when you click on a button.
jsFiddle
...
2
votes
1answer
70 views
Fractions in Java
Part I-IV recommend code changes as mentioned in link 1, for the initial code given at link 2.
Can you please review the code changes for Part I-IV?
Part I: Constructors (1 point)
Modify the ...
3
votes
2answers
30 views
Calculating parsimonies using Python; performance is lacking
This program takes a very long time to do each and every step, even the very first print statement. Why is this, and what is the best way to diagnosing a problem like this in any language?
Also, I'd ...
5
votes
1answer
64 views
Horridly Inefficient Project Euler #14 in Python - Collatz Sequences
I created this solution a while ago, and have been going back over my problems to try to make them all more efficient. I have been stuck on this one, and have tried a few different ideas. So far, my ...
12
votes
4answers
441 views
Voxel-based chunk manager
I'm creating a voxel-based game and have been working on it for quite a while.
I've come to a point where I have to load and unload chunks on the fly. I've created a chunk manager class and it's ...
-2
votes
0answers
30 views
variables in java [on hold]
I'm currently beginning java i have a question on some code. I know whats wrong with it but I'm asking why i need the .name method instead of just naming each variable in the array (hopefully that ...
7
votes
3answers
108 views
Hangman game in Java
I'm hoping someone can look over my code and tell me if there is anything I can improve. I am not very experienced with Java so I am hoping for some feedback as to avoid developing any bad habits ...
10
votes
2answers
794 views
Basic Terrain Generator - KhanAcademy
I'm new to JavaScript, and I've been learning off Khanacademy. I wrote the following basic terrain generator and I'm wondering if it could use any improvements. Here's the code:
...
8
votes
3answers
279 views
Electricity Calculator
This is a calculator for Ohm's Law and Power Law. It works but I'd like some suggestions on making the code look a little cleaner, or run more efficiently.
...
3
votes
3answers
76 views
Implementation of a doubly linked list in Java
I'd like to improve this code.
DoublyLinkList.java
...
7
votes
2answers
68 views
Web page for blog post demonstration
I am a CSS and HTML5 newbie. I'm creating a minimal web page to demonstrate something in a blog post. So although it doesn't need to look great, I would like it to make sure it's solid. It has no ...
4
votes
2answers
204 views
Simple factorial program using recursion
Two concepts I realized I needed to understand and use more are recursion and Exceptions. Thus, I combined both in the following program. Although it began with a focus on using recursion it became ...
3
votes
1answer
42 views
Function to count rows in a database query result
I have written this function that surprisingly works. (I didn't really know what I was doing; just a little experiment.) It is supposed to count rows selected by a PDO query.
Is it well written? It ...
8
votes
3answers
322 views
Singleton Database wrapper
Before everybody yells at me about why I wrote a PDO wrapper class, it's to avoid writing try/catch, ...
17
votes
2answers
2k views
Android Flashlight app
This is my first project, a Flashlight application for Android-based devices:
...
3
votes
3answers
148 views
Is SList class an ADT?
As per the definition given in lecture, ADT is,
With reference to this definition, I would like to call SList class an ADT following 6 invariants:
Multiple ...
1
vote
2answers
44 views
Putting all desktop items into a new folder
I'm quite a newbie with Python, but I wanted to try my own little project, so I made a small script that puts all the desktop icons/folders into a newly created folder (called "Desktop1") if there are ...
3
votes
1answer
48 views
Optimizing gulpfile.js
I'm fairly new to JavaScript and Gulp. I was following this article for creating my gulpfile, trying to follow best practices, but it seems to me that this peace of code can be optimized and written ...
3
votes
0answers
23 views
Write a function to extract a given number of randomly selected elements from a list
I'm going through the 99 Haskell problems and I have a few question about the solution I implemented for Problem 23.
It asks:
Extract a given number of randomly selected elements from a list.
...
3
votes
2answers
53 views
Calculating the ideal body weight
The following question was taken from Absolute Java 5th ed. by Walter Savitch:
A simple rule to estimate your ideal body weight is to allow 110 pounds for the first 5 feet of height and 5 pounds ...
13
votes
4answers
1k views
Living off of chocolate
This is the second project for my CS1 class, this time I'm actually getting it reviewed before I submit it ;)
The Harris-Benedict equation estimates the number ...
8
votes
6answers
768 views
C++ 3D Vector Implementation
I have been learning C++ now for 2 months and this week I started reading a book on 3D graphics. I like coding whatever mathematical stuff I learn so I can understand it better, so when I learnt about ...
4
votes
1answer
250 views
Queue Implementation using a Linked List
For understanding the concepts, I've implemented the Queue data structures using a linked list. Is there anything to improve?
LinkList.java
...
3
votes
2answers
107 views
Converting seconds to hours, minutes and seconds
The following question was taken from Absolute Java 5th ed. by Walter Savitch:
Write a program that outputs the number of hours, minutes, and seconds that corresponds to 50,391 total seconds. The ...
6
votes
3answers
645 views
Stack implementation using a linked list
To understand the concept, I implemented the stack operations using a linked list. Please review the code and tell me your suggestions.
Node.java
...
2
votes
2answers
72 views
Fizz Buzz in JS
This is a simple JavaScript Fizz Buzz solution based on a Codecademy exercise. I refactored it down a few lines after seeing these implementations.
I wanted to post here and see what else I can ...
6
votes
3answers
118 views
6
votes
1answer
97 views
Pokemon Type Evaluator part 2
I started anew and completely refactored the way I implemented Pokemon Type Evaluator.
Also, first use of a lambda expression (Case of using it, but still don't fully grasp how it's working). I'm ...
3
votes
1answer
44 views
Evaluating given numbers and operations
The program reads in an operation, and then numbers, and does stuff to them based on that.
Exercise number 1 at this linl
For example, ./this_file sum 1 2 3 would ...
13
votes
5answers
833 views
Calculating freefalling object's height
This is the code for my first CS1 project, I hope to be posting my code here to track my progress of learning the language of C++. I shouldn't be too shabby, since I know C considerably well and have ...
3
votes
1answer
54 views
Calculating the speed of a bicycle given the gear size and cadence
The following question was taken from Absolute Java 5th ed. by Walter Savitch:
Bicyclists can calculate their speed if the gear size and cadence is known. Gear size refers to the effective ...
1
vote
0answers
28 views
Is it long polling or short polling?
I wrote the following script and php code for long-polling architecture by googling references, I would like to know if this is long-polling or short-polling, ...because I am not sure:
bc_test.js
...
2
votes
2answers
45 views
Histogram of length of words in text
This my first real program in python. I welcome harsh criticism. I tried to make it as efficient as possible. Trying to balance speed and readability as well. My program takes a file of text and ...
2
votes
1answer
47 views
Changing the first occurrence of a text in a sentence
The following question was taken from Absolute Java 5th ed. by Walter Savitch:
Write a program that starts with a line of text and then outputs that line of text with the first occurrence of ...
7
votes
2answers
89 views
Is this a modern C++11 implementation of a Level class and static factory?
This is a follow up to my previous question, now that I've read up more about modern C++ (specifically C++11) and the answers in the question. I'm using MSVC/Visual Studio 2012 Update 4.
Specific ...
4
votes
1answer
557 views
Calculating amount of diet soda a dieter can drink without dying
The following question was taken from Absolute Java 5th ed. by Walter Savitch:
A government research lab has concluded that an artificial sweetener commonly used in diet soda pop will cause death ...
2
votes
1answer
48 views
C++ messaging using templates
I wanted to allow components of my program to communicate without the components knowing about each other, thus keeping coupling low. So I devised some template classes that implement the observer ...
7
votes
4answers
492 views
Three functions for computing simple arithmetic
Here is my code where I have 3 functions that do simple arithmetic:
...
5
votes
4answers
199 views
Managing a cruise system
Follow up to Removing code smell from Room Booking code
This program organises cruises in which it sets up the ship with cabins/rooms. It also does reservations with customer information and the ...
6
votes
2answers
83 views
Converting the first and last name to pig latin
The following question was taken from Absolute Java 5th ed. by Walter Savitch:
Write a program that starts with the string variable first set to your first name and the string variable last set ...
5
votes
3answers
77 views
Calculating the number of candy bars and gumballs that can be redeemed using coupons
The following question was taken from Absolute Java 5th ed. by Walter Savitch:
The video game machines at your local arcade output coupons according to how well you play the game. You can redeem ...
2
votes
2answers
250 views
Calculating total number of calories burned
The following question was taken from Absolute Java 5th ed. by Walter Savitch:
One way to measure the amount of energy that is expended during
exercise is to use metabolic equivalents (MET). ...
3
votes
2answers
71 views
Answer to an implementation of Project Euler #8
I saw that there was a previous question asking to review an answer to the Project Euler question #8. My answer didn't look anything like the answer in that question and as a beginner, I was wondering ...
7
votes
6answers
1k views
Find prime numbers under N
I'm using the Sieve of Eratosthenes to find primes numbers under N. Is there any performance problems you see with my approach? I used the LinkedList<Integer> ...
3
votes
1answer
42 views
Madlibs Program
I just started to learn Python, and wrote this Madlib program that works the way I intended it to, so I do not need help debugging, just some advice on tips to improve the code or make it simpler.
...
2
votes
3answers
105 views
CodeChef Matrix Rotation
I am new to C# and have tried to solve a problem statement from CodeChef:
Problem statement
You are given an array A of N integers. You are to fulfill M queries.
Each query has one of the ...
9
votes
5answers
377 views
Static factory function and lifetime
I'm trying to teach myself C++ at the moment, after years of C# and other managed languages. The class in question is a Level in a game, and the idea is to ...
5
votes
1answer
52 views
Creating a class library in JavaScript
I am an experienced Java programmer, but fairly new to JavaScript.
I am creating a chat library in JavaScript, and have it working, but want to know if I am going about this correctly, and following ...