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 vote
2 answers
2k views

Program that reads a string from the keyboard and tests whether it contains a valid date

I know this task could be done in more practical ways, but the professor only want us to solve it with the "if" statement. I tested and it meets the condition for each task, but I still feel this code ...
Anderson's user avatar
9 votes
3 answers
26k views

Python class to implement a list with a size limit

I am currently working through a python course about objected oriented programming. I was given this first assignment to work on: Create a simple class, MaxSizeList, that acts a little bit like a ...
Jaff's user avatar
  • 93
3 votes
1 answer
407 views

Student project that calculates the return on an investment

This is a simple student project that calculates the return on an investment with a given investment amount, number of years invested, and annual interest rate. I know this is pretty basic, but I'm ...
Joshua Ferrell's user avatar
5 votes
1 answer
3k views

Connect Four class project

I am in a computer coding class and we have to make a project for Java. Is there any way we can better our existing connect four code? ...
NewToJavaPleaseHelp's user avatar
5 votes
2 answers
5k views

Adding two Integers in an Array

I was wondering if I could get a second look at my program before I turn it in. The job was to code a program in java that adds two integers to an array gather the sum while displaying the integers ...
Staticmeek's user avatar
1 vote
0 answers
839 views

getDayOfTheWeek function, without using built-in date libraries

I have an assignment to create a method to retrieve the proper day of the week for any given date, without using the Java calendar. After countless hours of trying to implement the algorithm in the ...
Kufo0's user avatar
  • 19
6 votes
2 answers
205 views

Denoise an image under extreme time pressure

I'm working on a real-time, embedded system image processing application for my group engineering capstone in undergrad. I'm receiving data at 60FPS, and have to isolate and detect the location of a ...
tbadams45's user avatar
  • 245
0 votes
1 answer
442 views

Adding two extremely large numbers using a custom data structure

I have an implementation to add 2 extremely large numbers, greater than the ceiling provided by long, e.g. 1238913893838383813813813813838... I created a LinkedList ...
Bilal Ekrem's user avatar
4 votes
1 answer
5k views

Login program in Python

I wrote this login program as part of my project for school. Should I use my implementation of a login program, or is there some standardized patterns of login programs, like the ones in encryption ...
Newbie's user avatar
  • 43
1 vote
5 answers
816 views

Three Cards Monte game

I have written the following code for the Three Cards Monte game. It works as expected and returns the required output. However when I tried to turn it in to the teacher, he keeps saying its too ...
jackmasterlooter's user avatar
3 votes
2 answers
1k views

Order line reversing (reversing line order)

I'm a student learning to code in C. I had to make a program for class to reverse lines of input from the keyboard (not character wise, but reverse the order of the lines input). The program is ...
Seb M's user avatar
  • 33
3 votes
2 answers
346 views

Finding perfect numbers

My teacher wants me to find all the perfect numbers between 2 and 1000 and must use: for loops % operator to determine if a ...
BaseFloating's user avatar
4 votes
1 answer
7k views

Print all possible subsets of an array

I solved the problem to print all possible subsets of an array. I just want to know a better approach or anything different I could have done. Question: Print all possible subsets of an array. My ...
user avatar
2 votes
1 answer
96 views

How could I shorten my code in this old graded homework?

I have this old graded homework, I am looking how to improve the or shorten the code, I have some lines with over 200 chars. ...
Blue Monday's user avatar
7 votes
3 answers
351 views

Homework / toy program - character matching

Given a string A = "Hello world" and another string B = "wor", I have to print ("TRUE" or "FALSE") whether the characters in <...
babon's user avatar
  • 171
25 votes
5 answers
21k views

Implementing realloc in C

I have an assignment to implement realloc in C, This's my code please review it. ...
Junius L's user avatar
  • 779
10 votes
1 answer
263 views

Game of 15 - A* search

I would be really thankful for review of this homework. I'm trying to write better code in terms of readability and design patterns. This program solves the classic 15 slider puzzle with A* search. ...
Akim Akimov's user avatar
2 votes
1 answer
100 views

The fastest "find"er of them all?

For part of a project, I was given this directive: The find command will use the directory (dirent) function calls, but will require you to start at a directory and then determine if a file is ...
syb0rg's user avatar
  • 21.8k
6 votes
1 answer
575 views

Search a file (simple grep clone)

For part of a project, I was given this directive: The grep command will take an exact string and an exact filename as the 2 arguments and you will need to search through the filename for the ...
syb0rg's user avatar
  • 21.8k
6 votes
1 answer
160 views

List directories (with information)

For part of a project, I was given this directive: The “ls” command will require you to use directory functions to list out what the filenames are in the directory. Functions required to make a ...
syb0rg's user avatar
  • 21.8k
2 votes
2 answers
2k views

Read in file, and then compute class mean, median, max, min, class averages & update file

The application is designed to read in class results of individual students from a single text file, and then manipulate the data to give information such as class mean, median, max, min, individual ...
user36278's user avatar
  • 347
3 votes
2 answers
88 views

Information about a nightclub in semantic HTML

Could anybody have a look at my HTML code and tell if it's build upon the correct semantic way using the right tags, and not using unnecessary divs? I'm still not sure if there any divs in my code ...
Niekket's user avatar
  • 31
4 votes
2 answers
114 views

Red light, green light... kinda

For an assignment I had to create a client and a server that communicate over a well known FIFO. The server is required to use three threads to serve the client, managed by a semaphore. The code was ...
syb0rg's user avatar
  • 21.8k
3 votes
3 answers
1k views

Guess three random numbers in order

We were given a homework assignment to create a C++ program that generates 3 different random numbers each time and the user is supposed to guess the three of them AND in order. I already achieved ...
Jad's user avatar
  • 33
2 votes
1 answer
4k views

Swapping the diagonals of a matrix [closed]

I am required to write a simple matrix program and swap the diagonal. Given the input 1 2 3 4 5 6 7 8 9 After swapping the diagonal it should be ...
Ardley's user avatar
  • 21
4 votes
2 answers
3k views

Console Ultimate Tic Tac Toe game

Last week I wrote a C++ program on Ultimate Tic Tac Toe. The issue was that the program was a bit lengthy (~230 lines) and it is needed to be around 150 lines. I absolutely am not asking you to go ...
Max Payne's user avatar
  • 359
1 vote
1 answer
203 views

Some kind of encryption in C++

It's my university task. Can I get some opinions on it? ...
Stepan Vanzuriak's user avatar
7 votes
3 answers
2k views

Generating Pythagorean triples below an upper bound

I've got an assigment where I have to print all the Pythagorean triples smaller than a given n. Even though I could print them directly in ...
SnuKies's user avatar
  • 173
5 votes
2 answers
3k views

Using C++ to check if string s is subsequence of string t

The problem I want to solve is very simple: Given a string s and a string t, check if s is subsequence of t. there is only lower case English letters in both s and t. t is potentially a very long (...
helloworld's user avatar
1 vote
1 answer
868 views

Integer sum program

This is a little assignment I am working on. I am a beginner Java programmer and would love some advice on how to improve this code. For more context, here are the assignment details: Create a ...
jzbakos's user avatar
  • 395
4 votes
3 answers
78 views

Burning logs - really simple text game

What I have I am a bit advanced PHP developer, but now I'm going to college where we are learning Ruby. We got the first homework and I did it. But I wanna make great code - so I looked for standards ...
Karel Poláček's user avatar
3 votes
1 answer
56 views

Filetype backup script

This was one of my assignments in which I had to create a backup script that will individually compress all files (of an arbitrary number) of file-types (indicated by their .extension). Example: <...
Insane's user avatar
  • 692
10 votes
2 answers
309 views

mini-(Docker)-shell

I was given an assignment to write a mini-shell: To write your own shell, you will need to start with a C program that will prompt the user for input and accept in a number of arguments from a ...
syb0rg's user avatar
  • 21.8k
8 votes
2 answers
6k views

What's the optimal 'pythonic' way to make dot product of two lists of numbers?

I just filled in the first assignment on course which involves learning Python. The assignment was to make vector class which supports scalar multiplication through operator overloading. The ...
Tomáš Zato's user avatar
2 votes
3 answers
2k views

Java Brute-Force Algorithms Homework

I'm taking an algorithms class this semester and this homework seemed pretty easy. Easy usually means something is wrong. Not always, though. Through testing, this application successfully answered ...
Trojan404's user avatar
  • 818
10 votes
1 answer
784 views

Harry Potter's Family Tree Database

As an assignment for a class, I have made a small Harry Potter family tree in Prolog. It compiles into a self-contained executable that can be run straight from the command line on Linux machines. ...
Michael Brandon Morris's user avatar
1 vote
1 answer
180 views

Logical contradiction type definitions

(Homework alert) Working my way through "The Haskell Road...", not sure about my solution to exercise 2.15 on page 48 of the second edition: A propositional contradiction is a formula that yields ...
XXX's user avatar
  • 209
7 votes
3 answers
9k views

Using a greedy algorithm to find the best path in a 2D array

I'm a student and this is one of my assignments. My professor basically confirmed that my code is correct but all he grades on is if I finished the assignment correctly but not the coding style. I ...
Bishoy Boktor's user avatar
3 votes
0 answers
348 views

Movie Knowledgebase

I have had an assignment to construct a movie knowledgebase and ten specified queries in Prolog. This is my first ever Prolog program, so I would appreciate any pointers toward how I could improve. ...
Michael Brandon Morris's user avatar
5 votes
1 answer
535 views

Snake game school project using Pygame

I am making a snake game and I'm almost done but I want to make my code more organized so people can understand so how to do it. ...
omar wael's user avatar
5 votes
1 answer
3k views

Drink machine using structs homework assignment

Here's the school assignment I did: Problem 1. Write a program that simulates a soft drink machine. The program should use a structure Beverage that stores the following data: Drink ...
Harrison Tran's user avatar
1 vote
3 answers
38k views

Writing numbers into a file [closed]

I'm taking my first ever CS class and I have an assignment due Friday. I just wanted someone to check my code. Instructions: Write a program that: gets the name of a text file of numbers ...
j.davis's user avatar
  • 21
7 votes
2 answers
1k views

Homework to display a square and calculate tips

Here's a simple school assignment I did: Problem 1: Write a program that asks the user for a positive integer no greater than 15. The program should then display a square on the screen using ...
Harrison Tran's user avatar
7 votes
2 answers
8k views

Reading a line ending with a newline character from a file descriptor

I'm implementing a function that behaves like getline() which reads a line from file descriptor and returns the results without ...
Junius L's user avatar
  • 779
1 vote
4 answers
180 views

Program to display array elements in the ascending order of number of factors each element has

Input: 1000 23 100 26 32 Output: 23 26 32 100 1000 Since 23 has '2' factors and 26 has '4' factors and 32 has '6' ...
axaysd's user avatar
  • 21
5 votes
2 answers
6k views

itoa base function in C

This is a function that converts an integer value to a null-terminated string using the specified base and stores the result in a char array that I must allocate (...
Junius L's user avatar
  • 779
4 votes
2 answers
115 views

Processing trip route table in C

In fact, this is a group assignment for our C programming lesson, but seeking help from others is not considered cheating. The goal of the following code is to: Sort the data in ...
nalzok's user avatar
  • 513
6 votes
2 answers
4k views

Formatting seconds as hours:minutes:seconds

This is basically my school homework and I want to know what to improve, and what not to do. The homework basically is this: You will get a input in seconds, which is supposed to be shown as H:MM:SS ...
Alex Herbert's user avatar
14 votes
5 answers
35k views

Validating integer or string input

I'm at uni and working on an assignment in c# that takes some user input (from they keyboard via console). The input validation required: numbers must be within range (range will vary depending on ...
Mathew Harrington's user avatar
3 votes
1 answer
127 views

Finding the prime factors of a positive number

I have an assignment to write on the standard output the prime factors of a positive number displayed in ascending order and separated by '*'. My code works, but I need help reviewing it before I ...
Junius L's user avatar
  • 779

1
4 5
6
7 8
12