No one has voted on any posts yet. Votes from other community members are used to determine a member's reputation amongst their peers.
43 Posted Topics
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: > double balance, look at the above not comma ...should be ; :) | |
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*" )); ![]() | |
My only issue here is i am not able to invoke line 41 owner.pets[ 3 ].getAction();? Any ideas why? `Inline Code Example Here` abstract class Pet1 { abstract void perform(); } class Dog extends Pet { void perform() { System.out.println("*The dog rolls over*"); } } class GoldFish extends Pet{ void … | |
Hi My issue is i cant get the arrys correct,with abstract class.Can some one highlight to me the error in class Example1.I want to create 2 extra pets (iguana & hamster) but i am getting it wrong. below are the errors from my complier 23.java:37: error: constructor GoldFish in class … | |
hi, i read through a few website ,gone through a few examplebut i am still getting 01 error in my code? Error message: goldFish.java:11: error: cannot find symbol void perform(){System.out.printIn(this.action); ^ symbol: method printIn(String) location: variable out of type PrintStream 1 error abstract class Pet { abstract void perform(); } … | |
Hi Why am i getting error i the below code. abstract class SuperHeroes { abstract void perform(); } class IronMan extends SuperHeroes{ String action="Blowing bubbles"; IronMan(String action){ this.action = action; } void perform(){System.out.printIn(this.action); } } | |
Hi below is an example.I want to know,what does one mean by, 1.create a new class that extends SuperHeroes. 2.have a non static field named: action. thank you. abstract class SuperHeroes { abstract void perform(); } class Thor extends SuperHeroes { void perform() { System.out.println("*Snap your neck with his hammer*"); … | |
hi below code is an example.I hav couple of questions 1)The highlighted bold red code(myParrot[0]...)can it be simplifyed? 2)Can i use random to generate a given set of numbers?How? [CODE]public class Bird{ public static void main(String[] args) { int[] myParrot = new int[3]; [B][COLOR="Red"]myParrot[0]=1; myParrot[1]=2; myParrot[2]=3;[/COLOR][/B] for (int feature=0; i<myParrot.length; … | |
Can anyone give me an example iniitialing a non zero value using arrays If u cant give an example pls dont respond.Thanks:) | |
Hi, Can anyone go through my code to brush it up?I got the correct output,printed below, but i need some polishing of the below loop assignment. 1.Should i be using 2 while loops? 2.Regarding the [B]output[/B]-How can i align the verticle columns and the output neatly. [ICODE]public class MK{ public … | |
[ICODE]System.out.println("Extra credit\nRe-enter number of seconds:"); int j = input.nextInt(); int i =(j/60); int k = (j%60); System.out.println(j+" seconds is " +i+" minutes and "+k+" seconds.");[/ICODE] Hi when i key in 30 for j the correct answer should be [COLOR="Red"]30seconds is 0minutes and 0seconds.[/COLOR] However my above code gives me 30seconds … | |
Suppose that the tuition for a university is $ 10,000 this year and increases 5% every year. Write a program that uses a loop to compute the tuition in ten years. Write another program that computes the total cost of four years worth of tuition starting 18years from now. I … ![]() | |
hi Got 2 questions. 1.How can i simplify 4 variables all with same condition? if a,b,c,d <1 System.out.println("Invalid input");? How to put this in a simple code?I know it can be done individually. 2.if the above condition is false i dont want my code to go further and calculate the … | |
Hi, I want my output to show to two decimals.If the output is $6.075,instead of bring it to $6.08,i prefer it showed $6.07.How am i able to do this? I used the below System.Out but kept getting $6.08. [ICODE]System.out.printf("%s%.2f\n","State Withholding(9.0%):$",stateWithholding);[/ICODE] Thank You :) ![]() | |
Hi can someone help in in understanding the following code esp the "?".I cant understand how the output 9:10:5 as obtained. Thank You. The code is as followed: [CODE]#include <iostream> using namespace std; int main() { short hour =9, minute =10, second =5; cout << (hour <10 ? "0":"" )<<hour<<":" … |
The End.