Advertisement
ZhenghaoZhu

Input Homework

Oct 25th, 2015
101
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 1.08 KB | None | 0 0
  1. //Zhenghao Zhu
  2. //10/24/15
  3. //Input Homework
  4.  
  5. import java.util.Scanner;
  6.  
  7. public class InputHomework{
  8.   public static void main (String []args){
  9.     Scanner input = new Scanner(System.in);
  10.     System.out.print("Enter your full name: : ");
  11.     String fullname = input.next();
  12.     System.out.print(fullname + " could you please give me the first integer?");
  13.     int n1 = input.nextInt();
  14.     System.out.print(fullname + " could you please give me a second integer?");
  15.     int n2 = input.nextInt();
  16.     System.out.print(fullname + " could you please give me a third integer?");
  17.     int n3 = input.nextInt();
  18.     System.out.println(n1 + n2 + n3);
  19.     System.out.println(n1 - n2 - n3);
  20.     System.out.println(n1 * n2 * n3);
  21.     n1 = n1 + n2 + n3;
  22.     n2 = n1 - n2 - n3;
  23.     n3 = n1 / n2 / n3;
  24.     System.out.println(fullname + ", this are the results of adding, subtracting, and multiplying the numbers you gave me: ");
  25.     System.out.println("Addition: " + n1);
  26.     System.out.println("Subtraction: " + n2);
  27.     System.out.println("Multiplication: " + n3);
  28.  
  29.    
  30.    
  31.    
  32.   }
  33. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement