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
0answers
18 views

input month name correspond to the number and dectect if it correct or not [closed]

I want my program result to be like this Month 9: July wrong where 9 is the random number using random and July is the input using scanner I did something wrong and my code does not work, please ...
2
votes
1answer
38 views

Python Text-Based Hangman Game

I have just written a hangman game in Python for a school project. It reads in a list of words from a text file, and graphics from another text file. For each word, the program asks keeps asking for ...
1
vote
1answer
57 views

C code in Data structures

Can someone give me any suggestions over my code that I made for this task? Also how much of 10 would rate it ? Suppose a simply linked list whose node is of type node and contains a student's name, ...
1
vote
1answer
66 views

Car price calculator

Im writing this simple program for school and using NumberFormat on all the variables seems very repetitive (Note that we were asked to use the NumberFormat method)....
0
votes
2answers
75 views

How to replace the given email address with a value in a given input?

I have written the below method to replace some of the email domains like @gmail.com and @yahoo.com with a given text. ...
1
vote
3answers
146 views

Value store (“optional” type)

Create a class template named ValueStore that has a member variable, to store a value and a member variable, hasValue that holds ...
5
votes
1answer
88 views

Parsing and Simple Shell in C

I wrote this simple shell in C for a university assignment on operating systems (My guess is that it's just the beginning and the next assignments will add to this code). The program prints the prompt ...
2
votes
1answer
76 views

Customer management system for registering customers in C

The prompt is: that I should write a program for a customer management system for registering customers (in C programming language). The program should allow registration management members to: Add ...
3
votes
1answer
36 views

Date program for xv6- improvement and testing

This is my first post on this forum. I have read the guidelines and will try to adhere to them, but I apologize if I miss something. The code I am posting is intended to duplicate the output of &...
4
votes
1answer
55 views

Binary guess game in C++

This is a program in C++ that guesses a number given by the user. I have to do homework and there's my attempt to solve an exercise from the programming book. If you know what can be done better and ...
-1
votes
2answers
75 views

Remove duplicates from array and save it to another one [duplicate]

I have been tasked to make an array without duplicated values from another existing array. So I did it, but I want to know is there some other better way to do that. Example input/output ...
3
votes
3answers
136 views

Remove duplicates from array and save it to another one

So I have been tasked to make an array without duplicated values from another existing array. So I did it, but I want to know is there some other better way to do that. Example input/output: ...
8
votes
1answer
91 views

Parenthesis-realigning program

This is my code for an assignment. The task is to take a user input in form of a sequence of parenthesis' followed by an E to mark its end and determine whether it is a correct sequence (as an example ...
5
votes
4answers
780 views

Tax Calculator (using OOP techniques)

I was wondering if you'd be able to review my basic Tax Calculator that incorporates OOP techniques. I'd greatly appreciate it if you didn't mention about my variable naming convention i.e. Hungarian ...
5
votes
1answer
77 views

Find all the digits in a string

S is a given character string, then I have to find all the digits characters of S. Did I make it unnecessarily complicated? <...
6
votes
1answer
77 views

Given a byte string S of length l, obtain the string D of length l-1 as D(i) = S(i) * S(i+1)

Given a byte string S of length l, obtain the string D of length l-1 as D(i) = S(i) * S(i+1) (each element of D is the product of two consecutive elements of S). ...
5
votes
2answers
46 views

Pushing local repository to remote repository using python Github

The code should do the following in order: It should download/clone the public Github repository locally. It should remove all the git history (and branches) Use the Github API to create a new Github ...
3
votes
2answers
223 views

Blackjack script in Python

Recently I had a python test and, unfortunately, I failed. I'm going to re-do my test and the teacher gave me the tip to work more efficiently and clean. To practice this I made a blackjack game about ...
2
votes
0answers
43 views

Faster algorithm/language for substring sliding window replacement

I had a sample file with a long string >50M like this. ...
2
votes
1answer
76 views

c++ array. Looking for better solution

So i got an task from school. Which ask's me to write a program tad creates an 2d array with 11 rows and 5 columns. In which the first column starts with 2.0 and increments by 0.1 all the way up to 3....
4
votes
1answer
107 views

Basic Integer Matrix Implementation

I need to write a CustomBasicMatrix class implementation for college. This includes basic operations such as int and ...
7
votes
5answers
2k views

Egg size Prompt Box

So I am currently doing an Assignment where I have to make a code that when someone opens the page, they input the weight of an egg and it comes back with what "size" it is. I got the code ...
9
votes
2answers
2k views

C Implementation of atof

I'm a beginner at C. I'm currently implementing atof to build a raytracer, however I'm still learning how to efficiently write programs. Assignement Instructions The program takes a scene description ...
5
votes
2answers
188 views

C++ Practice on STL templates and algorithms

I have implemented the following program below for an assignment for practice on STL templates and algorithms. All I'm doing is implementing the code for the printing of empty files, un-empty files, ...
11
votes
1answer
937 views

Customization of memory class C++

I have implemented a customized memory allocation class template for an assignment. Codes are commented; Hopefully it's clear. I would love to know if there is any way to make the code more optimized. ...
5
votes
3answers
122 views

Hotel booking with multiple options. Improvement through subclasses?

The code below runs perfectly fine as I want it to. I'd like to create more subclasses to get a better overview over the whole code. Can I place the setter and getter as well as the methods into the ...
5
votes
2answers
110 views

Follow up to “C simple hashcons data structure”

This is a follow-up question to my previous question I have modified the code according to the feedback I got from here and my Professor. However, my Professor is still not happy with the final code. ...
5
votes
2answers
189 views

C simple hashcons data structure

I wrote this hashcons data structure in C and it works correctly. It uses larger twin primes as the capacity and double hashing (open addressing). Page 614 of "Data Structures and Other Objects ...
4
votes
3answers
5k views

Student Grade Calculation

Develop a smart application as Student Grade Calculator(SGC). Create a class Student with following private attribute : int id, ...
7
votes
1answer
274 views

Parsing a sequence of bits out of a bit field

For homework, I had to parse CPUID instruction output in C, which required a lot of specific bit-manipulation like: (eax & CACHE_LEVEL) >> 5 I ...
2
votes
2answers
119 views

Verify credit card number with Luhn's algorithm

...
20
votes
6answers
4k views

Can I slim this UTF8-encoding program?

Below is my entire program. You can read what it does thanks to the comments and specifications in particular. My question is: can it be improved? Would it be possible, for example, to avoid writing ...
2
votes
0answers
44 views

Parametrized cache simulation in C

This is an assignment known as a Cachelab from CMU 15-213. The full writeup for the lab can be found here, the handout I'm working against - here. All in all, the task is to emulate a cache, given the ...
2
votes
1answer
60 views

Code duplication

I wrote a function that merges two linked lists but I seem to have some code duplication I'm not sure what to do with: ...
2
votes
2answers
311 views

Prefix expression evaluator [C++] [closed]

Here's my code for this' weeks homework I had. The code should take an expression , preferably in prefix notation ( otherwise throws exception ), that evaluate prefix expression. I've given three ...
3
votes
1answer
77 views

C# Quicksort Assignment

For my CS minor I was assigned to implement the Quicksort algorithm in C#. I gave it a go and found that I like the implementation of the algorithm more than Mergesort. Now that I've got my Quicksort ...
1
vote
2answers
89 views

integer log base 10 function without using java.lang.Math?

I am assigned to a task of creating a function int logBase10Estimate(int n) that returns the log of a number base 10. The answer is integer part only.(w/o using the Math class) Is this okay? ...
12
votes
3answers
2k views

Implementing a rectangle class

First I've to indicate that this is my homework. An example of a given input is: s1 = {'p1': (x1, y1), 'p2': (x2, y2)} where all names and coordinations are ...
2
votes
1answer
83 views

Optimizing minHeap implementation

I have implemented a java class for minHeap but it is not working as fast as I want . I want some help to change it to work faster in insertion or deleting the minimum node. Here is my implementation:...
1
vote
1answer
925 views

Go homework interview challenge for Storj

Last December I interviewed with Storj and was unsuccessful after my code challenge. Storj were good enough to pay me for the time it took to complete the challenge, but have refused to give any kind ...
5
votes
1answer
142 views

Parsing weather station XML on raspberry pi

This if for a school project that is all about getting the most performance possible out of a relatively weak computer. For this project we have received a weather station report generator that ...
0
votes
1answer
41 views

Spaceship Operation in for Lexicographic Comparison

I have written a program in Java 8 using BlueJ. There is just one function of type byte that accepts two String values and return 1 if the first word comes before the second in alphabetical order, and ...
7
votes
1answer
111 views

Cis 194: Homework 3 (Histogram)

I am following CIS 194: Introduction to Haskell (Spring 2013) online to teach myself Haskell. Following is my response to third exercise of Homework 3, namely Histogram. In which ways I could improve ...
1
vote
1answer
136 views

Optimizing Hash Table

I am trying to write my own implementation of a hash table (hash map) in C++. It turns out that my code is unoptimized as I can't pass performance tests. Can you please give some advice for ...
5
votes
2answers
532 views

Binary search guess game in C++

I'm trying to write a program where computer attempts to guess a number entered by user. Computer should keep asking until guessed number will be equal to user number. If you know what can be ...
2
votes
1answer
1k views

Salaries exercise

Hey there guys, I have just completed an exercise for uni and I would really like some feedback as I'm pretty new to using java. Areas that I could especially use some input in this instance: ...
3
votes
1answer
74 views

Converting an input of space delimited integers to a list

tablou = input("Enter values delimited by space: ") b = tablou.split() t = [] # initial list with int() contents for l in b: r = int(l) t.append(r) I ...
4
votes
3answers
225 views

A custom String class implementation

This is my first implementation of a "container" using the Rule of Five, any feedback I'll gladly accept. I've tried to make it as Exception-Safe as possible. I've made it for an assignment. Header <...
7
votes
3answers
768 views

Optimizing Conway's Game of Life in C++

How could I further optimize my implementation of Conway's Game of Life? And how would you critique my current strategies? I'm taking a C++ optimization class, the deadline has passed and my ...
10
votes
5answers
7k views

Python Bingo game that stores card in a dictionary

I am super proud of this python bingo game I wrote. I am posting it here to make get some help reviewing it to make sure I'm using the best practices. This is for a class, and my professor is a ...

1
2 3 4 5
11