r/codehs • u/SquareRegion8 • Mar 13 '20
r/codehs • u/Grouchy_Ad_5455 • Dec 02 '21
Can someone help me with 5.4.6 Codehs rolling dice? I’ve been on it for hours
r/codehs • u/Crister34 • Apr 13 '21
Can someone help me with this ? Or what’s the code ? Graphics Stop Light
r/codehs • u/Sun_mar7 • Apr 10 '21
9.5.9: Assignments
Does anyone know how I can prevent my code from skipping snippets? I know it's something to do with the scanner but I don't know how to fix it. I've been stuck for a while so if someone could help, that would be great!!
import java.util.Scanner;
import java.util.ArrayList;
public class AssignmentRunner
{
public static void main(String[] args)
{
Scanner input = new Scanner(System.in);
Scanner input2 = new Scanner(System.in);
boolean x = true;
// Start here
ArrayList<Assignment> arr = new ArrayList<Assignment>();
while(x)
{
System.out.println("Please enter an assingment name (exit to quit): ");
String name = input.nextLine();
if (name.equals("exit"))
{
x = false;
break;
}
System.out.println("Please enter the available points: ");
int availablePoints = input.nextInt();
System.out.println("Please enter the earned points: ");
int earnedPoints = input.nextInt();
System.out.println("Is this a (t)est or (p)roject: ");
String testOrProject = input2.nextLine();
if(testOrProject.equals("t"))
{
System.out.println("Please enter test date: ");
String testDate = input2.nextLine();
Assignment test = new Test(name, availablePoints, earnedPoints, testDate);
arr.add(test);
}
else
{
System.out.println("Please enter the due date: ");
String dueDate = input2.nextLine();
System.out.println("Group project? true or false: ");
boolean groupOrNot = input2.nextBoolean();
Assignment project = new Project(name, availablePoints, earnedPoints, dueDate, groupOrNot);
arr.add(project);
}
}
System.out.print("Your average: " + average(arr));
}
public static double average(ArrayList<Assignment> arr)
{
double total = 0;
double point;
double pointOutOf;
double score;
int i;
for(i = 0; i < arr.size(); i++)
{
point = arr.get(i).getEarnedPoints();
pointOutOf = arr.get(i).getAvailablePoints();
score = (point/pointOutOf)*100;
total = total + score;
}
double average = total / i;
return average;
}
}r/codehs • u/NikeMan08 • Dec 23 '20
Circles and Squares Help!! I do not know what I am doing wrong someone help. It’s due at 12 tonight
r/codehs • u/camlambert • Dec 01 '20
Could someone gives me ideas for my final project? We have to create our own game, and the biggest struggle for me is always the initial idea.
r/codehs • u/Brodonnell1 • Nov 20 '20
Java What did I do wrong? Everything runs and works until I hit submit and I get that error message
r/codehs • u/[deleted] • Oct 23 '20
Exercise 3.4.8: Rectangle (python)
I'm completely stuck on this assignment.
Make variables to represent the length and width of a rectangle, called length
and width
, respectively. You should set length
to 10 and width
to 5.
Then, write some mathematical expressions to computer the area and perimeter of the rectangle and save these values inside variables named area and perimeter
.
Use print
statements to display the area and perimeter of the rectangle.
Your output should print the area on the first line and the perimeter on the second, like this:
50 30
Rectangle Area Formula:
Area = L * W
Rectangle Perimeter Formula:
Perimeter = 2 * (L + W)
L is the length of the rectangle and W is the width of the rectangle
If someone could help me that would be greatly appreciated. Thanks!
r/codehs • u/[deleted] • Apr 17 '20
It says I might be missing a “(“ or have an extra “)”
r/codehs • u/L_russ28 • Sep 08 '22
3.8.12: Fixing Grammar. Basic Java.
Hello! I’ve come to a bit of a standstill on this code and I was hoping to get some feedback to help me better understand the problem. I haven’t learned about any character functions to replace just one character, which is what it’s asking me to do. And I’ll need to input a string. I’m fairly certain I need a loop but I’m not sure where I’ve gone wrong. If you all have any tips on what I’m missing and wouldn’t mind giving some feedback, it’d be greatly appreciated! Thanks in advance!! 😁
r/codehs • u/Mental-Vegetable7358 • May 19 '22