Questions tagged [homework]

Questions requesting help with school homework. This tag lets potential answerers know that they should GUIDE the student in solving the problem, rather than showing a complete solution. CAUTION: Before posting, consider that classmates may be tempted to reuse code from your post. (Read the tag wiki.)

Filter by
Sorted by
Tagged with
0
votes
1answer
257 views

Java exercise: String processing and type conversion

The exercise is from a Java-course in which I'm enrolled. The classes Book and APIResponseParser were provided by the instructor. For Book I had to add just a few getter- and setter-methods. For ...
1
vote
2answers
2k views

GPA calculator, implemented for a course

This is from a Java course which I'm taking. The class StudentUtil, including method-declarations and comments, was provided by the instructor. I just had to finish ...
8
votes
3answers
5k views

Convert binary string to decimal number

I'm finishing the book C Primer Plus by Stephen Prata and I wrote as a part of the homework program to convert binary string to decimal number: ...
8
votes
1answer
150 views

Multi-layer perceptron program is super slow

I'm writing a multi-layer perceptron from scratch and I think it's way slower than it should be. the culprit seems to be my compute_gradients-function, which ...
4
votes
2answers
2k views

Calculate with fractions

This program is a solution to homework given by our professor. So I want my program to be the most beautiful program ever written. Therefore I want to know where I could improve the quality of the ...
6
votes
4answers
2k views

Spell-checking application in C++

This is my current coursework for university where I am to write a spell checking application and compile using C++11. I have a dictionary file that is read into the program automatically and stored ...
1
vote
0answers
305 views

java - A* search algorithm

I'm having trouble with my homework implementing A* search algorithm in java, I'm given the graph, origin and destination, I had to follow some specific tasks in the homework so the code might be a ...
3
votes
1answer
177 views

“Code Breaker” in JavaScript

...
2
votes
2answers
165 views

Checking for win on a wrap-around Connect 6 board

I have a method, that checks win conditions on a "Torus" board, which is a board without any borders. This means that if you place 4 diagonal stones on the top left, and 2 diagonal stones in the ...
3
votes
2answers
9k views

Circular Queue Implementation Using Array in java

Here is my code of Array Implementation of Queue in java. ...
2
votes
0answers
157 views

CIS 194 - UPenn Haskell Course (2013) - Homework 4 - Tree Folding

I have been self studying the UPenn Haskell course, and I am unable to get feedback/grading on the assignments complete. This specific portion that I am having concerns with asks to write a function <...
5
votes
2answers
2k views

Guess user number between 0 and 100 (Binary Search)

I am at the beginning of learning python and one of my homeworks (in chapter regarding loops) where to write a code that would guess user number between 1 - 100. I believe I used algorithm called ...
17
votes
3answers
4k views

Python code that sorts books

I am currently a student just starting to learn python and I need help improving my code for a school assignment. I've already written the code for the program, just need suggestions on how to improve ...
7
votes
3answers
164 views

Splitting a rectangular chocolate bar

I'm having trouble with my school homework. I have a chocolate bar that consists of either black, white or black&white (mixed) squares. I'm supposed to divide it in two groups, one that has only ...
6
votes
2answers
347 views

C code, rewritten to use a Person struct without pointers

I'm new to C and I have been assigned the task of converting some code that uses structs with pointers to code that doesn't use pointers. I would be interested to know if the code I have written is '...
2
votes
2answers
108 views

Variables, references and pointers - Write the function set (…) so that the following code works correctly

I have following homework exercise from lecture "Variables, references and pointers": Write the function set (...) so that the following code works correctly: ...
2
votes
1answer
92 views

Variables, references and pointers - Write the function zero (…) so that the following code works correctly

I have following homework exercise from lecture "Variables, references and pointers": Write the function zero (...) so that the following code works correctly: int x = 3; zero(x); ...
3
votes
1answer
2k views

Make a smart move in a connect-4 program

An assignment this past semester was to write functions such that the following C program would run: ...
3
votes
1answer
2k views

Optimizing Needleman-Wunsch algorithm in Java

For a class assignment, I was required to implement the Needleman-Wunsch algorithm in Java. I have already completed the assignment but I was wondering if there were any algorithmic (or even syntactic)...
2
votes
2answers
1k views

Phone Book Program in C++ - Final Follow Up

I hope I am not going against any rules on this site. This is my last follow up question, and I believe I am ready to turn this code in. (It is a homework assignment and I am required to use linked ...
0
votes
2answers
818 views

Data structure to count occurrences of words

I have some code for a assignment where the main marks are awarded based on efficiency. The program uses a given wordgenerator which generates random words and adds them to a user-made data structure. ...
7
votes
2answers
1k views

Simple Battleship written in Python

I would appreciate feedback on my first Battleship game written in Python for my intro to programming class. Here is the code, the only thing in here is that I use a clear screen function from one of ...
3
votes
1answer
864 views

Phone Book Program in C++ - Follow Up

This is a follow up to this question. I have taken the suggestions given to me and implemented them in my code, as well as moving towards adding more features to the program. I am unfortunately ...
3
votes
1answer
1k views

Singly linked list for a marble game

I have an assignment in programming using Java, which is about a marble game. When you're entering a marble the marble has a color and a value. When there's 4 of the same color in a row it will be "...
6
votes
2answers
12k views

Phone Book Program in C++

I am starting out a school project to build a phone book program in C++. It stores contacts in a linked list. This currently does not have all the validations I would like to implement, and is all in ...
2
votes
1answer
4k views

Case-insensitive replacement of “java” with “JAVA” using String.substring()

Assignment: Create a program Substitute that gets a sentence from the user and replaces every occurrence of the word java (uppercase, lowercase, or a combination) with JAVA. You may not change the ...
1
vote
1answer
884 views

Find all occurrences of the word “the” without using regex

I have an assignment to find all occurrences of the word "the" without using regex: Use the indexOf method to do this. The word "the" could also appear in a ...
4
votes
2answers
174 views

Simple JavaScript library for DOM interactions

I got this pretty interesting homework assignment, which was to finish off a very simple Javascript library. I couldn't use jQuery. First, I will show you the raw piece of code that I received, then ...
4
votes
2answers
6k views

Pascal's Triangle - Java Recursion

This is a fully functional implementation of a program to ask the user for a location on Pascal's Triangle, but I kind of cheated by expanding the base case to include row 0 and the 1st and last ...
5
votes
1answer
805 views

CPU scheduling simulator

Recently I completed my first assignment at the university. The assignment is : Write a CPU scheduling simulator that uses the Shortest Job First and Priority scheduling methods. Both of these ...
2
votes
2answers
508 views

Check if num X is divisible by num Y

I wrote some code for a course: Create a program that takes two numbers from the user then find out if the first is divisible by the second. If not divisible, let the user know what the remainder ...
9
votes
4answers
4k views

Checking for parentheses balance in C

A recent assignment asks me to create a program that checks for parentheses balance in a given string. As I can't find any duplicate questions that have code written in C, I decided to post another ...
4
votes
2answers
295 views

Function to calculate the ordinal day

I just handed in my first assessed coursework for my Computer Science degree. Part of it was to take in a date (dd mm yyyy) between 1900 and 2100 and output the ...
5
votes
1answer
157 views

Scan the user input and then work with these letters

The program scans a maximum of 10 chars from user and then offers you 4 options what you can do with that array. Options are: 0 = quit the program, 1 = prints whole array, 2 = count all the small ...
3
votes
0answers
55 views

Find spanning tree with maximum edges with the same weight

For my university assignment I need to come up with an algorithm to find a spanning tree with maximum number of edges with same weight. I received an algorithm suggestion in this Stack Overflow answer....
4
votes
3answers
19k views

Sort numbers in ascending order using Python

This is Python code to sort the numbers in ascending order (It's my school task). How does it look? It works, but I think that this can be improved. ...
5
votes
2answers
2k views

A Date Class with simple methods

This is homework from one MOOC(no requirement of forbidding paste codes online). The title gave me a framework: ...
2
votes
1answer
499 views

Searching for an object with spectific property, using user input

I have just started my adventure with C#. Below you can find a code written for my school assigment. The homework task had 3 major elements: building a class book creating a metod for changing the ...
7
votes
2answers
230 views

Rewritten implementation of quadratic equation formula

I just started learning the C programming language at the university, and today we got a new assignment there is about Refinement of a C software there is designed to find the roots of the general ...
1
vote
2answers
76 views

Mapping a robot's obstacles based on its position and sensor data

I have a grid in which I'm adding different cell-blocks to, depending on what rotation I'm currently receiving. @@@ = Map border ...
5
votes
1answer
313 views

Appointment Program In Ruby

For a homework assignment for an online class (pretty much learning everything from the internet anyway) we were asked to build an appointment program. This is just a start, however I feel I am ...
2
votes
3answers
3k views

Calculating work using dot product in C++

Write a C++ program fulfilling the following task: The user should enter the 3 dimensional force vector F and a 3 dimensional length vector s. The force is assumed to be constant. The program then ...
4
votes
3answers
118 views

String reversal function

I have an assignment to create a function that reverses the letters of each word in a string individually. I feel like this should be a rather simple task. I did figure out a solution, although I feel ...
1
vote
1answer
539 views

9×9 Connect 4 for 2 players

As a high school assignment, I was asked to make a Connect 4 game in Java. I have created a 9×9 2-D array that two players can play. I'd appreciate any feedback or suggestions. ...
1
vote
2answers
138 views

Finding nodes around a given node in a grid

Even though I have completed this assignment, the direction() function is just irking me. I feel like there is a better way to do it, ideally gaining on execution ...
7
votes
2answers
13k views

'Snakes and Ladders' game

I made this game of snakes and ladders for school, and it has to have: Multiple players Player Names Random Dice roll Snakes and ladders (obviously!) Subroutines It is currently 124 lines, ...
7
votes
3answers
666 views

Displaying “C++” in ASCII art with user inputting an integer

I have a school assignment and would love it if you can criticize or give a couple of pointers/advice about my piece of code (don't give me the answer, breaks the point of the exercise). Here's my ...
3
votes
2answers
504 views

Base Conversion in Node.js

I am doing a program for my APCS class in Node.js to practice node, but I am unsure if I did everything the best way possible. The assignment is to take the number and base as user input and then ...
3
votes
3answers
2k views

Blackjack Game in Ruby

I built a simple Blackjack game in Ruby on Rails, and am looking for feedback, because I believe I may have overcomplicated things. This was a homework assignment, where I was told to make 1 be an Ace ...
4
votes
3answers
107 views

Personal HTML page for beginner CS lab

I'm completely new at programming and have started to study computer science this fall. Our first lab is going to require us to make a very simple web page like the picture LAB attached. I was ...

1 2
3
4 5
10