Blog Archives

Write a program that prints the sum of two random integers between 1 and 6 (such as you might get when rolling dice).

//TEST ** (double star) program
import java.lang.Math;

public class DicerollTEST{
public static void main(String[] args) {
int SIDES = 6;                                                                                //declares there 6 sides on a die and int SIDES
int a = 1 + (int) (Math.random() * SIDES);                       //Gives the random roll to one die
int b = 1 + (int) (Math.random() * SIDES);                      //Gives the random roll to the second die
int sum = a + b;                                                                            //Adds the sum of the two dice
System.out.println(sum);                                                       //Prints the sum of the 2 dice


Write a program that takes two int values a and b from the command line and prints a random integer between a and b.

import java.lang.Math;
import java.util.Scanner;

public class RandomNumbers{

public static void main(String args[])
System.out.println(“Enter a number “); //This prompts the user to enter a number
Scanner scan = new Scanner(;
double t = scan.nextDouble(); //Stores the valuse as a double

System.out.println(“Enter a second number “); //This prompts the user to enter a 2nd number
double v = scan.nextDouble(); //Stores the valuse as a double

double w = Math.floor(Math.random()*(t-v+1)+v); //assigns w to a random number in between t & v
System.out.println(w); //prints w


Wind chill

Given the temperature t (in Fahrenheit) and the wind speed v (in miles per hour), the National Weather Service defines the effective temperature (the wind chill) to be:

w = 35.74 + 0.6215 t + (0.4275 t – 35.75) v0.16

Write a program that takes two double command-line arguments t and v and prints out the wind chill. Use Math.pow(a, b) to compute ab. Note: the formula is not valid if t is larger than 50 in absolute value or if v is larger than 120 or less than 3 (you may assume that the values you get are in that range).


Write a program that takes two int values

import java.util.Scanner;

public class SpringSeason{

public static void main(String args[])
System.out.println(“Enter the month “); //This prompts the user to enter a month
Scanner scan = new Scanner(;
int month = scan.nextInt(); //Stores the valuse as an int

System.out.println(“Enter the day “); //This prompts the user to enter day
int day = scan.nextInt(); //Stores the valuse as an int

boolean wootwoot = (month == 3 && day >= 20 && day <= 31)
|| (month == 4 && day >= 1 && day <= 30)
|| (month == 5 && day >= 1 && day <= 31)
|| (month == 6 && day >= 1 && day <= 20);



The jury has turned in a partial verdict in Oracle v. Google, but was it really qualified to do so?

The jury has returned its partial verdict for the first (and perhaps most important) phase of the Oracle v. Google trial: The 12 jurors found Google had infringed on Oracle’s copyrights by its use of structure, sequence, and organization (SSO) of the 37 Java APIs used in Java.

For weeks now, the courtroom has echoed with arguments and testimony to determine one key principle: Are programming languages copyrightable, or aren’t they? And with this decision, twelve of our peers have declared that at least to some extent, they are.

The partial verdict was accepted by Judge William Alsup, who said last week in court, “I’m going to receive a partial verdict. I’m not going to let this work go to waste.”

Google uses the Java programming language in its Android mobile operating system. Oracle controls and owns Java, and it’s claiming that Google’s particular use of the language violates Oracle’s copyrights and patents.

Google has been arguing that no programming language, especially an open-source one (as Java is), can be copyrighted.

The first phase of this landmark trial was to settle this debate once and for all. However, based on what this reporter knows, both as a student of Java and as a firsthand observer in the courtroom, no one is more ill-equipped to make this decision than Judge William Alsup and the jury of San Franciscans selected for this trial.

As the American justice system dictates, the jury was selected by carefully avoiding anyone with expertise in the field. Engineers from multiple large Silicon Valley companies were turned away. The final jury members selected included a plumber, a nurse, a retired photographer, a store designer for Gap, a city bus driver, and a postal worker — in other words, folks with as little hope of understanding the deeply technical language and concepts they were about to encounter as I would have of understanding the intricacies of plumbing or the city’s public transit system.

First, Android founder Andy Rubin told the court that he had been under the impression that some of the Java APIs were copyrighted and that Google would need a license from then-Java-owner Sun to use them. Next, former Google CEO Eric Schmidt told the court that he thought Google didn’t need anyone’s permission to use those APIs and other parts of the Java language… mostly.  Read More

%d bloggers like this: