// PURPOSE: An exercise in tracing a program and understanding
// assignment statements and expressions.
#import java.util.Scanner;
Public class Trace{
public static void main (String[] args){
int one, two, three;
double what;
Scanner scan = new Scanner(System.in);
System.out.print ("Enter two integers: ");
one = scan.nextInt();
two = scan.nextInt();
system.out.print("Enter a floating point number: ");
what = scan.nextDouble();
three = 4 * one + 5 * two;
two = 2 * one;
system.out.println ("one " + two + ":" + three);
one = 46 / 5 * 2 + 19 % 4
three = one + two;
what = (what + 2.5) / 2
System.out.println (what + " is what!");
}
//PURPOSE: An exercise in tracing a program and understanding
// assignment statements and expression.
import java.util.Scanner;
public class trace
{
public static void main (String[] args)
{
int one, two, three
double what;
Scanner scan = new Scanner(system.in);
system.out.print ("Enter two integers: ");
one = scan.nextInt();
two = scan.nextInt();
system.out.print("Enter a floating number: ");
what = scan.nextDouble();
three = 4 * one plus 5 * two;
two = 2 * one;
system.out.println ("one" + two + ":" + three);
one = 46 / 5 * 2 + 19 % 4
three = one + two;
what = (what + 2.5) / 2
system.out.println (what + "is what!");
}
}
MOD EDIT: Please use CODE Tags to enclose your code like this

New Topic/Question
Reply




MultiQuote




|