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.
1
vote
0answers
29 views
White Elephant Gift Exchange game using object-oriented design
I'm learning about OOP and I'm attempting to solve the White Elephant Gift Exchange game. The way I've done it is that I have created a bunch of set variables which store the set of gifts opened, set ...
5
votes
1answer
22 views
Determining prices for wholesalers or retailers
It is my first year in college and I have designed a code using pretty much my own basic knowledge. I have designed a program to work out the price of items for wholesalers or retailers. Special ...
3
votes
0answers
22 views
Program for a packing company
It's my first year in college studying Java so please excuse my ignorance in programming. This is my 5th Task in my Sequential Programming assignment, where we had to design a program for a packing ...
3
votes
1answer
34 views
Tic Tac Toe Android game
Can you help me with suggestions regarding my code for Tic Tac Toe Game? This is my code, I've tested it and it works, but I feel like it can still be made shorter/clearer. I am not a good coder and ...
2
votes
1answer
31 views
Interfacing with instruments using pyvisa
I'm new to Python, and after running through some introductory exercises I wrote a class definition for working with some hardware, specifically a Signal Recovery model 7230 lockin amplifier. In the ...
6
votes
2answers
370 views
5
votes
1answer
59 views
Basic cryptography algorithm
I wrote 2 classes in order to implement some basic cryptography algorithm. I tried to use some object-oriented concepts of C++. I'm a beginner, so any comment or suggestion is welcome.
First class: ...
-2
votes
1answer
36 views
Simplify python conditional
This is a follow up to Log probe requests of WiFi devices focussing on a specific element of the code.
Can I simplify this code and make it more readable?
...
-1
votes
1answer
38 views
Formatting a long filesystem path in Python
This is a follow up to Log probe requests of WiFi devices focussing on a specific element of the code.
I have this line of code:
...
1
vote
1answer
28 views
Argparse implementation
This is a follow up to Log probe requests of WiFi devices focussing on a specific element of the code.
How can I indent this code to make it look great and be well formatted?
...
0
votes
1answer
26 views
Read Space Delimited Text File to Standardized Data Type
From the README.md
Introduction:
The purpose of data-in is to read all the lines from a text file and return the file's contents as a Clojure value in a ...
15
votes
5answers
797 views
Implement a Shape abstract class
To learn more about OOP, @nhgrif challenged me to implement a Shape abstract class (more details in code remarks below. Here is how I did it. Any and all advice appreciated!
Shape.java
...
7
votes
1answer
85 views
Log probe requests of WiFi devices
I developed a program that collect probe requests from WiFi devices. It already works but I think that a programmer can improve it.
...
3
votes
1answer
321 views
Computing average market spread in C#
My task is to compute average half spread in percentages on a stream of market. This is part of the coding assignment that I have received.
...
2
votes
1answer
51 views
Printing calculator - Stephen Kochan exercise
I'm a newbie at programming, just one month into C. Working with Stephen Kochan's programming in C. There is a question in chapter 6 to write a printing calculator where 's' tells the program to set ...
-3
votes
0answers
22 views
compiler error - A get or set accessor expected @ Random randomNumbers = new Random(); [closed]
My question is how to get this compiler error in the Title line fixed? Yes this is a homework problem. Exercise description is at end of code.
...
6
votes
4answers
335 views
Constructing a JavaScript slide
I am a newbie to native JavaScript and am pretty much coming to grips with the operators, etc. At the moment I am currently constructing a slide.
...
2
votes
1answer
31 views
Rust version of my C++ command-line tool
First program I've written in Rust (besides the demos in the tutorial site).
I decided to start by converting my C++ command line tool to Rust. This is not necessarily a 1 to 1 conversion, but I've ...
2
votes
1answer
47 views
PHP include page index.php?page=GET safety preg_replace
I found a lot of working codes to include page in page on Internet but I could not find a safe code. So I decided to create one myself. The pages will be only stored in folder /pages/ and whitelist ...
6
votes
2answers
143 views
Basic C++ tone generator
I'm trying to learn C++ (with experience in C and Java, inter alia).
I wrote a program to output a waveform of multiple (superimposed) tones, each varying in pitch.
To execute:
Compilation: ...
4
votes
1answer
157 views
Check whether a number is positive, negative, or zero
I have a program which generates a number between 0 and 4 for both the player and the computer. If the number is positive the player wins, and if it is negative the computer wins.
...
1
vote
1answer
34 views
PHP PDO Database Wrapper
I'm trying to wrap my head around OOP, and am fairly new to PHP in general, so please forgive me if the following makes you cringe.
I've decided to try and create a basic database wrapper using PDO. ...
3
votes
1answer
43 views
Form builder class
I am trying to learn OOP in PHP. My PHP knowledge is pretty good, but haven't tried OOP before. I'm currently building a formbuilder class. Can you take a look and tell me if this is the right way?
...
4
votes
2answers
157 views
Return a random line from a file when user enters a specific text
I am a beginner trying to fetch a random line from a file and wondering if this code can be improved. Should I use try and catch in this case? Should I take a parameter for the function "quote"? How ...
2
votes
1answer
34 views
Uploading and downloading files with FTP
I'm learning Python and decided to rewrite my FTP tool from Perl to Python. The program is able to up/download files, change the directory and list the files of the current directory.
Is there ...
6
votes
2answers
76 views
Calculating discount rates for Present Value conversion
In my team at work we have traditionally used VB, starting with 6 and moving to .NET. However, other teams in the company use C#. So, armed only with Programming C# 4.0 and VS 2013, I thought I'd have ...
1
vote
2answers
155 views
Multi-Table Unions [closed]
I've been using joins for years but in this instance I want to be able to do different queries on different tables which may have different structures due to clients. Long term we are aiming to make ...
2
votes
2answers
41 views
PHP function (in WordPress) echoing HTML
I'm really new to PHP, and a little less so in WordPress. I've created a working function that spits out some static HTML into a page template in WordPress. I'd like to know if there is a best ...
11
votes
7answers
922 views
Mathematical functions on fractions
I have been challenged by @nhgrif to write a Fraction class to better my understanding of OOP. I have found an interesting challenge here (I apologize that the source is not mentioned, I was not able ...
1
vote
1answer
38 views
User input function keep looping until valid filename entered
The following function is basically asking the user to input a file name for a file that the calling program is going to do something with. If the user enters an invalid file name, I want the program ...
1
vote
1answer
39 views
Order of operations algorithm for calculator
I wrote a simple calculator which uses orders of operations. I would like to know, do you see any serious flaws in logic and what do you think about this solution?
It is my second approach to a ...
4
votes
1answer
65 views
Number-guessing game with simple GUI
This is my second program in Python. I am aware that globals are a bad idea, but that is what I have learned so far in my course.
Right now the program is doing what it's supposed to do, my only ...
10
votes
4answers
415 views
Calculate class to practice encapsulation
I realize this is very beginner code, but I just today grasped the basic concepts of private variables, constructors, and such. I wrote this very simple class, and a class to test it. Any and all ...
5
votes
3answers
216 views
Taking student scores from a file, calculating averages, and printing
This program takes scores for each student from a .txt file and calculates their averages, as well as the average for each assignment and the class overall. This program works properly, just curious ...
4
votes
1answer
33 views
“Word-Target” Puzzle Solver in Java
Have recently been writing a few puzzle solvers in Java, this is my latest attempt. It solves the "Word-Target" puzzle found in some newspapers. You may have seen it before:
Words must be found by ...
4
votes
2answers
161 views
Simple Chained HashMap
I am very inexperienced at C++. I wrote a Hash Map which uses chaining for collision resolution. I intentionally did not use smart-pointers, as the objective of this was to learn and showcase. I ...
12
votes
4answers
519 views
Generating an ordinal number for the day of the month
I am relatively new to programming and came across an if statement that I believe to be a bit verbose. I have tested my code and it appears to work without any ...
1
vote
1answer
33 views
Differentiate simple expressions
This is the first program I have written in Rust and I would like to know what some Rust experts think of it. I must be doing some stuff wrong, such as breaking code style, etc. The code ...
5
votes
1answer
55 views
Calculator with order of operations
I am trying to make an additional option in my beginning calculator program, which is based on the BigDecimal class: the simultaneous solution for the entire ...
2
votes
1answer
90 views
Database Access Object Class
I learned of the Database Access Object design pattern from a friend and decided to implement it recently to my MySQL database. The code uses MySQLi to connect to the Database, and uses prepared ...
4
votes
3answers
238 views
Simple Linked List that holds an int
I am inexperienced in C++. I was able to get my LinkedList to be fully functional. I was hoping to get some feedback as to whether or not I followed bad practices ...
4
votes
3answers
146 views
String replace templating utility
I am new to Python and I am writing my first utility as a way to learn about strings, files, etc. I am writing a simple utility using string replacement to batch output HTML files. The program takes ...
4
votes
1answer
44 views
Binary Digits to ASCII Characters
I wrote this code, as a novice a to Prolog, for a challenge posted on /r/DailyProgrammer. The formal description of this challenge, as presented in the prompt reads:
Input description
On ...
3
votes
1answer
24 views
OVH email manager script using docopt
This is what I coded to realize a command line program to make it easier to manage emails on ovh shared hostings. It's working ok but it seems ugly.
I'm a beginner with Python and ...
6
votes
2answers
178 views
Beginning calculator program
I am a beginner in Java and programming at all. I decide to try to write a calculator, as a my first "complete" program. It works for me, however I am curious is it worth anything in reality. I would ...
7
votes
2answers
87 views
“Lost in the Woods” text-based game
This is my first Python text-based game. Let me know if there is something I should improve on or fix in the way that my code is written because I feel that I am being very redundant in my code, but ...
1
vote
0answers
19 views
Conway's Game of Life in Python3 (follow-up)
I asked for a review of my code, and after making the suggested changes I feel that now the OOP version is clearer in its meaning and overall the code looks cleaner.
...
1
vote
1answer
47 views
Wrapper classes for objects returned by 3rd party APIs
I am building a WPF application which uses a third party library to fetch objects which I want to allow the user to interact with.
The objects are returned as interface types. Am I right in thinking ...
13
votes
4answers
678 views
Coin dispenser program
I've decided to go tech and learn a language. I have been reading Java for a week and here is my first attempt. I am making a habit to write JUnit test cases so that I start on correct path. Here is ...
5
votes
1answer
302 views
Conway's Game of Life in Python3
I've implemented Game of Life in Python for a programming problem, in two different versions: one is a simple script and the other uses a class with a dictionary to initialize the various parameters.
...