No one has voted on any posts yet. Votes from other community members are used to determine a member's reputation amongst their peers.
Hi I know couple of programming languages. I have been juggling for months with the question, if its worth taking a Cert in Android application development and /or IOS application development. I have asked around and got responses such as its a fad, tech will change in a few years … |
|
Hey guys i am struggling a bit with Jframe.Pretty new to JFrame. I hav a file in Picture class and need to bring the BufferedImage to the DrawingImageControlPanel.How do i do this. I know the template for doing this is as stated below. public class ClassName extends JPanel { instance … |
|
I understand overloading but what does someone mean by "Overload the increaseRed method with an increaseRed method that accepts a number that specifies an increase factor"? The increasedRed() is as follows: public void increaseRed() { Pixel[] pixelArray = this.getPixels(); Pixel pixel = null; int value = 0; int index = … |
|
hi my complier showing me that i am having 4 errors.In **t1.drawHexagon(int width)**; & **t1.drawPentagon( int width )**.Its says .class and ";" expected. Help. Thank you import java.util.*; import java.awt.*; public class Turtle extends SimpleTurtle { public Turtle (int x, int y, Picture picture) { super(x,y,picture); } public Turtle (int … |
|
Hey after all the fuss about Composition and inheritance and drilling in the fact that Composition is superior,I dont understand why the need to know ploymorphism?Since it is gotten through inheritance.Is this a joke? Whats the industry practice?Are they use **widely**? |
|
Re:
Hello, I just needed some help with a code error. When I compile the code below, I keep getting this error: Program2.java:12: error: ';' expected Scanner keyboard = new Scanner(System.in); 1 error Could somebody please let me know what I am doing wrong? Thanks. import java.util.Scanner; // Needed for Scanner … |
|
Can anyone correct my mistake. Provided code: public void testSetBaseSalaryNegative() { final double altBaseSalary = -999.99; try { emp.setBaseSalary(altBaseSalary); // Expecting an IllegalArgumentException fail ("Negative base-salary values should be rejected by setBaseSalary and result in an IllegalArgumentException"); } catch (IllegalArgumentException ex) { // This is the nominal case } catch … |
|
How can i implement this constructor? I tried replacing commissionEmployee = new CommissionEmployee with this but the complier asked me to create another constructor. public class BasePlusCommissionEmployeeComposition { private double baseSalary; private CommissionEmployee commissionEmployee; // six-argument constructor public BasePlusCommissionEmployeeComposition( String first, String last, String ssn, double sales, double rate, double … |
|
Hi, What is for ( : ) in java.i know what a loop is but lately when i am doing excercises these keep coming up Example:** for(Field currentField : emp.getClass().getDeclaredFields())** |
|
In my Class IntegerSet i hav declared the below method but its not printing when i ran the test public static IntegerSet union(IntegerSet setA, IntegerSet setB){ IntegerSet u = new IntegerSet(); for (int i=0;i <= CAPACITY; i++) if (a[i]==true || setB.a[i]==true) u.a[i]=true; return u; In Testing in main, `System.out.println("The union … |
|
I am getting the following error,"The static field IntegerSet.a should be accessed in a static way" `public static IntegerSet union(IntegerSet setA, IntegerSet setB){ IntegerSet u = new IntegerSet(); for (int i=0;i <= CAPACITY; i++) if (a[i]==true || setB.a[i]==true)// u.a[i]=true; return u; My Class is as followed: public class IntegerSet { … |
|
1.Create class IntegerSet. Each IntegerSet object can hold integers in the range 0-100. The set is represented by an array of bools. Array element a[ i ] is true if integer i is in the set. Array element a[ j ] is false if integer j is not in the … |
|
Just need some understanding on the various Prime number calculations.Please explain 1. verify by brute force that a number is evenly divisible only by 1 and itself.(dont implement the Sieve of Eratosthenes algorithm) 2. writing and running the program with upper limits of n/2 and the square root of n. … |
|
double a [3]={1.1,2.2,3.3}; cout<<a[0]<<" "<<a[1]<<" "<<a[2]<<endl; a[1]=a[2]; cout<<a[0]<<" "<<a[1]<<" "<<a[2]<<endl; ans to the above is 1.1 2.2 3.3 1.1 3.3 3.3 I am new to array. Please expalin why a[1]=a[2] gave me 3.3 3.3. thank you |
|
Hi my codes works fine.When i key in ,for example, asdf 546,(f and 5 is separated by space), the programe rightly take it as invalid input ,however it takes asdf and 546 as separate type and return two "Invalid input".See below. I hav no clue why it does that oher … |
|
Hi i came up with the following code for my Assignment.It works.What i dont understand was the following code, the rest of the code i did myself. if ( value == 1 ) smallest = randomNum; Why do i need to assign value to 1? Rest of my codes System.out.println("How … |
|
I hav this code here that prompt me for only 1 randomNum.I know i need a second loop.how can i go about doing it public static void main(String[] args) { int ii=0; int value; int randomNum; System.out.println("How many integers shall we compare? (Enter a positive integer):"); ii = input.nextInt(); randomNum … |
|
Hi i am finding this a challenge.I am suppose to get 12345 12345 but my below code is giving me 1112314151 1222324252 what mistake am i making? #include <iostream> using namespace std; int main() { int row,column; for(row=1;row < 3;row++) { for(column=1 ;column < 6; column++) cout <<column<< row <<' … |
|
i was learning about Functions from a book.Keyed in the following code to my visual studio express and got two errors: expect a declaration and '{' : missing function header(old-style formal list. what do they mean? Does this have to do with ans/isoi std? #include <iostream> using namespace std; void … |
|
I was reading a book and it said "Mac names cannot be overloaded and the macro preprossor cannot handle recursive calls: #define PRINT (a,b)cout<<(a)<<(b) #define PRINT (a,b,c) cout<<(a)<<(b)<<(c) /*trouble?:redefines,does not overload*/ Can someone pls explain possibliy with examples? |
|
int main() My code works fine...i will be using const later ,hence my variable are capital letters.What i need a little help is when the NUM_VALUE is negative.If i am not wrong its call integer division error.(where one or more operand is negative.How can i avoild this? I inserted under … |
|
how do u convert the below to a 'for' loop? int x = 123456; int y =0; while (x > 0) { y *= 10; y += x % 10; x /= 10;} |
|
Hi, how do i output a list,1-5 of the following factorial? #include <stdio.h> #include <stdlib.h> #define fact 5 int main(void) { int i,result=1; for (i=fact;i>=1;i--) result*=i; printf("factorial of (%d) = %d\n", fact, result); return(EXIT_SUCCESS); } |
|
I hav this code below.How can i use Macros , so that i can change at random "-" and " " without searching through the codes? #include <iostream> using namespace std; int main() { int row,col,n; cout<<"Enter an Integer number:\n"; cin>> n; cout<<("Numerical Pattern\n"); for ( row = 1 ; … |
|
hi i am trying to change an input from upper case to lowercase.I am not getting it right.When i key in say Liverpool or TIGERS it only show l and t respectively. Need assistance #include <iostream> #include <cctype> #include<iostream> using namespace std; int main() { char s; cout<<"Name your favourite … |
|
I am getting an error fors x in the polynomial expression.If i put my cursor it says Expected:a';' Code blocks are created by indenting at least 4 spaces ... and can span multiple lines #include<stdio.h> #include<stdlib.h> int main(void) { double x=2.55; double polynomial=3x^3-5x^2+6; printf("The value of polynomial is %lf\n",polynomial); system("pause"); … |
|
hi in C if someone says printf(%d,x); is x int and double or just int? I know %d is decimal . Will this be the same for printf(%d,&x);? Also cin>>x.Can x be any arithematic type? Thanks |
|
Is there any errors here, public static void bash(String s,ing count){ for (ing i= 0;i<count;i++) { System.out.println(s); } } |
|
You can only inherit from one parent class in java. true or false.Why? |
|
can anyone see my error? error output error: ';' expected System.out.println((GoldFish)owner.pets[ 9 ]).getAction("*Rat eats alot*" )); ^ owner.pets[ 9 ] = new GoldFish(); Pet BlackMoor = owner.pets[ 9 ]; System.out.println((GoldFish)owner.pets[ 9 ]).getAction("*Rat eats alot*" )); |