import java.util.Scanner;
public class MultiplyLoop
{
public static void main( String[] args )
{
Scanner input = new Scanner( System.in );
int counter = 0;
int result = 0;
System.out.print( "Please Enter Time Table To Be Displayed: " );
int table = input.nextInt();
//Creates a Multiplication Table Based On User Input.
while ( counter <= 12 ) {
result = counter * table;
System.out.println( counter + " * " + table + " = " + result );
counter++;
}
}
}
Tuesday, 20 November 2012
A Java Program That Converts Mbps to MBps.
import java.util.Scanner;
public class Mbps2MBps
{
public static void main( String[] args )
{
Scanner input = new Scanner( System.in );
double mbps, mBps;
System.out.print( "Please Enter Value in Mbps in two decimal places: " );
mbps = input.nextDouble();
//Converts Values from Mega bits/second to Mega bytes/second
mBps = mbps * 0.125;
System.out.println( mbps + "Mbps is " + mBps + "MBps." );
}
}
public class Mbps2MBps
{
public static void main( String[] args )
{
Scanner input = new Scanner( System.in );
double mbps, mBps;
System.out.print( "Please Enter Value in Mbps in two decimal places: " );
mbps = input.nextDouble();
//Converts Values from Mega bits/second to Mega bytes/second
mBps = mbps * 0.125;
System.out.println( mbps + "Mbps is " + mBps + "MBps." );
}
}
Monday, 19 November 2012
A Java Program That Assesses Numbers and Displays Results
import java.util.Scanner;
public class VariousSelections //A Java Program That Will Blow Your Mind (215) lines.
{
public static void main( String[] args)
{
Scanner input = new Scanner( System.in );
int num1, num2, num3, num4, num5, num6, num7, num8,
num9, num10, num11, num12;
System.out.print( "Please Enter a Number For Assessment: " );
num1 = input.nextInt();
numerousSelections( num1 );
System.out.print( "\nPlease Enter First Number: " );
num2 = input.nextInt();
System.out.print( "Please Enter Second Number: " );
num3 = input.nextInt();
twoNumbers( num2, num3 );
System.out.print( "\nPlease Enter Your Age: " );
num4 = input.nextInt();
age( num4 );
System.out.print( "\nPlease Enter First Number: " );
num5 = input.nextInt();
System.out.print( "Please Enter Second Number: " );
num6 = input.nextInt();
largerNumber( num5, num6 );
System.out.print( "\nPlease Enter First Number: " );
num7 = input.nextInt();
System.out.print( "Please Enter Second Number: " );
num8 = input.nextInt();
System.out.print( "Please Enter Third Number: " );
num9 = input.nextInt();
System.out.print( "Please Enter Fourth Number: " );
num10 = input.nextInt();
largerSmallerNumber( num7, num8, num9, num10 );
System.out.print( "\nPlease Enter A Month Number: " );
num11 = input.nextInt();
month( num11 );
System.out.print( "\nPlease Enter A Month Number: " );
num12 = input.nextInt();
monthDays( num12 );
}
public static void numerousSelections( int num1 )
{
if ( num1 == 0 ) {
System.out.println( "Your number is equal to 0" );
}
if ( num1!= 0 ) {
System.out.println( "Your number is not equal to 0" );
}
if ( num1 <= 0 ) {
System.out.println( "Your number is less than or equal to 0" );
}
if (( num1 >= 1 ) && ( num1<= 20 )) {
System.out.println( "Your number is between 1 and 20" );
}
if ((( num1 >= 1 ) && ( num1 <= 20 )) || (( num1 >= 100 ) && ( num1 <= 120 ))) {
System.out.println( "Your number is between 1 and 10 or 100 and 120" );
}
}
public static void twoNumbers( int num2, int num3 )
{
if ( num2 == num3 ){
System.out.println( "The Numbers Are Equal" );
}
else {
System.out.println( "The Numbers Are Not Equal" );
}
}
public static void age( int num4 )
{
if ( num4 < 18 ) {
System.out.println( "User is a teenager who recently hit puberty" );
}
else if (( num4 >= 18 ) && ( num4 <= 21 )) {
System.out.println( "User can Drink Beer" );
}
else {
System.out.println( "User is an Adult" );
}
}
public static void largerNumber( int num5, int num6 )
{
if ( num5 > num6 ) {
System.out.println( num5 + " is the larger of the numbers" );
}
else if ( num5 == num6 ) {
System.out.println( num5 + num6 + " are equal" );
}
else {
System.out.println( num6 + " is the greater of the numbers" );
}
}
public static void largerSmallerNumber( int num7, int num8, int num9, int num10 )
{
if (( num7 > num8) && ( num7 > num9 ) && ( num7 > num10 )) {
System.out.print( num7 + " is larger than the rest while " );
}
if (( num8 > num7) && ( num8 > num9 ) && ( num8 > num10 )) {
System.out.print( num8 + " is larger than the rest while " );
}
if (( num9 > num7) && ( num9 > num8 ) && ( num9 > num10 )) {
System.out.print( num9 + " is larger than the rest while " );
}
if (( num10 > num7) && ( num10 > num8 ) && ( num10 > num9 )) {
System.out.print( num10 + " is larger than the rest while " );
}
if (( num7 < num8) && ( num7 < num9 ) && ( num7 < num10 )) {
System.out.println( + num7 + " is smaller than the rest" );
}
if (( num8 < num7 ) && ( num8 < num9 ) && ( num8 < num10 )) {
System.out.println( + num8 + " is smaller than the rest" );
}
if (( num9 < num7) && ( num9 < num8 ) && ( num9 < num10 )) {
System.out.println( + num9 + " is smaller than the rest" );
}
if (( num10 < num7) && ( num10 < num8 ) && ( num10 < num9 )) {
System.out.println( + num10 + " is smaller than the rest" );
}
}
public static void month( int num11 )
{
if ( num11 == 1) {
System.out.println( "You Are In The Month Of January" );
}
if ( num11 == 2) {
System.out.println( "You Are In The Month Of February" );
}
if ( num11 == 3) {
System.out.println( "You Are In The Month Of March" );
}
if ( num11 == 4) {
System.out.println( "You Are In The Month Of April" );
}
if ( num11 == 5) {
System.out.println( "You Are In The Month Of May" );
}
if ( num11 == 6) {
System.out.println( "You Are In The Month Of June" );
}
if ( num11 == 7) {
System.out.println( "You Are In The Month Of July" );
}
if ( num11 == 8) {
System.out.println( "You Are In The Month Of August" );
}
if ( num11 == 9) {
System.out.println( "You Are In The Month Of September" );
}
if ( num11 == 10) {
System.out.println( "You Are In The Month Of October" );
}
if ( num11 == 11) {
System.out.println( "You Are In The Month Of November" );
}
if ( num11 == 12) {
System.out.println( "You Are In The Month Of December" );
}
}
public static void monthDays( int num12 )
{
if ( num12 == 1) {
System.out.println( "You Are In The Month Of January with 31 days" );
}
if ( num12 == 2) {
System.out.println( "You Are In The Month Of February with 28 or 29 days" );
}
if ( num12 == 3) {
System.out.println( "You Are In The Month Of March with 31 days" );
}
if ( num12 == 4) {
System.out.println( "You Are In The Month Of April with 30 days" );
}
if ( num12 == 5) {
System.out.println( "You Are In The Month Of May with 31 days" );
}
if ( num12 == 6) {
System.out.println( "You Are In The Month Of June with 30 days" );
}
if ( num12 == 7) {
System.out.println( "You Are In The Month Of July with 31 days" );
}
if ( num12 == 8) {
System.out.println( "You Are In The Month Of August with 31 days" );
}
if ( num12 == 9) {
System.out.println( "You Are In The Month Of September with 30 days" );
}
if ( num12 == 10) {
System.out.println( "You Are In The Month Of October with 31 days" );
}
if ( num12 == 11) {
System.out.println( "You Are In The Month Of November with 30 days" );
}
if ( num12 == 12) {
System.out.println( "You Are In The Month Of December with 31 days" );
}
}
}
public class VariousSelections //A Java Program That Will Blow Your Mind (215) lines.
{
public static void main( String[] args)
{
Scanner input = new Scanner( System.in );
int num1, num2, num3, num4, num5, num6, num7, num8,
num9, num10, num11, num12;
System.out.print( "Please Enter a Number For Assessment: " );
num1 = input.nextInt();
numerousSelections( num1 );
System.out.print( "\nPlease Enter First Number: " );
num2 = input.nextInt();
System.out.print( "Please Enter Second Number: " );
num3 = input.nextInt();
twoNumbers( num2, num3 );
System.out.print( "\nPlease Enter Your Age: " );
num4 = input.nextInt();
age( num4 );
System.out.print( "\nPlease Enter First Number: " );
num5 = input.nextInt();
System.out.print( "Please Enter Second Number: " );
num6 = input.nextInt();
largerNumber( num5, num6 );
System.out.print( "\nPlease Enter First Number: " );
num7 = input.nextInt();
System.out.print( "Please Enter Second Number: " );
num8 = input.nextInt();
System.out.print( "Please Enter Third Number: " );
num9 = input.nextInt();
System.out.print( "Please Enter Fourth Number: " );
num10 = input.nextInt();
largerSmallerNumber( num7, num8, num9, num10 );
System.out.print( "\nPlease Enter A Month Number: " );
num11 = input.nextInt();
month( num11 );
System.out.print( "\nPlease Enter A Month Number: " );
num12 = input.nextInt();
monthDays( num12 );
}
public static void numerousSelections( int num1 )
{
if ( num1 == 0 ) {
System.out.println( "Your number is equal to 0" );
}
if ( num1!= 0 ) {
System.out.println( "Your number is not equal to 0" );
}
if ( num1 <= 0 ) {
System.out.println( "Your number is less than or equal to 0" );
}
if (( num1 >= 1 ) && ( num1<= 20 )) {
System.out.println( "Your number is between 1 and 20" );
}
if ((( num1 >= 1 ) && ( num1 <= 20 )) || (( num1 >= 100 ) && ( num1 <= 120 ))) {
System.out.println( "Your number is between 1 and 10 or 100 and 120" );
}
}
public static void twoNumbers( int num2, int num3 )
{
if ( num2 == num3 ){
System.out.println( "The Numbers Are Equal" );
}
else {
System.out.println( "The Numbers Are Not Equal" );
}
}
public static void age( int num4 )
{
if ( num4 < 18 ) {
System.out.println( "User is a teenager who recently hit puberty" );
}
else if (( num4 >= 18 ) && ( num4 <= 21 )) {
System.out.println( "User can Drink Beer" );
}
else {
System.out.println( "User is an Adult" );
}
}
public static void largerNumber( int num5, int num6 )
{
if ( num5 > num6 ) {
System.out.println( num5 + " is the larger of the numbers" );
}
else if ( num5 == num6 ) {
System.out.println( num5 + num6 + " are equal" );
}
else {
System.out.println( num6 + " is the greater of the numbers" );
}
}
public static void largerSmallerNumber( int num7, int num8, int num9, int num10 )
{
if (( num7 > num8) && ( num7 > num9 ) && ( num7 > num10 )) {
System.out.print( num7 + " is larger than the rest while " );
}
if (( num8 > num7) && ( num8 > num9 ) && ( num8 > num10 )) {
System.out.print( num8 + " is larger than the rest while " );
}
if (( num9 > num7) && ( num9 > num8 ) && ( num9 > num10 )) {
System.out.print( num9 + " is larger than the rest while " );
}
if (( num10 > num7) && ( num10 > num8 ) && ( num10 > num9 )) {
System.out.print( num10 + " is larger than the rest while " );
}
if (( num7 < num8) && ( num7 < num9 ) && ( num7 < num10 )) {
System.out.println( + num7 + " is smaller than the rest" );
}
if (( num8 < num7 ) && ( num8 < num9 ) && ( num8 < num10 )) {
System.out.println( + num8 + " is smaller than the rest" );
}
if (( num9 < num7) && ( num9 < num8 ) && ( num9 < num10 )) {
System.out.println( + num9 + " is smaller than the rest" );
}
if (( num10 < num7) && ( num10 < num8 ) && ( num10 < num9 )) {
System.out.println( + num10 + " is smaller than the rest" );
}
}
public static void month( int num11 )
{
if ( num11 == 1) {
System.out.println( "You Are In The Month Of January" );
}
if ( num11 == 2) {
System.out.println( "You Are In The Month Of February" );
}
if ( num11 == 3) {
System.out.println( "You Are In The Month Of March" );
}
if ( num11 == 4) {
System.out.println( "You Are In The Month Of April" );
}
if ( num11 == 5) {
System.out.println( "You Are In The Month Of May" );
}
if ( num11 == 6) {
System.out.println( "You Are In The Month Of June" );
}
if ( num11 == 7) {
System.out.println( "You Are In The Month Of July" );
}
if ( num11 == 8) {
System.out.println( "You Are In The Month Of August" );
}
if ( num11 == 9) {
System.out.println( "You Are In The Month Of September" );
}
if ( num11 == 10) {
System.out.println( "You Are In The Month Of October" );
}
if ( num11 == 11) {
System.out.println( "You Are In The Month Of November" );
}
if ( num11 == 12) {
System.out.println( "You Are In The Month Of December" );
}
}
public static void monthDays( int num12 )
{
if ( num12 == 1) {
System.out.println( "You Are In The Month Of January with 31 days" );
}
if ( num12 == 2) {
System.out.println( "You Are In The Month Of February with 28 or 29 days" );
}
if ( num12 == 3) {
System.out.println( "You Are In The Month Of March with 31 days" );
}
if ( num12 == 4) {
System.out.println( "You Are In The Month Of April with 30 days" );
}
if ( num12 == 5) {
System.out.println( "You Are In The Month Of May with 31 days" );
}
if ( num12 == 6) {
System.out.println( "You Are In The Month Of June with 30 days" );
}
if ( num12 == 7) {
System.out.println( "You Are In The Month Of July with 31 days" );
}
if ( num12 == 8) {
System.out.println( "You Are In The Month Of August with 31 days" );
}
if ( num12 == 9) {
System.out.println( "You Are In The Month Of September with 30 days" );
}
if ( num12 == 10) {
System.out.println( "You Are In The Month Of October with 31 days" );
}
if ( num12 == 11) {
System.out.println( "You Are In The Month Of November with 30 days" );
}
if ( num12 == 12) {
System.out.println( "You Are In The Month Of December with 31 days" );
}
}
}
Sunday, 18 November 2012
Linear Programming
A video footage simplifying Linear Programming and its implementation in a real life scenario.
Hope you enjoy it, i find it exhilarating :)
Subscribe to:
Posts (Atom)