32,204 Topics

Member Avatar for
Member Avatar for Sunil_19

Hi friends, Being new in junit i have onw question that How to test local variable in method using junit test case? Check that below is my method suppose, public void methodToCheckStr(int testVar) { String str=""; if(testVar==5) { str="Success"; } else { str="fail"; } } How to create test case …

Member Avatar for peter_budo
0
3K
Member Avatar for jonathan_20

hello guys, im new to software progrmming, iam more interested in java programming. iam trying to write a code using netbeans, but after finishing compiling th code, then after running it, it says build unsuccesiful, it gives me an error wich i do not understand..

Member Avatar for JamesCherrill
0
117
Member Avatar for Ater Mawut

I have created a black jack app and have got it show both cards but I only want it to show the second card in the hand and keep the first one hidden until its time to show. Here is the code package blackjack; import java.util.Scanner; /* This program is …

Member Avatar for JamesCherrill
0
229
Member Avatar for Start4me

I'm trying to replicate the ray-looking design, just like in the first image. Here's my code: When the user clicks on the button: private class drawInnerShape implements ActionListener{ public void actionPerformed( ActionEvent e){ paintInnerDesign = true; repaint(); } } The following code executes: class DrawArtwork extends JPanel { @Override public …

Member Avatar for JamesCherrill
0
280
Member Avatar for Mudzy

im stuck on a question from the book, java in 2 semesters chapter 7. 2a) write a program that asks the user to input a string, followed by a single character, and then tests whether the string starts with that character. [CODE]public class StringTest { public static void main(String[] args) …

Member Avatar for JamesCherrill
0
15K
Member Avatar for divinity02

hi all I am doing this thread program and when i run it is not giving any output, can someone tell me why no output is shown. public class RelayRaceDemo { public static Thread runner[]; public static void main(String[]args){ RelayRacer rr = new RelayRacer(); ThreadGroup country[] = new ThreadGroup[5]; country[0] …

Member Avatar for JamesCherrill
0
186
Member Avatar for chrisschristou

hello, i just set goal of mastering algorith and i just get started i have an algorhtm for insert sort and i when i write it in c it is not sorting this is the algorith for j D 2 to A_length key = A[j] // Insert A[j] into the …

Member Avatar for rproffitt
0
417
Member Avatar for Reverend Jim

Here's an interesting little scenario. You get challenged to a game of coin toss. Both players pick a sequence of coin toss results (heads or tails). The coin is repeatedly tossed until the sequence for one of the players occurs. The loser pays the winner a dollar. You'd assume that …

Member Avatar for xrjf
0
2K
Member Avatar for murali89

Dear All, I am trying to learn j2ee from the basics. I have written a basic program from my guidance book and when i try to compile it , i get the below error. Please throw some light on it. javac -classpath C:/Program Files (x86)/Apache Software Foundation/Tomcat 7.0/lib/servlet-api.jar:classes:. -d classes …

Member Avatar for murali89
0
376
Member Avatar for Trevor_5

below is the code i have and i am getting an unhandled IOException in the inputstreams: import java.nio.file.*; import java.io.*; import static java.nio.file.AccessMode.*; import static java.nio.file.StandardOpenOption.*; import javax.imageio.ImageIO; import javax.swing.*; import java.awt.*; import java.awt.event.*; import java.util.*; public class FinalProject extends JFrame implements ActionListener { JLabel guess = new JLabel("Guess the …

Member Avatar for JamesCherrill
0
356
Member Avatar for CS_GUY1234

// Also attached to this question is the assignment sheet. Need help pls. import java.util.*; import java.awt.*; import java.applet.*; public class Lab15st extends Applet { private int numBars; // number of bars to be sorted private int barHeight[]; // array of bar heights private int sortDelay; // delay between comparison …

Member Avatar for CS_GUY1234
0
509
Member Avatar for annya

Hello, I not an expert in android coding but I know little bit, that's why I bought this app from a person. Unfortunately the app author was not giving supporting to me that's why Iam posting this issue here. So please help me, my new app was working fine in …

Member Avatar for rproffitt
0
1K
Member Avatar for CS_GUY1234

// FInished isPal but need help with other few. public class Lab14st { public static void main (String args[]) { System.out.println("Lab 14, 80 Point Version"); System.out.println(); System.out.println("The Palindrome Program"); System.out.println(); System.out.println("By: Arjun Desai"); // Substitute your own name here. System.out.println("\n===========================\n"); boolean finished = false; do { System.out.print("Enter a string ===>> …

Member Avatar for rproffitt
0
368
Member Avatar for omprakash_1

# Split a dataset based on an attribute and an attribute value def t_split(x, y, z): l, r = list(), list() for row in z: if row[x] < y: l.append(row) else: r.append(row) return l, r # Calculate the Gini index for a split dataset def gini_index(grp, class_values): gini = 0.0 …

Member Avatar for rproffitt
0
324
Member Avatar for Heather_6

The Canadian Forest Service wants to do a simple simulation of the growth and pruning of forests. Each forest has a name and exactly 10 trees. The trees are planted when they are 1' to 5' tall, and each tree has a individual growth rate of 50%-100% per year. For …

Member Avatar for ignacio.camachoortiz
0
444
Member Avatar for Petrisor

Good day, I have to make a data scraper and after I take the informations I have to get them in a CSV file.This is the original request:For the final java academy test you have to create a small crawler. What do I mean by "crawler"? A crawler it is …

Member Avatar for happygeek
0
401
Member Avatar for George_23

Hi everyone, I've been searching through these forums to find a way to transfer my program output [including the user's input] to a .txt file. The program basically gets the user's name and their choice of ingredients and then prints out a receipt of their order. Below I've attached what …

Member Avatar for JamesCherrill
0
525
Member Avatar for Lena_1

I am new to Java Programming, I need help on this.. Any help would be appreciated. Write a java program that generates a random number between 50 and 100 for a student grade and determines the letter grade of the student. The student grade is determined based on the following …

Member Avatar for Tarek_2
0
380
Member Avatar for Syed Suleman

I have to create a sign up and log in forum in Java . But I have no idea how to do, or what to do I really need help otherwise.

Member Avatar for Tarek_2
0
180
Member Avatar for Aob

I am having a trouble not knowing how to do a java code that will take user string then encrypt it using Elgamal algorithm as following Elgamal algorithm Pseudo code: - Select Q where Q is a prime number - Select α where α is a primitive root of Q …

Member Avatar for Aob
0
5K
Member Avatar for Mirty

I need help with some questions.They were 20 of them but this 5 have been so hard for me. Any help I get will be highly appreciated. Cheers!!! 1.When mergesort is implemented on a linked list it is possible to implement it as a stable sort. True or False? These …

Member Avatar for Mirty
0
290
Member Avatar for Violet_82

Hi guys, as I'm looking into the MVC pattern, I thought I'd create a small application to understand a bit more. Let's look at the code: //model package model; public class StudentModel { private String name; private String surname; private int number; public String getName() { return name; } public …

Member Avatar for JamesCherrill
0
1K
Member Avatar for John_160

package grossmontbank; import java.util.Scanner; public class GrossmontBank { //class variables (global - accessible throughout this class) //scanner object to be used throughout private static Scanner input = new Scanner(System.in); //array of blank accounts private static final int MAX_ACCOUNTS = 50; private static Account[] accounts = new Account[MAX_ACCOUNTS]; //total accounts created …

Member Avatar for JamesCherrill
0
1K
Member Avatar for Ater Mawut

Need help with an assignment here are the instructions. 1. Your Clock.java must be the class. 2. Your ClockApp.java is the main program. 3. Your clock will be a 24 hour clock 4. You will create the following public member functions for the clock class. a. clock() //Default constructor with …

Member Avatar for Derek_10
0
573
Member Avatar for samuel_18

how to update Jtable by editing its cell with netbean. someone help please

Member Avatar for rproffitt
0
213
Member Avatar for khate
Member Avatar for rproffitt
0
87
Member Avatar for Selomie

1. Measuring the effect of Parallelization Using one of the suggested methods in class ( p-threads, OpenMP, C-Sharp or Java Threads) implement an application that adds two integer vectors (A,B) and store the result on vector C. The size of these vectors is to be set at 67108864. Measure the …

Member Avatar for rubberman
0
290
Member Avatar for Patrick_22

Hello guys, am making a desktop application using javafx and after making the exe installer with inno and wix. the problem is after installing the program everithing is working properly but when you go to source file all my classes are there intact so it can be changed easyly. HOW …

Member Avatar for JamesCherrill
0
340
Member Avatar for Mirty

Instructions are in the image above. This is what I have now. Everything is done except the last part where if you click Yes the program is supposed to continue with other calculations. This is where am stuck. import javax.swing.JOptionPane; public class OPTIMA2 { public static void main(String[] a) { …

Member Avatar for JamesCherrill
0
200
Member Avatar for Jay_24

I think XML is declarative , I am not sure though if you have the right answer could you please provide sources doing a project for analysis of programming languages. This information would be greatly appreciated.

Member Avatar for Jay_24
0
245

The End.