Nick Apseloff 3rd Quarter
From WLCS
Contents
Goals
1. [ ]
2. [ ]
3. [ ]
4. [ ]
5. [ ]
6. [ ]
7. [ ]
8. [ ]
9. [ ]
10. [ ]
Documentation
Goal 1 ( )
public class dice {
public static void main(String[] args) {
int roll1;
int roll2;
roll1 = (int)(Math.random()*6) + 1;
roll2 = (int)(Math.random()*6) + 1;
System.out.println("The first die comes up " + roll1);
System.out.println("The second die comes up " + roll2);
System.out.println("Your total roll is " + (roll1+roll2));
}
}
import java.io.*;
public class name {
private static BufferedReader stdin =
new BufferedReader( new InputStreamReader( System.in ) );
public static void main(String[] args) throws IOException {
String person;
System.out.println("Please enter your name: ");
person = stdin.readLine();
System.out.println("Hello, " + person.toUpperCase() + ", nice to meet you!");
}
}
import java.io.*;
public class change {
private static BufferedReader stdin =
new BufferedReader( new InputStreamReader( System.in ) );
public static void main(String[] args) throws IOException {
System.out.println("How many quarters do you have?: ");
String quarters = stdin.readLine();
int quartersint = Integer.parseInt(quarters);
System.out.println("How many dimes do you have?: ");
String dimes = stdin.readLine();
int dimesint = Integer.parseInt(dimes);
System.out.println("How many nickels do you have?: ");
String nickels = stdin.readLine();
int nickelsint = Integer.parseInt(nickels);
System.out.println("How many pennies do you have?: ");
String pennies = stdin.readLine();
int penniesint = Integer.parseInt(pennies);
double total = quartersint*.25 + dimesint*.1 + nickelsint*.05 + penniesint*.01;
System.out.println("You have $" + total + "!");
}
}
References