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
-1
votes
1answer
271 views

Compound interest calculator homework [closed]

I am a beginner at coding Java and am having a tough time understanding what is wrong with this code. This is an assignment I had posted about earlier and I also went to a Java tutor at my school for ...
2
votes
2answers
124 views

Simple console based car array

I have recently started coding in Java and I had to do this assignment in college. Develop a menu driven application called TestCarPartc that allows the user to ...
2
votes
2answers
111 views

Integer to Roman Numerals (1 - 2999)

This is a homework assignment. Convert an integer (1 - 2999) to roman numerals. I was wondering if I could make my code more efficient. The way I have it set up is that I take the digits of the input (...
3
votes
1answer
111 views

Given a list of words, remove the shorter word of every pair

This is not a "please do my homework" question. I solved a problem two ways and would like to know which solution is better; better being defined by better readability, lower complexity and lower ...
0
votes
1answer
195 views

Yet another vending machine

I recently got a homework assignment from my C++ teacher. The verbatim assignment was this: Write a program that simulates a vending machine. A customer selects and item for purchase and inserts a ...
0
votes
1answer
45 views

Collate a growing number of String arrays and search through them [closed]

These string arrays are used to classify whether the incoming feed/message is a driver feed or team feed. ...
19
votes
2answers
1k views

Dungeon Crawl game for the terminal

I am learning C++ and I attempted to do one exercise I found: Dungeon Crawl. The goal of this game is to reach the treasure by moving your character along the board. The exercise asks not to use ...
3
votes
1answer
65 views

Dividing an arbitrary dollar amount into the fewest bills and coins

I am taking a class in mobile application development this fall. I have finished my first assignment of creating a class to divide an arbitrary dollar amount into the minimum number of bills and coins....
1
vote
1answer
954 views

Count occurrences of a specific sequence in a list of many numbers [closed]

The script will work through each number from 0 - 10. aList=[3,5,... over 10k numbers ...,2,2,6] Let’s say, for example: ...
2
votes
0answers
60 views

Regression on Pandas DataFrame

I am working on the following assignment and I am a bit lost: Build a regression model that will predict the rating score of each product based on attributes which correspond to some very common ...
0
votes
0answers
45 views

Nested cross-validation

This is a homework assignment to implement nested cross validation. It seems to work fine (sometimes). The imports are inside the class and some methods are static, because this code needs to be in ...
2
votes
1answer
2k views

Vehicle inventory program

First time posting here, let me apologize ahead of time if this is not the correct format.. Anyway, I am new to programming and I am working on a school assignment to design a vehicle inventory system ...
3
votes
2answers
2k views

Snake Game in C++ using OOP

I am currently a student and I have an assignment in my OOP C++ course where I need to create a snake game using these specific requirements. I added some features into snake to fit these requirements ...
6
votes
3answers
550 views

C++ code to read, sort, and write data

I had written code in C++ to create transformation filters to get input, sort (custom_sorting and existing sorting routine) and write the output to stdin and file. When I presented it to my teacher, ...
7
votes
1answer
151 views

Avoid incoming meteors

I'm visiting a functional programming course at my university which has a small project for examination. The language we are using is clojure and the contents of the lecture have mostly been about it'...
6
votes
2answers
1k views

Generate array with random numbers and search for an element in it

This is a school project I've written. It works, but I feel it could be done better. The program generate an array of 1'000 random numbers, and searches for a number typed into console, and displays ...
3
votes
2answers
95 views

Stack implementation in C

I have to solve an exercise from ANSI C book: Add the commands to print the top elements of the stack without popping, to duplicate it, and to swap the top two elements. Add a command to clear ...
0
votes
2answers
110 views

Secret hangman homework

Recently I was given homework to make a hangman game, where I wrote the below. How can I refactor this to use classes? ...
4
votes
2answers
114 views

K&R C book - exercise 3.3

I have an exercise in my ANSI C book: 3.3. Write a function expand(s1,s2) that expands shorthand notations like a-z in the ...
0
votes
1answer
147 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
1k 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
3k 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: ...
7
votes
1answer
117 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
1k 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
769 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
161 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
118 views

“Code Breaker” in JavaScript

...
2
votes
2answers
142 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 ...
1
vote
2answers
5k views

Circular Queue Implementation Using Array in java

Here is my code of Array Implementation of Queue in java. ...
2
votes
0answers
127 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
842 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
118 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
170 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
56 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
41 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
884 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: ...
1
vote
0answers
1k 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
666 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
469 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
769 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
516 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
792 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
8k 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
3k 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
768 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
163 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
4k 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
562 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
279 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 ...