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
3
votes
2answers
232 views

Simple C# calculator

I'm doing a simple calc for my school. The code looks okay to me, but I'm not sure if there is something to improve, but probably there is always something to improve. Any ideas how to make it look ...
2
votes
2answers
134 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
422 views
1
vote
1answer
620 views

Python 3.6 Dice Histogram: Using random.seed effectively

I am not 100% sure that I am using the random.seed correctly for this assignment, or if there is a more efficient way to write the code. Any feedback is appreciated. Assignment Description: Simulate ...
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 ...
16
votes
5answers
21k 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 ...
24
votes
9answers
35k views

Most efficient way in C++ to strip strings

If I want to strip a string completely of its whitespaces, punctuation and numbers (i.e. anything that is not A-Z, a-z), what is the most efficient way of doing it in C++? I tried this: ...
2
votes
2answers
388 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 ...
-1
votes
1answer
569 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 ...
3
votes
1answer
153 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
351 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 ...
7
votes
4answers
44k views

Count occurrence of words in a .txt file

I'm taking an intro to programming class and although I've learned some things I didn't know before (I've been using Python for about 1.5 years) I feel like I've not progressed much in writing "...
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 ...
0
votes
1answer
47 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. ...
2
votes
2answers
5k views

Priority Queue Linked List Implementation

I am new to Python and wanted to make sure my code answers the question for my assignment due. My Task: A priority queue is a queue in which each item is assigned a priority and items with a ...
6
votes
1answer
65k views

Bank ATM program in Python

For homework, I have to code a program in Python that effectively simulates a bank ATM. ...
3
votes
1answer
75 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....
9
votes
2answers
4k views

Symmetric Square

I was given an assignment to ensure that a list was symmetric. I built it in a way that worked and it passed the tests. But I wanted to see if it could've been written more efficiently and still ...
1
vote
1answer
1k 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: ...
4
votes
2answers
584 views

UPenn CIS 194 Homework 1: Validating credit card numbers

I am working through UPenn CIS 194: Introduction to Haskell (Spring 2013). Since I am not able to take the course for real I am asking for CR (feedback) as it could be from teacher in that course. HW1 ...
2
votes
0answers
80 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
52 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 ...
4
votes
2answers
177 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 ...
6
votes
3answers
576 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, ...
2
votes
1answer
3k 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
4k 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
2answers
3k 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
120 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
125 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? ...
0
votes
1answer
256 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 ...
0
votes
3answers
14k views

Cartesian product of two tuples - python

I'm solving exercise 4 from Discussion 3 of Berkley's CS 61A (2012) (see page 4): Fill in the definition of cartesian_product. ...
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 ...
2
votes
1answer
202 views

High School Java Class: Pong Project External Reviewer

It would be a huge help if you could tell me ways to make my code run smoother and if I could add more code to my program to make my program more unique. Panelball class: ...
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 ...
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 "...
19
votes
3answers
59k views

Java implementation of spell-checking algorithm

This little program was written for an assignment in a data structures and algorithms class. I'll just note the basic requirements: Given an inputted string, the program should check to see if it ...
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
3answers
6k views

Beginner Java Counter code

My professor wants me to do this: Write a number of interchangeable counters using the Counter interface below: ...
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 ...
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 ...
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 <...
1
vote
0answers
1k views

Pac-Man-ish maze game

I am a freshman in university. This Pac-Man-ish Game is my final Computer science homework. I know my code is not perfect and has so many to be improved. However, Compared to corrections of this game, ...
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 ...
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 ...
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: ...
6
votes
2answers
346 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 '...

1 2
3
4 5
10