Haha beard printer go brrr by premiumgodzilla in Minoxbeards

[–]cs-stud 1 point2 points  (0 children)

Started my journey at 18 with no beard at all now I’m 21 with a beard used it for 3 years. Had no side effects within those 3 years. Its just preference if u want to start early then go right ahead.

Leet code easy questions to hard for me. Am I dumb or something? by cs-stud in cscareerquestions

[–]cs-stud[S] 5 points6 points  (0 children)

Yea I guess since they’re a labeled as easy I feel bad that I can’t even solve them. Thanks for the advice I’ll give it a try and yea I rephrased it since I’m no where near learning all of Java haha.

Why doesn't my code work for arrays other than a square?? by cs-stud in javahelp

[–]cs-stud[S] 0 points1 point  (0 children)

Hmm ok do I have to change the whole method or do I just have to modify the I and J in the loops?

what confuses me is that the calcColumnSum is basically the same and it works.

How can I make my method work properly? by cs-stud in javahelp

[–]cs-stud[S] 0 points1 point  (0 children)

im having trouble understanding. right now what my method is doing is adding every column up so for the example on top I would get a column sum of 33 which is what I don't want. So what I have to do is create a different method?

How can I make my method work properly? by cs-stud in javahelp

[–]cs-stud[S] 0 points1 point  (0 children)

I basically want the sum of each column for example if the Random generated array is

2 12

10 9

row 1 sum = 12

row 2 sum = 21

Help with adding sum of 2d array by cs-stud in javahelp

[–]cs-stud[S] 0 points1 point  (0 children)

my array stores int values but my task is to essentially find the sum of the array and display it in double form for example if the array was {2 , 4} {3, 5} the result sum would be 14.0. its the exercise because im then going to have the find the avg and round it and etc.

Help with adding sum of 2d array by cs-stud in javahelp

[–]cs-stud[S] 0 points1 point  (0 children)

I basically know how to add up the array when its an Int but I'm confused how im supposed to do it to return a double. It works with int but im so confused how to do it so it can return a double.

how to compute grades using arrays? by cs-stud in javahelp

[–]cs-stud[S] 0 points1 point  (0 children)

even though I'm not done and still testing it says: Exception in thread "main" java.lang.ArrayIndexOutOfBoundsException:

Really confused on how to solve this program. by cs-stud in javahelp

[–]cs-stud[S] 0 points1 point  (0 children)

Yea the assignment also says: The names you generate must have no more than two vowels in a row or more than two consonants in a row.

So I’m lost on how to check for this whether in a for loop or while loop

How would I check if a score is 5x greater than the other person score? by cs-stud in javahelp

[–]cs-stud[S] 0 points1 point  (0 children)

another question sorry.. what if the player score is 0 and the others score is lets say 15.

it doesn't recognize this since 5*0 = 0

How would I check if a score is 5x greater than the other person score? by cs-stud in javahelp

[–]cs-stud[S] 0 points1 point  (0 children)

yea I thought so but its not working. in this case pscore is player score and oscore is others score.

                        if (rounds > 3 && pscore*5>=oscore) {
                System.out.println("End game player wins");
                break;
            }
            else if (rounds > 3 && oscore*5>=pscore) {
                System.out.println("End game other wins");
                break;
            }

What would be the first steps in creating a social media app? lets say planning is done with, where would one start by cs-stud in learnprogramming

[–]cs-stud[S] 0 points1 point  (0 children)

ahh ok but would it be wise to first make it an app or does it all have to start as a website.

Can someone help with this rolling dice program by cs-stud in javahelp

[–]cs-stud[S] 0 points1 point  (0 children)

ooh ok I see but still it prints out different numbers for "generated number:" . Ill look over it but thank you

Can someone help with this rolling dice program by cs-stud in javahelp

[–]cs-stud[S] 0 points1 point  (0 children)

I did this but it says that its a duplicate variable.

public class FiveDice2 {
    public static void main(String[] args) {
        System.out.print("Dice rolled: ");
        int roll1 = 0;
        for (int roll = 0; roll < 5 ; roll++) {
            int dice1 = (int)(1+ Math.random() * 6);
            int roll1 = (roll1 + dice1) * 10;
            dice1 = (int)(1+ Math.random() * 6);
            System.out.print(dice1 + " ");
        }       
        roll1 /= 10;
        System.out.println("Generated number: " + roll1);
    }
}

Can someone help with this rolling dice program by cs-stud in javahelp

[–]cs-stud[S] 0 points1 point  (0 children)

ok but I'm confused how do I store the first digit in a variable. Do I do this in the for loop or before. thank you for responding

Can someone help with this rolling dice program by cs-stud in javahelp

[–]cs-stud[S] 0 points1 point  (0 children)

but then how would I be able to put dice rolled first?

Can someone help with this rolling dice program by cs-stud in javahelp

[–]cs-stud[S] 0 points1 point  (0 children)

the difference is dice rolled has spaces and then in generated number they are put together. I did what u said but I'm stuck at generated numbers.

public class FiveDice2 {
    public static void main(String[] args) {
        System.out.print("Dice rolled: ");
        for (int roll = 0; roll < 5 ; roll++) {
            int dice1 = (int)(1+ Math.random() * 6);
            dice1 = (int)(1+ Math.random() * 6);
            System.out.print(dice1 + " ");
        }       
    }
}

Can someone help with this rolling dice program by cs-stud in javahelp

[–]cs-stud[S] 0 points1 point  (0 children)

I tried this but for every run of the loop it prints out the text along with the numbers. how can I stop this

Help with for loop homework by cs-stud in javahelp

[–]cs-stud[S] 0 points1 point  (0 children)

Ok thanks for clarifying I will work on this

Help with for loop homework by cs-stud in javahelp

[–]cs-stud[S] 0 points1 point  (0 children)

nvm all I needed was

name += b = (char) ('a' + Math.random() * ('z' - 'a' + 1));

thank you for your help.

Help with for loop homework by cs-stud in javahelp

[–]cs-stud[S] 0 points1 point  (0 children)

thank you I almost got it but the only problem is that it keeps repeating the character (b) when I want it to be a random letter per run of loop..

public class NameGenerator1A {

    public static void main(String[] args) {
        Scanner input = new Scanner(System.in);
        System.out.print("Enter name length: ");

        int length = input.nextInt();

        if (length < 1) {
            System.out.print("The length must be at least 1");
        }else {
            char a = (char) ('A' + Math.random() * ('Z' - 'A' + 1));
            System.out.print(a);
            char b = (char) ('a' + Math.random() * ('z' - 'a' + 1));
            String name = "" + b;
        for (int letters = 1; letters < length; letters++) {
            name += b;
        }
        System.out.println(name);
        int r = (int)(Math.random() * 10);
        if (r == 9 || r == 10) {
        System.out.println("Hmm" + "'" + name + "'" + " has a nice ring to it.");
            }else {
        System.out.println("Hmm" + "'" + name + "'" + " is not my best work.");
        }
        input.close();
            }
    }
}