Jump to content

Check out our Community Blogs


Member Since 03 Sep 2012
Offline Last Active Oct 10 2012 02:44 PM

Topics I've Started

Displaying Distinct Numbers from Array

10 October 2012 - 08:44 AM

Hey everyone again,

I'm trying to display 3 distinct integers from user input

the length of the array is also 3

so for example:

1, 1, 2, 3, 4

the distinct set would be 2,3,4

Here is what I have so far, however at the moment it is terminating after the I input data the 3rd time, and not letting me collect all 3 unique numbers before printing

Array accept only positive values

10 October 2012 - 12:44 AM

import java.util.Scanner;
public class test {
public static void main (String[] args) {
Scanner scan = new Scanner(System.in);
System.out.println("Enter numbers: ");
int num = scan.nextInt();
int numbers = 5;
int array[] = new int [numbers];
int numCount = 0;

while (numCount < numbers) {


for(int i:array){


I'm trying to do two things, make it accept only positive numbers from user,
and also to terminate if the user enters 0

And also when I enter like the numbers 1,2,3,4,5,6

in a row it omits the first 1 I enter, and only stores the number 2,3,4,5,6

Any help would be appreciated

Displaying Percentages of Columns in SQL

18 September 2012 - 06:50 AM

I have a table, and this is what I'm trying to do

i have to count 2 columns and then use the counts to divide them and multiply by 100 to get the percentage, then what the answer wants is 100-85, and it also has to be rounded to 2 decimals

column1, column2, Percentage
204 240 100 - 85 = 0.15

SELECT COUNT(column1) FROM table

SELECT COUNT(column2) From table

SELECT ROUND(column_name,2) FROM table_name

yeah, just not sure how to use those 2 counts, and add another query to calculate the percentages from the counts.

Any help is greatly appreciated!!!!!!

SQL Help

13 September 2012 - 12:40 AM

So Im meant to print
a few sentences rather than the table

IT's meant to be something along the lines of this but I'm not sure what to use to print text

The summer Olympic games scheduled for 1916 (Games number:6) were cancelled

With variables

The summer Olympic games scheduled for SG_YEAR (Games number:SG_GAMENO) were cancelled

There are 3 lines which should be printed

Checking if a string contains upper or lower case letters

03 September 2012 - 09:33 PM

I have to receive user input via the scanner, and then
check if the word they entered contains upper or lowercase letters,

would the method isUpperCase & isLowerCase work??
If so how would you apply it to strings.

Or would i have to use string.length and char.At??

Thanks any help is appreciated

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download