Jump to content
Search In
  • More options...
Find results that contain...
Find results in...

CreepyPro

Member
  • Content Count

    220
  • Joined

  • Last visited

Awards


This user doesn't have any awards

About CreepyPro

  • Title
    Member
  • Birthday 2001-08-18

Contact Methods

  • Steam
    Dash3r_
  • PlayStation Network
    TheRealDash3r_
  • Twitter
    @LaWeaQueFlota

Profile Information

  • Gender
    Male
  • Location
    Weston, Florida

System

  • CPU
    Ryzen 5 1600x
  • Motherboard
    MSI B350 TOMAHAWK ARTIC
  • RAM
    16GB 3000MGHz G.SKILL Trident Z RGB
  • GPU
    GTX 1060 6GB
  • Case
    NZXT S340 Elite
  • Keyboard
    Corsair Strafe RGB
  • Mouse
    Razer Deathadder Elite

Recent Profile Visitors

The recent visitors block is disabled and is not being shown to other users.

  1. I'm looking for a laptop that I would be able to code and do some light gaming (things as Hollow Knight, Dead Cells, Ori) and that is lightweight. Last time I bought a laptop it became useless after a year so I decided to ask for help this time before buying something stupid again.
  2. The method is supposed to draw a square on a 10x10 grid using the length and x,y coordinate an user inputs and adjust the length in case the square doesn't fit. I'm having trouble figuring out the math for adjusting the length to fit the grid. For example, if the user inputs (x-7, y-2, length-4) my square goes out of the grid by 1. public static void drawSquare(int x, int y, int len) { if(x+len>10) len = Math.max(x, len)-Math.min(x, len); if(y+len>10) len = Math.max(y, len)-Math.min(y, len); System.out.println("side length = " + len + ", area = " + len*len); drawLine(x, y, x+len, y); drawLine(x+len,y,x+len,y-len); drawLine(x+len, y-len, x, y-len); drawLine(x, y-len, x, y); }
  3. I'm thinking about changing my GPU because it has been failing me lately (GTX 1060 6GB) and I'm looking for something around the $500-$600 range. I found some 1080 TI's on ebay that are around that range and I was wondering if it was worth the buy considering that I have a R5 1600x and that I'm going to be playing mostly at 1920x1080.
  4. Thanks for your help. I can't believe I've missed that, I've been looking at this thing for almost an hour lol
  5. I've made a program that's suppose to create greeting cards with the user name but if I print out the card from the array (using a for or for each loop) each card prints out with the name of the last card instead of the custom one for each. For example if I try to do: GreetingCard[] cards = {new BirthdayCard("Mom"), new ChristmasCard("Harry"), new ChristmasCard("Noel"), new BirthdayCard("Judd Nelson")}; for(GreetingCard c:cards) System.out.println(c+"\n"); I get Dear Judd Nelson, Happy Birthday Judd Nelson!!! Hope you have a great year! Dear Judd Nelson, Merry christmas Judd Nelson! Dear Judd Nelson, Merry christmas Judd Nelson! Dear Judd Nelson, Happy Birthday Judd Nelson!!! Hope you have a great year! But if I test it without creating them in an Array I get the right names. BirthdayCard a = new BirthdayCard("Mom"); System.out.println(a.greeting()); BirthdayCard b = new BirthdayCard("Judd Nelson"); System.out.println(b.greeting()); HolidayCard c = new HolidayCard("Harry"); System.out.println(c.greeting()); (ChristmasCard and BirthdayCard are the same but with different messages) package GreetingCard; public class GreetingCard { private static String recipient; public GreetingCard(String rec) { recipient = rec; } public String getRecipient() { return recipient; } public String greeting() { return "Dear " + recipient + ",\n"; } public String toString() { return greeting(); } } package GreetingCard; public class BirthdayCard extends GreetingCard { public BirthdayCard(String rec) { super(rec); } public String greeting() { return super.greeting() + "Happy Birthday " + getRecipient() + "!!! Hope you have a great year!"; } } If you happen to know why this happens please tell me the reason and not just how to fix it. Thanks in advance
  6. Thanks for the explanation, everything works as it should now. Have a nice day
  7. I'm trying to loop through an Array of ints(using a for-each loop) and checking if there's a number bigger than 0 at that index but I'm getting ArrayIndexOutOfBounds: 5 almost every time. But if I use a normal for loop the method works fine. public boolean hallIsClear() { int c=0; /* for(int toys : hall) c += hall[toys]; */ for(int i=0;i<hall.length;i++) c += hall[i]; return c == 0; }
  8. So I'm writing a class that creates a clock and I'm trying to add a method that advances the clock x amount of minutes. The method works fine except for when the starting hour is 12. When this happens I always get AM and never PM. I'm pretty sure the problem is in the if(hour==12) statement but I can't seem to figure out why. Any help is appreciated. FYI: this is HW for my CS class and I have to do it in a website which doesn't allow me to use the java built in timeclass. public void advance(int a){ int m =a%60; //Minutes to add int h =a/60; //Hours to add minute = minute + m; //Add minutes to m while(minute>=60) { //Divides minutes by 60 to get the amount of hours in case the input is bigger than 60 minute = minute - 60; h++; } // Test if OG hour = 12 if(hour==12){ hour=0; if(h<12) hour = hour + h; if(h>=12) { if(amPm.equals("AM")) { amPm = "PM"; hour = hour + h; } else { amPm = "AM"; hour = hour + h; } } if(hour==0) hour=12; } else { hour = hour + h; while(hour>12) { if(amPm.equals("AM")) { amPm = "PM"; } else amPm = "AM"; hour = hour - 12; } } }
  9. public void advance(int a){ int m =a%60; //Minutes to add int h =a/60; //Hours to add minute = minute + m; //Add minutes to m while(minute>60) { //Divides minutes by 60 to get the amount of hours in case the input is bigger than 60 minute = minute - 60; hour++; } hour = hour + h; //Adds the amount of hours that the while loop form line 5 got while(hour>12) { //Expected to change AM to PM if neccesary and change the amount of hours if it happens to be bigger than 12. if(getAmPm()=="AM") { amPm = "PM"; } else amPm = "AM"; hour = hour - 12; } } Here I try to explain better what everything is suppose to do. The clock class is in this link under Clock-advance. @Bacon soup @jslowik
  10. I need to write a method for the Clock class that advances time. The problem is that I'm not passing all my test cases and I can't figure out why, so if someone could explain to me what I'm doing wrong that would be great. I do not need the answer for the exercise, just to know why my code doesn't work. Clock class + exercise: https://codestepbystep.com/problemset/view/1348 My code: public void advance(int a){ int m =a%60; //Minutes to add int h =a/60; //Hours to add minute = minute + m; while(minute>60) { minute = minute - 60; hour++; } hour = hour + h; while(hour>12) { if(getAmPm()=="AM") { amPm = "PM"; } else amPm = "AM"; hour = hour - 12; } }
  11. Write a method named collapsePairs that accepts an array of integers as a parameter and modifies the array so that each of its pairs of neighboring integers (such as the pair at indexes 0-1, and the pair at indexes 2-3, etc.) are combined into a single sum of that pair. The sum will be stored at the even index (0,2,4, etc.) if the sum is even and at the odd index (1,3,5, etc.) if the sum is odd. The other index of the pair will change to 0. I can't figure out why I'm not getting the right outpout. For example: test #1:collapsePairs({7, 2, 8, 9, 4, 22, 7, 1, 9, 10}); exp. params:{0, 9, 0, 17, 26, 0, 8, 0, 0, 19} your parameters:{0, 9, 0, 17, 0, 26, 0, 8, 0, 19} public static int[] collapsePairs(int[]a) { int x[] = new int[a.length]; for (int i=0; i<a.length-1; i=i+2) { if (a[i]+a[i+1]%2==0) x[i]=a[i]+a[i+1]; else x[i+1] = a[i]+a[i+1]; } for(int i=0;i<a.length;i++){ a[i] = x[i]; } return a; }
  12. Write a method named collapse that accepts an array of integers as a parameter and returns a new array where each pair of integers from the original array has been replaced by the sum of that pair. I have this so far, can someone explain me how to fix the error? public static int collapse(int a[]){ int a2[] = new int[a.length/2]; if (a.length%2==0) for (int i=0; i<a2.length;i=i+2) a2[i] = a[i] + a[i+1]; else { for (int i=0; i<a2.length-1;i=i+2) a2[i] = a[i] + a[i+1]; a2[a.length/2] = a[a.length]; } return a2; }
  13. I need to write a method that accepts two arrays of Strings and returns true if each element in the first array comes before the element at the same index in the second array.The method should return false if the arrays are not the same length. For example, “car” comes before “motorcycle” in the alphabet. I have this so far but I can't figure out a way to compare which word comes first in the alphabet. public static boolean allBefore(String s[], String w[]) { int lens = s.length; int lenw = w.length; int c = 0; if (lens != lenw) return false; else for (int i=0; i<lens; i++) { } }
  14. yeah I fixed that my making a diff variable for arr2 but this is better thanks
×