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
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
786 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
592 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
317 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
134 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
154 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
52 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
18k 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
345 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
199 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
73 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
249 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
2k 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
117 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
388 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
120 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 ...
6
votes
2answers
10k 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
474 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
436 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
1k 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 ...
3
votes
3answers
90 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 ...
4
votes
1answer
764 views

Java game that generates and compares random numbers, looking for matches

I have written some Java code for a school assignment. It is a game, and it works as follows: The game makes 4 random numbers, all different, as the users ticket. It then generates 4 other random ...
2
votes
3answers
173 views

Simple C++ program that calculates the measures of a sphere

I have another home work from school and would like to see if I am on the right path to learning C++. We have to do the calculation of the measures of a sphere. I did it two ways: Just calculating ...
18
votes
6answers
5k views

Simple modern C++ string class implementation

My teacher asked me to come up with a quick version of the C++ string class. This is what I have written. It works fine and I have tested few cases as detailed in <...
3
votes
1answer
378 views

Object-oriented Tamagotchi-like program with a GUI

I am currently working on a small python project for an undergraduate course in python. The task is to create a Tamagotchi-like program with a GUI. My question is whether my code is Object oriented or ...
1
vote
4answers
70 views

Form a firstname.lastname@domain.se address, eliminating diacritics from a name

I'm an amateur programmer who just started learning programming, my school gave me an assignment to create code that reads a surname and lastname from an input dialog box and then to edit those name ...
4
votes
2answers
4k views

Reverse a word in the char array

I have to write a program that reads a word to the char array and next display it reversed. I must find best own optimal solution. My solution of this exercise: ...
4
votes
5answers
675 views

Calculating sum of squares in C

I wrote some program in C language. I have to calculate sum of squares. My book suggested me to use loops but I chose more efficient way by using formula: $$1^2+2^2+\cdots+n^2=\frac{n\left(n+1\right)\...
4
votes
2answers
156 views

Develop custom Hash Map

I've got a task to implement custom hash map with only get, put, size functions without remove and implementing base Map interface in Java. I've made one but not sure if it is good one. Can You check ...
5
votes
1answer
796 views

Counting the number of unique fractions read from a text file

I will begin this question with the disclaimer that it is homework but my code is written and working, I just want to know if there any ways in which I can improve what I already have. I want my ...
7
votes
1answer
155 views

UPenn CIS194: Credit Card Validation (Homework 1 Part 1 Tests)

I am working through the UPenn CIS194 lectures and homework assignments in an effort to learn more about Haskell. The first part of the first homework is focused on validating credit card numbers. ...
4
votes
1answer
54 views

Homework distribution terminal app in C++

I'm working on cleaning this code up a bit and was hoping for some suggestions. Right now it works well enough on a basic level, but it doesn't check for out of bounds numbers or improper input. ...
5
votes
4answers
98 views

Finding students with the best grades in a given subject

We have a school assignment, in which the program is to read data of students from stdin, in the following format: LASTNAME FIRSTNAME STUDENT_ID SUBJECT AVERAGE_GRADES. The program has to print out ...
3
votes
1answer
89 views

CS50 Pset1 Greedy, change algorithm

The purpose of the code is to calculate the least amount of coins needed to produce correct amount of change given a dollar or cent user input. I'm just starting out and appreciate any pointers in how ...
3
votes
2answers
701 views

C program to handle information of cars and owners

This is a school assignment, it's the longest program I've wrote this far, and I feel it's a bit messy and all over the place. I will try to translate the assignment to the best I can: We have a ...
3
votes
1answer
361 views
0
votes
1answer
936 views

Java OOP HomeWork [closed]

My professor is super strict and just want to know if I have solved this correctly. Design a class named Location for locating a maximal value and its location in a two-dimensional array. The class ...
2
votes
0answers
828 views

A clock program in MIPS assembly that start ticking from 59:58

This is an assignment, a clock program which use MARS simulator, it starts ticking from 59:58. In this assignment I have implemented three functions ...
6
votes
1answer
185 views

CIS 194 Homework 2: Parsing an error log

Here is another reference solution, that I discovered after writing my own: https://insight.io/github.com/beloglazov/haskell-course/blob/HEAD/hw2.hs I am following this lecture course as a ...
1
vote
1answer
441 views

Track mail to clients

Create an application class named LetterDemo that instantiates objects of two classes named Letter and ...
2
votes
0answers
71 views

LightsOut - A homework framework for teaching CS to non-engineers

This provides a fill-in-the-blanks homework framework to implement the game "LightsOut". LightsOut is a game with a grid of lights. When you touch a light, it toggles it’s state; it ALSO toggles the ...
2
votes
2answers
337 views

Instantiate and display a ClassifiedAd

Create an application named TestNewspaperAd that instantiates and displays a ClassifiedAd object. A ...
4
votes
1answer
65 views

Swing UI for a Virtual LaunchPad

I'm currently coding for a school project. I'm planning on creating a virtual and simple Launchpad. Here's the first part of my code which treats the graphical interface. I know it's not well ...
11
votes
1answer
382 views

Vector implementation, which received unhelpful negative feedback from professor

I've just finished a homework assignment to implement a simple Vector class. -Kindly ignore the following two paragraphs if you don't want to read someone whining about their professor Yadda, yadda,...
1
vote
2answers
1k 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 ...