expressions-to-Java-Program

expressions-to-Java-Program.

Program 2:

Save your time - order a paper!

Get your paper written from scratch within the tight deadline. Our service is a reliable solution to all your troubles. Place an order on any task and we will take care of it. You won’t have to worry about the quality and deadlines

Order Paper Now

//import packages

import java.util.Scanner;

public class TestInput2 {

public static void main( String args[] ) {

// Declarations

Scanner input = new Scanner(System.in);

String sentence;

int number, result;

double real;

// Prompt for input

System.out.print(“Enter a sentence: “);

// Get input

sentence = input.nextLine();

//Output

System.out.println(“The sentence entered was: ” + sentence);

// Prompt for input

System.out.println(“Enter an integer number: ” );

// Get input

number = input.nextInt();

//Output

System.out.println(“The integer number entered was: ” + number);

// Prompt for input

System.out.println(“Enter a decimal point number: “);

// Get input

real = input.nextDouble();

//Output

System.out.println(“The decimal point number entered was: ” + real);

}

}

Add the following expressions to Program 2:

ï‚· Increase an integer by 10 and display the result.

ï‚· Multiply a real number by 2 and display the result.

ï‚· Divide the real number by 5, if the real number is greater than 5, and display the result.

ï‚· Get the remainder of dividing the real number by 3, if the real number is greater than 3, and display the result.

expressions-to-Java-Program