Homework means the question is requesting help with school homework. This lets potential answerers know that they SHOULD guide the student in solving the problem, and SHOULD NOT simply show the complete answer.

learn more… | top users | synonyms

-1
votes
0answers
34 views

Creating a tuple out of a list [closed]

For homework I need to make a 4 tuple out of the given list.(Datatypes can be gathered from looking at below code along with the format required). I don't understand the error message I receive--no ...
4
votes
2answers
69 views

Infix to Postfix Converter Program

This is my homework. Kindly help me check it? The instructions are: Implement an infix expression to postfix expression converter. You are to implement the infix to postfix algorithm presented ...
10
votes
5answers
829 views

Caesar cipher cracker

How can I refactor this with less code? This is homework and is cracking a Caesar cipher-text using frequency distribution. I have completed the assignment but would like it to be cleaner. ...
1
vote
1answer
58 views

Verify assembly code implementation [closed]

This is part of an assignment. I believe it forms a while loop which looks like my pseudocode below, but I'm not sure I'm interpreting it completely correctly. ...
8
votes
2answers
117 views

Finding the longest Collatz sequence cycle

I wrote a program to calculate Collatz sequences for initial numbers between 1 and a given integer i, then find the one with the largest cycle length. My code is ...
10
votes
5answers
606 views

Yahtzee game (using arrays and object classes)

As part of an assignment for my intro Java class (please bear with my beginner skill set), I'm working on a program for which a Die object class is used to play a Yahtzee game. An overview of the ...
6
votes
1answer
77 views

Text Analysis web page

For a homework assignment, I made a web page that has a text area. The user inputs some text, hits the analyse button, and the output is supposed to be a list of the frequency of words of a given ...
5
votes
2answers
440 views

A Sudoku game made from Google's Dart language

This is my first real web project and I have never touched JavaScript (barely touched CSS), so I just skipped that and went to dart for fun. Here's a live demo The code for the dart file is down ...
7
votes
3answers
418 views

Depth First Traversal of a Graph

I am learning how to implement a basic undirected graph and perform a depth first traversal. Please critique my code for correctness, best practices, security, and any other comments that may be ...
3
votes
2answers
193 views

Pascal triangle algorithm is good but fails

I have created a function which returns the number that corresponds to the given row and column from the pascal triangle. I have used the formula for this: n! / r! * (r-n)! The code: ...
1
vote
1answer
58 views

Determine how many bits are in a floating point value [closed]

I'm writing a program which determines how many bits are in a floating point value (this will be run on Unix). ...
4
votes
1answer
117 views

Winning Loop Connect 4

I am writing a fully functional single player Connect 4 game. I am working on the second player and the while loop that tells the player who won. GUI ...
5
votes
2answers
256 views

User input and reading contents of file

For full disclosure: this is an assignment for my programming class and I just want tips or advice on some of the code. Assignment details just for background information purposes: Write a ...
5
votes
1answer
532 views

Rock, Paper, Scissors in Python

I was eventually going to add another computer and more options to this (i.e., Rock-paper-scissors-lizard-Spock) but I wanted to make sure I was using the best practice for this type of game. Any help ...
1
vote
1answer
355 views

Bank ATM program in Python

For homework, I have to code a program in Python that effectively simulates a bank ATM. ...
7
votes
4answers
457 views

Basic Calculator

I'm in a beginner JavaScript class and I feel like I have a pretty good grasp on all the intro material. All of my homework assignments work but they seem longer than they have to be, especially my ...
6
votes
2answers
460 views

Pass an array of numbers into a method that's overloaded

I'm doing my homework and it says to write a test program that prompts the user to enter ten double values, invokes this method, and displays the average value. I was able to get this program working ...
7
votes
2answers
111 views

Dictionary brute force on DES encrypted passwords

For a school project I am tasked to decrypt DES passwords. I have sample code provided below and I want to know if this is the best method. Also should I code in error handling for the dictionary ...
3
votes
2answers
123 views

Adding/Removing Colors to Lists

I would like the program to ask the user if they want to add a color. If they say yes, then ask what color to add. Then after that happens, once the program would ask if you want to, run it again. If ...
10
votes
4answers
564 views

Suggestions for a Dungeons and Dragons-like game

This game is similar to a Dungeons and Dragons game. How could I improve the efficiency of the program? For example, where can I add functions, records etc? This is for a school Controlled ...
7
votes
2answers
240 views

Search procedure to find inputted DWORD in MASM Array

Is there any way to make this more efficient? ...
4
votes
2answers
368 views

Using threads to find max in array

I really do not have access to anyone, outside of professors, that is highly knowledgeable about Java so I figured I would post my stuff here to further my knowledge and improve my coding. This is ...
6
votes
1answer
102 views

Finite Automaton for a Typing Game

I'm creating a game that implements a finite automaton and I don't know if I'm doing it right. Any advice? Game class ...
5
votes
1answer
150 views

Fallout-style homework game

I've been going through LPHW (learn Python the hard way) lessons and I am now at exercise No36 where I have to create a similar game. Could you please review it and point out beginner mistakes? ...
10
votes
4answers
918 views

Lexical Analyzer: Is this the right way?

I'm doing a lexical analyzer for my programming language and I don't know if I'm doing it right. Can anyone can help me with this or suggest a better way of doing it? ...
18
votes
8answers
3k views

Feedback on a programming practice problem in C

This is a programming practice that our teacher gave us, and I would appreciate if someone can look over my program and tell me if I did a good job. Basically, the context is I joined a company and ...
5
votes
1answer
145 views

Optimization for add function in queue

I would prefer if more experienced users could give pointers on how I can optimize and think better when writing code. Using Homework Questions as reference, as this is a homework related question. ...
1
vote
0answers
79 views

Simple Hexadecimal code to Seven Segment display [closed]

I'm currently learning VHDL and it is honestly a headache when it comes to getting it to compile. I've tried to get it to be as painless a process as possible, but the instruction from my professor is ...
2
votes
2answers
88 views

Rational arithmetic calculator

My program is a fraction calculator that is supposed to calculate the basic operations (+, -, *, /) and is supposed to exit when I enter % as my sentinel value. This is what I have so far; any ...
7
votes
2answers
153 views

Inputting and displaying strings

I have written some code for one of my assignments. However, I feel that I am repeating myself slightly in a few places. I have that niggling feeling that there is a better way to do things. Here ...
5
votes
1answer
109 views

Build object from database without a discriminator column?

I currently have a basic application that has a database backing it. I originally connected to the database with Entity Framework, but my tutor has requested from me to recreate the functionality with ...
6
votes
2answers
169 views

Design feedback for automaton to draw a checkerboard pattern

I've just completed the 3rd task of the 1st assignment offered by Stanford's programming methodologies (see the full resources for it here too). I just need some helpful feedback on how my code can ...
3
votes
1answer
81 views

Hangman game background image inefficient?

I'm making a Hangman game and it seems that my code doesn't provide me much freedom with using layouts. I added an image to my JFrame then I added a JPanel to my image which I'm using for all the ...
1
vote
1answer
90 views

Can this code that calculates kills and deaths in a game be written to execute faster?

So I'm trying to make a program that calculates your kd ratio(Kill/death, it's used in FPS games to make people belive that it's skill), how many kills you need without dying once to reach a goalKD. ...
2
votes
2answers
52 views

Which way should I use while writing this method?

I've got a homework that is about methods. So first part is Write a method that prompts the customer for the car type. There are three acceptable car types (E: Economy, M: Midsize, F: ...
4
votes
3answers
102 views

Sorting strings in a one dimensional array

What are the better solutions possible? I have a character array with different strings. There is a max size for the strings. In case a string is smaller than max size remaining places are filled ...
8
votes
5answers
3k views

Return a string without the first two characters

I'm new to Java and am trying to solve a scenario. Even though I've succeeded and it works, I've just wondered if there was a more practical way of doing this task. Is there a quicker or more ...
2
votes
4answers
321 views

Printing a rectangle

I have an assignment as follows: Write a program which reads from the keyboard two integers n and m, and a character c from the keyboard. This program should define and call a function: ...
15
votes
3answers
740 views

Commenting in Python and general semantics

I am struggling with commenting and variable naming. My teacher says my comments need to be more explanatory and explicit. He says my variable names are also sometimes confusing. I was just wondering ...
9
votes
2answers
531 views

Guess a random number between a selected interval

My project for my class is to create a Java-based game where the user must enter a number between 1-20 and a number between 250 and 300. The computer randomly chooses a number between those 2 numbers. ...
5
votes
3answers
215 views

Hour averaging program

I am looking for tips on improving my short program. I am using system("PAUSE") because this was for an assignment. Code: ...
3
votes
3answers
203 views

How could I write this simple Javascript App better?

I've written this simple JavaScript application for a homework assignment and I've received feedback saying it could be written better. Can I get some feedback on how to write this differently? It ...
1
vote
2answers
2k views

Calculating a total price by using switch statement and sentinel controlled loop

My homework is to make a program that calculates the total value of products sold. It works, but I use the if statement because it was asking for the quantity on ...
5
votes
1answer
257 views

Roman numerals to decimal

This is an assignment for class. I would like to know how to improve my code. It is a program to convert Roman numerals to it's decimal equivalent. This is what I have so far. There must be a better ...
0
votes
1answer
92 views

Processing a string from the console

How can I make this program run faster? On enter, I have a string from the console. For example: 1 1 7 3 2 0 0 4 5 5 6 2 1 On exit, it will be ...
8
votes
2answers
4k views

Perfect Hashing Implementation

I'm building a hash table for this problem: Implement a class for storing a set of integers: ...
2
votes
2answers
158 views

In-order Predecessor BST review

I was referred here from StackOverflow, so here is what I posted over there: So, for an assignment, I have to construct a binary search tree, plus an assortment of related functions. I have them all ...
5
votes
1answer
473 views

How is my quarterly sales statistics program?

Am I making good use of a 2-D array? Is this code inefficient? I am supposed to receive input from 6 departments for 4 quarterly periods in Java. My assignment asks: Quarterly Sales Statistics ...
5
votes
5answers
1k views

Making palindrome program more efficient

I wrote a program for a college assignment, and I'd like to receive some pointers on making my code a little more efficient. It'd be much appreciated. I'm still new to coding, so I apologize if my ...
6
votes
4answers
311 views

Organizing semaphores into a pyramid

My homework was to organize semaphores into a pyramid. The task was accomplished, but I ended up with this long ugly conditional and was wondering if anyone can see a better way/algorithm to ...